Minor update. Fix helper bug. Minor refactor. Refs #263

This commit is contained in:
Pavel Chipiga 2012-07-31 17:35:18 +03:00
parent c33aad252b
commit 01a3572de0
4 changed files with 10 additions and 9 deletions

View File

@ -81,7 +81,7 @@ end
group :test do
gem 'rspec-rails', '~> 2.11.0', :group => 'development'
gem 'factory_girl_rails', '~> 3.5.0'
gem 'factory_girl_rails', '~> 3.6.0'
gem 'rr', '~> 1.0.4'
gem 'shoulda'
end

View File

@ -8,7 +8,7 @@ GIT
GIT
remote: git://github.com/github/gollum.git
revision: c9bc2a89f655760c0a21da6d3ab37c5f6267e96c
revision: 8422b712048656c8ea391c2d7ef27fb29f66746b
specs:
gollum (2.1.0)
github-markdown
@ -125,10 +125,10 @@ GEM
execjs (1.4.0)
multi_json (~> 1.0)
expression_parser (0.9.0)
factory_girl (3.5.0)
factory_girl (3.6.0)
activesupport (>= 3.0.0)
factory_girl_rails (3.5.0)
factory_girl (~> 3.5.0)
factory_girl_rails (3.6.0)
factory_girl (~> 3.6.0)
railties (>= 3.0.0)
ffi (1.0.11)
fssm (0.2.9)
@ -376,7 +376,7 @@ DEPENDENCIES
creole
devise (~> 2.1.2)
diff-display (~> 0.0.1)
factory_girl_rails (~> 3.5.0)
factory_girl_rails (~> 3.6.0)
github-linguist (~> 2.1.2)
gollum!
grack!

View File

@ -54,7 +54,9 @@ module GitHelper
current = url_for(p).split('?', 2).first
res = []
res << [I18n.t('layout.git.repositories.commits'), [params[:treeish].truncate(20)]] unless project.repo.branches_and_tags.map(&:name).include?(params[:treeish] || project.default_branch)
if params[:treeish].present? && !project.repo.branches_and_tags.map(&:name).include?(params[:treeish])
res << [I18n.t('layout.git.repositories.commits'), [params[:treeish].truncate(20)]]
end
linking = Proc.new {|t| [t.name.truncate(20), url_for(p.merge :treeish => t.name).split('?', 2).first]}
res << [I18n.t('layout.git.repositories.branches'), project.repo.branches.map(&linking)]
res << [I18n.t('layout.git.repositories.tags'), project.repo.tags.map(&linking)]

View File

@ -21,8 +21,7 @@ module Rosa
class Treeish
def self.matches?(request)
params = request.path_parameters
if params[:treeish] # parse existing branch (tag) and path
if (params = request.path_parameters) && params[:treeish] # parse existing branch (tag) and path
branch_or_tag = begin
(p = Project.find_by_owner_and_name params[:owner_name], params[:project_name]) &&
p.repo.branches_and_tags.detect{|t| params[:treeish].start_with?(t.name)}.try(:name) ||