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:
-rw-r--r--app/models/repository.rb13
-rw-r--r--app/views/projects/show.html.haml6
-rw-r--r--features/project/project.feature5
-rw-r--r--features/steps/project/project.rb12
4 files changed, 36 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 00a1032b6c4..22c16abe480 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -128,6 +128,7 @@ class Repository
Rails.cache.delete(cache_key(:commit_count))
Rails.cache.delete(cache_key(:graph_log))
Rails.cache.delete(cache_key(:readme))
+ Rails.cache.delete(cache_key(:version))
Rails.cache.delete(cache_key(:contribution_guide))
end
@@ -156,12 +157,24 @@ class Repository
Gitlab::Git::Blob.find(self, sha, path)
end
+ def blob_by_oid(oid)
+ Gitlab::Git::Blob.raw(self, oid)
+ end
+
def readme
Rails.cache.fetch(cache_key(:readme)) do
tree(:head).readme
end
end
+ def version
+ Rails.cache.fetch(cache_key(:version)) do
+ tree(:head).blobs.find do |file|
+ file.name.downcase == 'version'
+ end
+ end
+ end
+
def contribution_guide
Rails.cache.fetch(cache_key(:contribution_guide)) do
tree(:head).contribution_guide
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 9484dc9464c..c4e5087b0a1 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -44,6 +44,12 @@
= link_to project_blob_path(@project, tree_join(@repository.root_ref, readme.name)), class: 'btn btn-block' do
= readme.name
+ - if @repository.version
+ - version = @repository.version
+ = link_to project_blob_path(@project, tree_join(@repository.root_ref, version.name)), class: 'btn btn-block' do
+ Version:
+ = @repository.blob_by_oid(version.id).data
+
.prepend-top-10
%p
%span.light Created on
diff --git a/features/project/project.feature b/features/project/project.feature
index d8bb1d55e2d..d561c6e440e 100644
--- a/features/project/project.feature
+++ b/features/project/project.feature
@@ -24,3 +24,8 @@ Feature: Project Feature
When I visit edit project "Shop" page
And change project path settings
Then I should see project with new path settings
+
+ Scenario: I should see project readme and version
+ When I visit project "Shop" page
+ Then I should see project "Shop" README link
+ And I should see project "Shop" version
diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb
index 92728d474b2..7c0b2509416 100644
--- a/features/steps/project/project.rb
+++ b/features/steps/project/project.rb
@@ -24,4 +24,16 @@ class ProjectFeature < Spinach::FeatureSteps
step 'I should see project with new path settings' do
project.path.should == "new-path"
end
+
+ step 'I should see project "Shop" README link' do
+ within '.project-side' do
+ page.should have_content "README.md"
+ end
+ end
+
+ step 'I should see project "Shop" version' do
+ within '.project-side' do
+ page.should have_content "Version: 2.2.0"
+ end
+ end
end