From 9d1bc29413452793109ad32bb999eb2ef1471499 Mon Sep 17 00:00:00 2001 From: Adrien Date: Tue, 14 Jan 2014 12:14:50 +0100 Subject: [PATCH 1/7] Remove duplicate dependency Last bundle with last ruby complains about the duplicate dependency on rails --- Gemfile.lock | 1 - rails-footnotes.gemspec | 1 - 2 files changed, 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d50bfa4..2f587df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -99,6 +99,5 @@ PLATFORMS ruby DEPENDENCIES - rails (>= 3.0.0) rails-footnotes! rspec (~> 2.9.0) diff --git a/rails-footnotes.gemspec b/rails-footnotes.gemspec index 128a5ee..56d49fb 100644 --- a/rails-footnotes.gemspec +++ b/rails-footnotes.gemspec @@ -16,7 +16,6 @@ Gem::Specification.new do |s| s.add_dependency "rails", ">= 3.0.0" - s.add_development_dependency "rails", ">= 3.0.0" s.add_development_dependency "rspec", "~> 2.9.0" s.files = `git ls-files`.split("\n") From 4aea1d6c96a6de2d31e745b2f800b3946467c69b Mon Sep 17 00:00:00 2001 From: Intrepidd Date: Sun, 2 Mar 2014 23:35:13 +0100 Subject: [PATCH 2/7] Add different gemfiles to the travis matrix and remove now unsupported ruby versions --- .travis.yml | 15 +++++++++------ gemfiles/Gemfile.rails-3.2.x | 5 +++++ gemfiles/Gemfile.rails-4.0.x | 6 ++++++ gemfiles/Gemfile.rails-edge | 5 +++++ 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 gemfiles/Gemfile.rails-3.2.x create mode 100644 gemfiles/Gemfile.rails-4.0.x create mode 100644 gemfiles/Gemfile.rails-edge diff --git a/.travis.yml b/.travis.yml index d3b63b2..97f8870 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,12 @@ script: "bundle exec rake spec" rvm: - - 1.8.7 - - 1.9.2 - 1.9.3 - - ree -notifications: - recipients: - - romanvbabenko@gmail.com + - 2.0.0 + - 2.1.1 +gemfile: + - gemfiles/Gemfile.rails-3.2.x + - gemfiles/Gemfile.rails-4.0.x + - gemfiles/Gemfile.rails-edge +matrix: + allow_failures: + - gemfile: gemfiles/Gemfile.rails-edge diff --git a/gemfiles/Gemfile.rails-3.2.x b/gemfiles/Gemfile.rails-3.2.x new file mode 100644 index 0000000..f1e4b04 --- /dev/null +++ b/gemfiles/Gemfile.rails-3.2.x @@ -0,0 +1,5 @@ +source 'https://rubygems.org' + +gemspec :path => '..' + +gem 'rails', '~> 3.2.0' diff --git a/gemfiles/Gemfile.rails-4.0.x b/gemfiles/Gemfile.rails-4.0.x new file mode 100644 index 0000000..9a52015 --- /dev/null +++ b/gemfiles/Gemfile.rails-4.0.x @@ -0,0 +1,6 @@ +source 'https://rubygems.org' + +gemspec :path => '..' + +gem 'rails', '~> 4.0.0' + diff --git a/gemfiles/Gemfile.rails-edge b/gemfiles/Gemfile.rails-edge new file mode 100644 index 0000000..9867248 --- /dev/null +++ b/gemfiles/Gemfile.rails-edge @@ -0,0 +1,5 @@ +source 'https://rubygems.org' + +gemspec :path => '..' + +gem 'rails', :github => 'rails/rails' From f5aa035d2d342d2272edc2516ffbfa435730cd4e Mon Sep 17 00:00:00 2001 From: Intrepidd Date: Mon, 3 Mar 2014 00:02:08 +0100 Subject: [PATCH 3/7] Fix deprecated rake/rdoctask by rdoc/task --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index cca8bb0..1c0166d 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ require 'bundler' Bundler::GemHelper.install_tasks require "rspec/core/rake_task" -require 'rake/rdoctask' +require 'rdoc/task' desc 'Default: run tests' task :default => :spec @@ -13,7 +13,7 @@ RSpec::Core::RakeTask.new(:spec) do |t| end desc 'Generate documentation for Footnotes.' -Rake::RDocTask.new(:rdoc) do |rdoc| +RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'Footnotes' rdoc.options << '--line-numbers' << '--inline-source' From 7513cb7d9d606a90bdabb067b182d18f02d568dc Mon Sep 17 00:00:00 2001 From: Intrepidd Date: Mon, 3 Mar 2014 00:12:00 +0100 Subject: [PATCH 4/7] Bundle update, use rails 4.0 by default --- Gemfile.lock | 129 ++++++++++++++++++++++++--------------------------- 1 file changed, 61 insertions(+), 68 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2f587df..3bfff71 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,93 +7,86 @@ PATH GEM remote: http://rubygems.org/ specs: - actionmailer (3.1.1) - actionpack (= 3.1.1) - mail (~> 2.3.0) - actionpack (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) - builder (~> 3.0.0) + actionmailer (4.0.3) + actionpack (= 4.0.3) + mail (~> 2.5.4) + actionpack (4.0.3) + activesupport (= 4.0.3) + builder (~> 3.1.0) erubis (~> 2.7.0) - i18n (~> 0.6) - rack (~> 1.3.2) - rack-cache (~> 1.1) - rack-mount (~> 0.8.2) - rack-test (~> 0.6.1) - sprockets (~> 2.0.2) - activemodel (3.1.1) - activesupport (= 3.1.1) - builder (~> 3.0.0) - i18n (~> 0.6) - activerecord (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) - arel (~> 2.2.1) - tzinfo (~> 0.3.29) - activeresource (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) - activesupport (3.1.1) - multi_json (~> 1.0) - arel (2.2.1) - builder (3.0.0) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.3) + activesupport (= 4.0.3) + builder (~> 3.1.0) + activerecord (4.0.3) + activemodel (= 4.0.3) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.3) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.3) + activesupport (4.0.3) + i18n (~> 0.6, >= 0.6.4) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + arel (4.0.2) + atomic (1.1.15) + builder (3.1.4) diff-lcs (1.1.3) erubis (2.7.0) - hike (1.2.1) - i18n (0.6.0) - json (1.6.1) - mail (2.3.0) - i18n (>= 0.4.0) + hike (1.2.3) + i18n (0.6.9) + mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.17.2) - multi_json (1.0.3) - polyglot (0.3.3) - rack (1.3.5) - rack-cache (1.1) - rack (>= 0.4) - rack-mount (0.8.3) - rack (>= 1.0.0) - rack-ssl (1.3.2) - rack - rack-test (0.6.1) + mime-types (1.25.1) + minitest (4.7.5) + multi_json (1.8.4) + polyglot (0.3.4) + rack (1.5.2) + rack-test (0.6.2) rack (>= 1.0) - rails (3.1.1) - actionmailer (= 3.1.1) - actionpack (= 3.1.1) - activerecord (= 3.1.1) - activeresource (= 3.1.1) - activesupport (= 3.1.1) - bundler (~> 1.0) - railties (= 3.1.1) - railties (3.1.1) - actionpack (= 3.1.1) - activesupport (= 3.1.1) - rack-ssl (~> 1.3.2) + rails (4.0.3) + actionmailer (= 4.0.3) + actionpack (= 4.0.3) + activerecord (= 4.0.3) + activesupport (= 4.0.3) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.3) + sprockets-rails (~> 2.0.0) + railties (4.0.3) + actionpack (= 4.0.3) + activesupport (= 4.0.3) rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.6) - rake (0.9.2.2) - rdoc (3.11) - json (~> 1.4) + thor (>= 0.18.1, < 2.0) + rake (10.1.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.0) + rspec-expectations (2.9.1) diff-lcs (~> 1.1.3) rspec-mocks (2.9.0) - sprockets (2.0.3) + sprockets (2.11.0) hike (~> 1.2) + multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - thor (0.14.6) - tilt (1.3.3) - treetop (1.4.10) + sprockets-rails (2.0.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) + thor (0.18.1) + thread_safe (0.2.0) + atomic (>= 1.1.7, < 2) + tilt (1.4.1) + treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.30) + tzinfo (0.3.38) PLATFORMS ruby From 22500ddd8b18042f41f19cab7e8d28a1e9706d10 Mon Sep 17 00:00:00 2001 From: Intrepidd Date: Mon, 3 Mar 2014 00:12:22 +0100 Subject: [PATCH 5/7] Fix: undefined method mattr_accessor, we know have to require it explicitely --- lib/rails-footnotes.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rails-footnotes.rb b/lib/rails-footnotes.rb index ed62155..dd42ad8 100644 --- a/lib/rails-footnotes.rb +++ b/lib/rails-footnotes.rb @@ -1,3 +1,5 @@ +require 'active_support/core_ext/module/attribute_accessors' + module Footnotes mattr_accessor :before_hooks @@before_hooks = [] From cb0ea3d2a3587fbadc5ed4d461616effb55ada69 Mon Sep 17 00:00:00 2001 From: Intrepidd Date: Mon, 3 Mar 2014 00:16:46 +0100 Subject: [PATCH 6/7] Remove some rails 2.x specific code and update readme concerning rails 2.x --- README.rdoc | 6 ++++-- lib/rails-footnotes/filter.rb | 9 ++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/README.rdoc b/README.rdoc index f36ecd5..1aec87e 100644 --- a/README.rdoc +++ b/README.rdoc @@ -17,7 +17,7 @@ NOTE: Since this branch aims Rails 3 support, if you want to use it with Rails 2 Install Rails Footnotes is very easy. -=== Rails 3.x +=== Rails 3.x / 4.x gem 'rails-footnotes', '>= 3.7.9', :group => :development @@ -25,7 +25,9 @@ After you install RailsFootnotes and add it to your Gemfile, you need to run the rails generate rails_footnotes:install -=== Rails 2.x +=== Rails 2.x (Not maintained, please update to Rails 4) + +You can still use an older version of the gem : In RAILS_ROOT/config/environments/development.rb (yes, you want it only in development): diff --git a/lib/rails-footnotes/filter.rb b/lib/rails-footnotes/filter.rb index 08c125a..b5ec8e3 100644 --- a/lib/rails-footnotes/filter.rb +++ b/lib/rails-footnotes/filter.rb @@ -102,16 +102,11 @@ def revert_pos(file) end def performed_render? - @controller.instance_variable_get(:@performed_render) || # rails 2.x - (@controller.respond_to?(:performed?) && @controller.performed?) # rails3, will break on redirect?? + @controller.respond_to?(:performed?) && @controller.performed? end def valid_format? - if @template # Rails 2.x - [:html,:rhtml,:xhtml,:rxhtml].include?(@template.send(template_format_method.to_sym).to_sym) - else # Rails 3 - @controller.response.content_type == 'text/html' - end + @controller.response.content_type == 'text/html' end def template_format_method From f273b849edc901c5d8ca397b3f65cff6ce73de59 Mon Sep 17 00:00:00 2001 From: Intrepidd Date: Mon, 3 Mar 2014 00:40:59 +0100 Subject: [PATCH 7/7] Fix: stubbing rails application & removing of rails 2 specific code --- lib/rails-footnotes/filter.rb | 10 +--------- spec/spec_helper.rb | 13 +++++++------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/rails-footnotes/filter.rb b/lib/rails-footnotes/filter.rb index b5ec8e3..7c0bf1f 100644 --- a/lib/rails-footnotes/filter.rb +++ b/lib/rails-footnotes/filter.rb @@ -106,15 +106,7 @@ def performed_render? end def valid_format? - @controller.response.content_type == 'text/html' - end - - def template_format_method - if @template.respond_to?(:template_format) - return 'template_format' - else - return 'format' - end + [:html,:rhtml,:xhtml,:rxhtml].include?(@template.send(:format).to_sym) end def valid_content_type? diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bfe54aa..89ab8a1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,8 +5,9 @@ end require 'rubygems' - +require 'rails/all' ENV['RAILS_ENV'] = 'test' +Rails.logger = Logger.new(STDOUT) require 'active_support' require 'active_support/all' unless Class.respond_to?(:cattr_accessor) @@ -14,11 +15,11 @@ require 'rails-footnotes/abstract_note' require "rails-footnotes" -class Rails - def self.logger; end - - def self.version; '3.0.12'; end +RSpec.configure do |config| end -RSpec.configure do |config| +module FooBar + class Application < Rails::Application + config.secret_key_base = 'foobar' + end end