Merge pull request #594 from warpc/263-refactoring
[refs #263] Refactoring git: part 2.
This commit is contained in:
commit
dc95d6c13a
2
Gemfile
2
Gemfile
|
@ -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
|
||||
|
|
10
Gemfile.lock
10
Gemfile.lock
|
@ -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!
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
%td.blob
|
||||
:plain
|
||||
<br/>
|
||||
<pre>#{link_to @blob.basename, raw_path(@project, @treeish, @path)}</pre>
|
||||
<pre>#{link_to_unless @blob.huge?, @blob.basename, raw_path(@project, @treeish, @path)}</pre>
|
||||
<br/>
|
|
@ -12,8 +12,9 @@
|
|||
- if @blob.render_as == :text && params[:action] != 'show'
|
||||
= link_to "Normal", blob_path(@project, @treeish, @path)
|
||||
\|
|
||||
= link_to "Raw", raw_path(@project, @treeish, @path)
|
||||
\|
|
||||
- unless @blob.huge?
|
||||
= link_to "Raw", raw_path(@project, @treeish, @path)
|
||||
\|
|
||||
- if @blob.render_as == :text && params[:action] != 'blame'
|
||||
= link_to "Blame", blame_path(@project, @treeish, @path)
|
||||
\|
|
||||
|
|
|
@ -62,7 +62,7 @@ Rosa::Application.configure do
|
|||
config.assets.digest = true
|
||||
|
||||
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
||||
config.assets.precompile += %w(login.css login.js reg_session.css tour.css tour.js)
|
||||
config.assets.precompile += %w(login.css login.js reg_session.css tour.css tour.js gollum/editor/langs/*.js)
|
||||
end
|
||||
|
||||
# require 'stub_xml_rpc'
|
||||
|
|
|
@ -430,4 +430,4 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
|
|||
add_index "users", ["uname"], :name => "index_users_on_uname", :unique => true
|
||||
add_index "users", ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true
|
||||
|
||||
end
|
||||
end
|
|
@ -7,7 +7,7 @@ module Grit
|
|||
MAX_DATA_SIZE = 50.megabytes
|
||||
|
||||
def data_with_limit
|
||||
size <= MAX_DATA_SIZE ? data_without_limit : nil # 'Error: blob is too big'
|
||||
!huge? ? data_without_limit : nil # 'Error: blob is too big'
|
||||
end
|
||||
alias_method_chain :data, :limit
|
||||
|
||||
|
@ -15,6 +15,10 @@ module Grit
|
|||
size.to_i > MAX_VIEW_SIZE
|
||||
end
|
||||
|
||||
def huge?
|
||||
size.to_i > MAX_DATA_SIZE
|
||||
end
|
||||
|
||||
def render_as
|
||||
@render_as ||= case
|
||||
when large?; :binary
|
||||
|
|
|
@ -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) ||
|
||||
|
|
|
@ -5,7 +5,7 @@ module Modules
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
after_create :create_wiki
|
||||
after_save :create_wiki
|
||||
after_destroy :destroy_wiki
|
||||
end
|
||||
|
||||
|
|
|
@ -303,11 +303,11 @@ describe Projects::BuildListsController do
|
|||
assigns[:build_lists].should_not include(@build_list3)
|
||||
end
|
||||
|
||||
it 'should filter by project_name and start_date' do
|
||||
it 'should filter by project_name and update_date' do
|
||||
get :index, :filter => {:project_name => @build_list3.project.name, :ownership => 'everything',
|
||||
"created_at_start(1i)" => @build_list3.created_at.year.to_s,
|
||||
"created_at_start(2i)" => @build_list3.created_at.month.to_s,
|
||||
"created_at_start(3i)" => @build_list3.created_at.day.to_s}
|
||||
"updated_at_start(1i)" => @build_list3.updated_at.year.to_s,
|
||||
"updated_at_start(2i)" => @build_list3.updated_at.month.to_s,
|
||||
"updated_at_start(3i)" => @build_list3.updated_at.day.to_s}
|
||||
assigns[:build_lists].should_not include(@build_list1)
|
||||
assigns[:build_lists].should_not include(@build_list2)
|
||||
assigns[:build_lists].should include(@build_list3)
|
||||
|
|
|
@ -241,7 +241,7 @@
|
|||
}
|
||||
|
||||
// attempt to load the definition for this language
|
||||
var script_uri = '/javascripts/gollum/editor/langs/' + markup_name + '.js';
|
||||
var script_uri = '/assets/gollum/editor/langs/' + markup_name + '.js';
|
||||
$.ajax({
|
||||
url: script_uri,
|
||||
dataType: 'script',
|
||||
|
|
Loading…
Reference in New Issue