Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-18 21:02:39 +0300
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-18 21:02:39 +0300
commitd03d63630494727e92553f168712d177ab4eb1cf (patch)
treebf669b6034b0dc7710becbeab989ec92e1116aed /app/models/repository.rb
parenta0c513bb4ecc5ef4d2d626c024de6916c5ef233a (diff)
parentb1b8261f56d35e471bc32b0f2050e27650b7c797 (diff)
Merge branch 'changelog-link' into 'master'
Add changelog, license and contribution guide links to project sidebar. If the version is known, the "Version: 7.9.0pre" button links to the changelog, otherwise a "View changelog" button is shown. ![Screen_Shot_2015-03-18_at_14.22.29](https://dev.gitlab.org/gitlab/gitlabhq/uploads/747acc018ec9a188098e0f0bc4e91cc3/Screen_Shot_2015-03-18_at_14.22.29.png) See merge request !1708
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb24
1 files changed, 22 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 7addbca8fb1..c6eaa485b8a 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -122,7 +122,7 @@ class Repository
def expire_cache
%i(size branch_names tag_names commit_count graph_log
- readme version contribution_guide).each do |key|
+ readme version contribution_guide changelog license).each do |key|
cache.expire(key)
end
end
@@ -211,7 +211,27 @@ class Repository
end
def contribution_guide
- cache.fetch(:contribution_guide) { tree(:head).contribution_guide }
+ cache.fetch(:contribution_guide) do
+ tree(:head).blobs.find do |file|
+ file.contributing?
+ end
+ end
+ end
+
+ def changelog
+ cache.fetch(:changelog) do
+ tree(:head).blobs.find do |file|
+ file.name =~ /^(changelog|history)/i
+ end
+ end
+ end
+
+ def license
+ cache.fetch(:license) do
+ tree(:head).blobs.find do |file|
+ file.name =~ /^license/i
+ end
+ end
end
def head_commit