diff --git a/Gemfile b/Gemfile index 65f5da383..60869b4bb 100644 --- a/Gemfile +++ b/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 diff --git a/Gemfile.lock b/Gemfile.lock index 8d70a5ad0..896f7a8ab 100644 --- a/Gemfile.lock +++ b/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! diff --git a/app/helpers/git_helper.rb b/app/helpers/git_helper.rb index 753db6e64..853c69b8a 100644 --- a/app/helpers/git_helper.rb +++ b/app/helpers/git_helper.rb @@ -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)] diff --git a/app/views/projects/git/blobs/_render_as_binary.html.haml b/app/views/projects/git/blobs/_render_as_binary.html.haml index bd7379a10..a8fd16a3d 100644 --- a/app/views/projects/git/blobs/_render_as_binary.html.haml +++ b/app/views/projects/git/blobs/_render_as_binary.html.haml @@ -4,5 +4,5 @@ %td.blob :plain
-
#{link_to @blob.basename, raw_path(@project, @treeish, @path)}
+
#{link_to_unless @blob.huge?, @blob.basename, raw_path(@project, @treeish, @path)}

\ No newline at end of file diff --git a/app/views/projects/git/blobs/_top.html.haml b/app/views/projects/git/blobs/_top.html.haml index 3fa62790b..f770185d2 100644 --- a/app/views/projects/git/blobs/_top.html.haml +++ b/app/views/projects/git/blobs/_top.html.haml @@ -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) \| diff --git a/config/environments/production.rb b/config/environments/production.rb index 37372580c..b3ca044d1 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -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' diff --git a/db/schema.rb b/db/schema.rb index 6d4c81e73..f9df9fb18 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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 \ No newline at end of file diff --git a/lib/ext/git/grit.rb b/lib/ext/git/grit.rb index 4fa2f11f3..3ec533062 100644 --- a/lib/ext/git/grit.rb +++ b/lib/ext/git/grit.rb @@ -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 diff --git a/lib/ext/rosa/constraints.rb b/lib/ext/rosa/constraints.rb index 54e9e6191..fd7f45fbf 100644 --- a/lib/ext/rosa/constraints.rb +++ b/lib/ext/rosa/constraints.rb @@ -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) || diff --git a/lib/modules/models/wiki.rb b/lib/modules/models/wiki.rb index 1f13446b9..ef8884708 100644 --- a/lib/modules/models/wiki.rb +++ b/lib/modules/models/wiki.rb @@ -5,7 +5,7 @@ module Modules extend ActiveSupport::Concern included do - after_create :create_wiki + after_save :create_wiki after_destroy :destroy_wiki end diff --git a/spec/controllers/projects/build_lists_controller_spec.rb b/spec/controllers/projects/build_lists_controller_spec.rb index 0cb7e4b2f..b2aa0d17d 100644 --- a/spec/controllers/projects/build_lists_controller_spec.rb +++ b/spec/controllers/projects/build_lists_controller_spec.rb @@ -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) diff --git a/vendor/assets/javascripts/gollum/editor/gollum.editor.js b/vendor/assets/javascripts/gollum/editor/gollum.editor.js index 075887eab..f7ddc6012 100755 --- a/vendor/assets/javascripts/gollum/editor/gollum.editor.js +++ b/vendor/assets/javascripts/gollum/editor/gollum.editor.js @@ -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',