From 185e4b11c4e0e095d5fbfe4638b9c2ccb46c0ad1 Mon Sep 17 00:00:00 2001 From: Alessandro Lepore Date: Fri, 18 Oct 2013 09:44:23 +0200 Subject: [PATCH 1/3] Gemfile.lock should not be versioned see http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/ --- .gitignore | 1 + Gemfile.lock | 272 --------------------------------------------------- 2 files changed, 1 insertion(+), 272 deletions(-) delete mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index 2967c42..39f43b3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ doc .yardoc .rbenv-version .ruby-version +Gemfile.lock \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index db0e980..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,272 +0,0 @@ -PATH - remote: . - specs: - activeadmin-axlsx (3.0.0) - activeadmin (~> 0.6.0) - axlsx - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (3.2.9) - actionpack (= 3.2.9) - mail (~> 2.4.4) - actionpack (3.2.9) - activemodel (= 3.2.9) - activesupport (= 3.2.9) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.0) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activeadmin (0.6.0) - arbre (>= 1.0.1) - bourbon (>= 1.0.0) - devise (>= 1.1.2) - fastercsv - formtastic (>= 2.0.0) - inherited_resources (>= 1.3.1) - jquery-rails (>= 1.0.0) - kaminari (>= 0.13.0) - meta_search (>= 0.9.2) - rails (>= 3.0.0) - sass (>= 3.1.0) - activemodel (3.2.9) - activesupport (= 3.2.9) - builder (~> 3.0.0) - activerecord (3.2.9) - activemodel (= 3.2.9) - activesupport (= 3.2.9) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.9) - activemodel (= 3.2.9) - activesupport (= 3.2.9) - activesupport (3.2.9) - i18n (~> 0.6) - multi_json (~> 1.0) - addressable (2.3.2) - arbre (1.0.1) - activesupport (>= 3.0.0) - arel (3.0.2) - atomic (1.1.14) - axlsx (2.0.1) - htmlentities (~> 4.3.1) - nokogiri (>= 1.4.1) - rubyzip (~> 1.0.0) - bcrypt-ruby (3.1.2) - bourbon (3.1.3) - sass (>= 3.2.0) - thor - builder (3.0.4) - capybara (1.1.2) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - selenium-webdriver (~> 2.0) - xpath (~> 0.1.4) - childprocess (0.3.6) - ffi (~> 1.0, >= 1.0.6) - coderay (1.0.8) - coffee-script (2.2.0) - coffee-script-source - execjs - coffee-script-source (1.4.0) - cucumber (1.2.1) - builder (>= 2.1.2) - diff-lcs (>= 1.1.3) - gherkin (~> 2.11.0) - json (>= 1.4.6) - cucumber-rails (1.2.1) - capybara (>= 1.1.2) - cucumber (>= 1.1.3) - nokogiri (>= 1.5.0) - database_cleaner (0.9.1) - devise (3.1.0) - bcrypt-ruby (~> 3.0) - orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) - thread_safe (~> 0.1) - warden (~> 1.2.3) - diff-lcs (1.1.3) - erubis (2.7.0) - execjs (1.4.0) - multi_json (~> 1.0) - fastercsv (1.5.5) - ffi (1.2.0) - formtastic (2.2.1) - actionpack (>= 3.0) - gherkin (2.11.5) - json (>= 1.4.6) - guard (1.5.4) - listen (>= 0.4.2) - lumberjack (>= 1.0.2) - pry (>= 0.9.10) - thor (>= 0.14.6) - guard-coffeescript (1.2.1) - coffee-script (>= 2.2.0) - guard (>= 1.1.0) - guard-rspec (1.2.1) - guard (>= 1.1) - haml (3.1.7) - has_scope (0.5.1) - hike (1.2.1) - htmlentities (4.3.1) - i18n (0.6.1) - inherited_resources (1.3.1) - has_scope (~> 0.5.0) - responders (~> 0.6) - jasmine (1.2.1) - jasmine-core (>= 1.2.0) - rack (~> 1.0) - rspec (>= 1.3.1) - selenium-webdriver (>= 0.1.3) - jasmine-core (1.2.0) - journey (1.0.4) - jquery-rails (3.0.4) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - jslint_on_rails (1.0.7) - json (1.7.5) - kaminari (0.14.1) - actionpack (>= 3.0.0) - activesupport (>= 3.0.0) - launchy (2.1.2) - addressable (~> 2.3) - libwebsocket (0.1.6.1) - websocket - listen (0.5.3) - lumberjack (1.0.2) - mail (2.4.4) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - meta_search (1.1.3) - actionpack (~> 3.1) - activerecord (~> 3.1) - activesupport (~> 3.1) - polyamorous (~> 0.5.0) - method_source (0.8.1) - mime-types (1.19) - mini_portile (0.5.1) - multi_json (1.3.7) - nokogiri (1.6.0) - mini_portile (~> 0.5.0) - orm_adapter (0.4.0) - polyamorous (0.5.0) - activerecord (~> 3.0) - polyglot (0.3.3) - pry (0.9.10) - coderay (~> 1.0.5) - method_source (~> 0.8) - slop (~> 3.3.1) - rack (1.4.1) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.2) - rack - rack-test (0.6.2) - rack (>= 1.0) - rails (3.2.9) - actionmailer (= 3.2.9) - actionpack (= 3.2.9) - activerecord (= 3.2.9) - activeresource (= 3.2.9) - activesupport (= 3.2.9) - bundler (~> 1.0) - railties (= 3.2.9) - rails-i18n (0.7.0) - i18n (~> 0.5) - railties (3.2.9) - actionpack (= 3.2.9) - activesupport (= 3.2.9) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.1.0) - rdiscount (1.6.8) - rdoc (3.12) - json (~> 1.4) - responders (0.9.3) - railties (~> 3.1) - rspec (2.9.0) - rspec-core (~> 2.9.0) - rspec-expectations (~> 2.9.0) - rspec-mocks (~> 2.9.0) - rspec-core (2.9.0) - rspec-expectations (2.9.1) - diff-lcs (~> 1.1.3) - rspec-mocks (2.9.0) - rspec-rails (2.9.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec (~> 2.9.0) - rubyzip (1.0.0) - sass (3.2.3) - sass-rails (3.2.5) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) - selenium-webdriver (2.26.0) - childprocess (>= 0.2.5) - libwebsocket (~> 0.1.3) - multi_json (~> 1.0) - rubyzip - shoulda-matchers (1.0.0) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - slop (3.3.3) - sprockets (2.2.1) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.6) - thor (0.16.0) - thread_safe (0.1.3) - atomic - tilt (1.3.3) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.38) - warden (1.2.3) - rack (>= 1.0) - websocket (1.0.3) - xpath (0.1.4) - nokogiri (~> 1.3) - yard (0.8.6.1) - -PLATFORMS - ruby - -DEPENDENCIES - activeadmin-axlsx! - axlsx - capybara (= 1.1.2) - cucumber-rails (= 1.2.1) - database_cleaner - guard-coffeescript - guard-rspec - haml (~> 3.1.1) - inherited_resources - jasmine - jslint_on_rails (~> 1.0.6) - launchy - rails-i18n - rdiscount - rspec-mocks - rspec-rails (~> 2.9.0) - sass-rails - shoulda-matchers (= 1.0.0) - simplecov - sprockets - sqlite3 - yard From 576abfa692ffc55115f486625ee0693dd5c05a0c Mon Sep 17 00:00:00 2001 From: Alessandro Lepore Date: Fri, 18 Oct 2013 09:47:47 +0200 Subject: [PATCH 2/3] use max_per_page because max_csv_records was removed --- lib/active_admin/axlsx/resource_controller_extension.rb | 2 +- spec/axlsx/unit/resource_controller_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/active_admin/axlsx/resource_controller_extension.rb b/lib/active_admin/axlsx/resource_controller_extension.rb index 5e002e4..740afc6 100644 --- a/lib/active_admin/axlsx/resource_controller_extension.rb +++ b/lib/active_admin/axlsx/resource_controller_extension.rb @@ -20,7 +20,7 @@ def index_with_xlsx(options={}, &block) # patching per_page to use the CSV record max for pagination when the format is xlsx def per_page_with_xlsx if request.format == Mime::Type.lookup_by_extension(:xlsx) - return max_csv_records + return max_per_page end per_page_without_xlsx end diff --git a/spec/axlsx/unit/resource_controller_spec.rb b/spec/axlsx/unit/resource_controller_spec.rb index e781e90..79223fa 100644 --- a/spec/axlsx/unit/resource_controller_spec.rb +++ b/spec/axlsx/unit/resource_controller_spec.rb @@ -31,8 +31,8 @@ response.headers["Content-Transfer-Encoding"].should == 'binary' end - it 'returns max_csv_records for per_page' do - controller.send(:per_page).should == controller.send(:max_csv_records) + it 'returns max_per_page for per_page' do + controller.send(:per_page).should == controller.send(:max_per_page) end it 'kicks back to the default per_page when we are not specifying a xlsx mime type' do From 82d06dd7318913d41634400ec36651a0f7c76382 Mon Sep 17 00:00:00 2001 From: Alessandro Lepore Date: Fri, 18 Oct 2013 09:58:35 +0200 Subject: [PATCH 3/3] fix rails version checking --- spec/support/rails_template.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/support/rails_template.rb b/spec/support/rails_template.rb index d9fe68d..0c8f569 100644 --- a/spec/support/rails_template.rb +++ b/spec/support/rails_template.rb @@ -12,7 +12,9 @@ generate :model, "post title:string body:text published_at:datetime author_id:integer category_id:integer" inject_into_file 'app/models/post.rb', " belongs_to :author, :class_name => 'User'\n belongs_to :category\n accepts_nested_attributes_for :author\n", :after => "class Post < ActiveRecord::Base\n" # Rails 3.2.3 model generator declare attr_accessible -inject_into_file 'app/models/post.rb', " attr_accessible :author\n", :before => "end" if Rails::VERSION::STRING >= '3.2.3' +if Gem::Version.new(::Rails::VERSION::STRING) >= Gem::Version.new('3.2.3') + inject_into_file 'app/models/post.rb', " attr_accessible :author\n", :before => "end" +end generate :model, "user type:string first_name:string last_name:string username:string age:integer" inject_into_file 'app/models/user.rb', " has_many :posts, :foreign_key => 'author_id'\n", :after => "class User < ActiveRecord::Base\n" generate :model, "publisher --migration=false --parent=User" @@ -26,7 +28,7 @@ id_model_setup = <<-EOF self.primary_key = :id before_create :set_id - + private def set_id self.id = 8.times.inject("") { |s,e| s << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }