diff --git a/Rakefile b/Rakefile index 2d39f5fe..9263c091 100644 --- a/Rakefile +++ b/Rakefile @@ -321,22 +321,45 @@ def test_rails_version(version) Rake::Task['test'].execute end -namespace :test do - desc "Test all supported versions of rails. This takes a while." - task :rails_compatibility do - sh %{rm -rf test/rails} - puts "Checking out rails. Please wait." - sh %{git clone git://github.com/rails/rails.git test/rails} +def gemfiles + @gemfiles ||= begin - rails_versions.each {|version| test_rails_version version} - - puts "Checking out rails_xss. Please wait." - sh %{git clone git://github.com/rails/rails_xss.git test/plugins/rails_xss} - test_rails_version(rails_versions.find {|s| s =~ /^v2\.3/}) - ensure - `rm -rf test/rails` - `rm -rf test/plugins` + raise 'Must install bundler to run Rails compatibility tests' if `which bundle`.empty? + Dir[File.dirname(__FILE__) + '/test/gemfiles/Gemfile.*']. + reject {|f| f =~ /\.lock$/}. + reject {|f| RUBY_VERSION !~ /^1\.8/ && f =~ /Gemfile\.rails-2\.[0-2]/} end +end + +def with_each_gemfile + old_env = ENV['BUNDLE_GEMFILE'] + gemfiles.each do |gemfile| + puts "Using gemfile: #{gemfile}" + ENV['BUNDLE_GEMFILE'] = gemfile + yield + end +ensure + ENV['BUNDLE_GEMFILE'] = old_env +end + +namespace :test do + namespace :bundles do + desc "Install all dependencies necessary to test Haml." + task :install do + with_each_gemfile {sh "bundle install"} + end + + desc "Update all dependencies for testing Haml." + task :update do + with_each_gemfile {sh "bundle update"} + end + end + + desc "Test all supported versions of rails. This takes a while." + task :rails_compatibility => 'test:bundles:install' do + `rm -rf test/rails` + `rm -rf test/plugins` + with_each_gemfile {sh "bundle exec rake test"} end end diff --git a/test/gemfiles/.bundle/config b/test/gemfiles/.bundle/config new file mode 100644 index 00000000..8ebbe30e --- /dev/null +++ b/test/gemfiles/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_DISABLE_SHARED_GEMS: "1" diff --git a/test/gemfiles/Gemfile.rails-2.0.x b/test/gemfiles/Gemfile.rails-2.0.x new file mode 100644 index 00000000..ecfd24d7 --- /dev/null +++ b/test/gemfiles/Gemfile.rails-2.0.x @@ -0,0 +1,7 @@ +source :gemcutter + +gem 'json' +gem 'ruby_parser' +gem 'hpricot' +gem 'erubis' +gem 'rails', '>= 2.0.0', '< 2.1.0' diff --git a/test/gemfiles/Gemfile.rails-2.0.x.lock b/test/gemfiles/Gemfile.rails-2.0.x.lock new file mode 100644 index 00000000..137421e1 --- /dev/null +++ b/test/gemfiles/Gemfile.rails-2.0.x.lock @@ -0,0 +1,36 @@ +GEM + remote: http://rubygems.org/ + specs: + actionmailer (2.0.5) + actionpack (= 2.0.5) + actionpack (2.0.5) + activesupport (= 2.0.5) + activerecord (2.0.5) + activesupport (= 2.0.5) + activeresource (2.0.5) + activesupport (= 2.0.5) + activesupport (2.0.5) + erubis (2.7.0) + hpricot (0.8.4) + json (1.6.1) + rails (2.0.5) + actionmailer (= 2.0.5) + actionpack (= 2.0.5) + activerecord (= 2.0.5) + activeresource (= 2.0.5) + activesupport (= 2.0.5) + rake (>= 0.7.2) + rake (0.9.2) + ruby_parser (2.3.0) + sexp_processor (~> 3.0) + sexp_processor (3.0.6) + +PLATFORMS + ruby + +DEPENDENCIES + erubis + hpricot + json + rails (>= 2.0.0, < 2.1.0) + ruby_parser diff --git a/test/gemfiles/Gemfile.rails-2.1.x b/test/gemfiles/Gemfile.rails-2.1.x new file mode 100644 index 00000000..0ffc66ab --- /dev/null +++ b/test/gemfiles/Gemfile.rails-2.1.x @@ -0,0 +1,7 @@ +source :gemcutter + +gem 'json' +gem 'ruby_parser' +gem 'hpricot' +gem 'erubis' +gem 'rails', '>= 2.1.0', '< 2.2.0' diff --git a/test/gemfiles/Gemfile.rails-2.1.x.lock b/test/gemfiles/Gemfile.rails-2.1.x.lock new file mode 100644 index 00000000..4b1190ec --- /dev/null +++ b/test/gemfiles/Gemfile.rails-2.1.x.lock @@ -0,0 +1,36 @@ +GEM + remote: http://rubygems.org/ + specs: + actionmailer (2.1.2) + actionpack (= 2.1.2) + actionpack (2.1.2) + activesupport (= 2.1.2) + activerecord (2.1.2) + activesupport (= 2.1.2) + activeresource (2.1.2) + activesupport (= 2.1.2) + activesupport (2.1.2) + erubis (2.7.0) + hpricot (0.8.4) + json (1.6.1) + rails (2.1.2) + actionmailer (= 2.1.2) + actionpack (= 2.1.2) + activerecord (= 2.1.2) + activeresource (= 2.1.2) + activesupport (= 2.1.2) + rake (>= 0.8.1) + rake (0.9.2) + ruby_parser (2.3.0) + sexp_processor (~> 3.0) + sexp_processor (3.0.6) + +PLATFORMS + ruby + +DEPENDENCIES + erubis + hpricot + json + rails (>= 2.1.0, < 2.2.0) + ruby_parser diff --git a/test/gemfiles/Gemfile.rails-2.2.x b/test/gemfiles/Gemfile.rails-2.2.x new file mode 100644 index 00000000..d2bbe72b --- /dev/null +++ b/test/gemfiles/Gemfile.rails-2.2.x @@ -0,0 +1,7 @@ +source :gemcutter + +gem 'json' +gem 'ruby_parser' +gem 'hpricot' +gem 'erubis' +gem 'rails', '>= 2.2.0', '< 2.3.0' diff --git a/test/gemfiles/Gemfile.rails-2.2.x.lock b/test/gemfiles/Gemfile.rails-2.2.x.lock new file mode 100644 index 00000000..8aa2e52e --- /dev/null +++ b/test/gemfiles/Gemfile.rails-2.2.x.lock @@ -0,0 +1,36 @@ +GEM + remote: http://rubygems.org/ + specs: + actionmailer (2.2.3) + actionpack (= 2.2.3) + actionpack (2.2.3) + activesupport (= 2.2.3) + activerecord (2.2.3) + activesupport (= 2.2.3) + activeresource (2.2.3) + activesupport (= 2.2.3) + activesupport (2.2.3) + erubis (2.7.0) + hpricot (0.8.4) + json (1.6.1) + rails (2.2.3) + actionmailer (= 2.2.3) + actionpack (= 2.2.3) + activerecord (= 2.2.3) + activeresource (= 2.2.3) + activesupport (= 2.2.3) + rake (>= 0.8.3) + rake (0.9.2) + ruby_parser (2.3.0) + sexp_processor (~> 3.0) + sexp_processor (3.0.6) + +PLATFORMS + ruby + +DEPENDENCIES + erubis + hpricot + json + rails (>= 2.2.0, < 2.3.0) + ruby_parser diff --git a/test/gemfiles/Gemfile.rails-2.3.x b/test/gemfiles/Gemfile.rails-2.3.x new file mode 100644 index 00000000..986fbbec --- /dev/null +++ b/test/gemfiles/Gemfile.rails-2.3.x @@ -0,0 +1,7 @@ +source :gemcutter + +gem 'json' +gem 'ruby_parser' +gem 'hpricot' +gem 'erubis' +gem 'rails', '>= 2.3.0', '< 2.4.0' diff --git a/test/gemfiles/Gemfile.rails-2.3.x.lock b/test/gemfiles/Gemfile.rails-2.3.x.lock new file mode 100644 index 00000000..507c0d5f --- /dev/null +++ b/test/gemfiles/Gemfile.rails-2.3.x.lock @@ -0,0 +1,38 @@ +GEM + remote: http://rubygems.org/ + specs: + actionmailer (2.3.14) + actionpack (= 2.3.14) + actionpack (2.3.14) + activesupport (= 2.3.14) + rack (~> 1.1.0) + activerecord (2.3.14) + activesupport (= 2.3.14) + activeresource (2.3.14) + activesupport (= 2.3.14) + activesupport (2.3.14) + erubis (2.7.0) + hpricot (0.8.4) + json (1.6.1) + rack (1.1.2) + rails (2.3.14) + actionmailer (= 2.3.14) + actionpack (= 2.3.14) + activerecord (= 2.3.14) + activeresource (= 2.3.14) + activesupport (= 2.3.14) + rake (>= 0.8.3) + rake (0.9.2) + ruby_parser (2.3.0) + sexp_processor (~> 3.0) + sexp_processor (3.0.6) + +PLATFORMS + ruby + +DEPENDENCIES + erubis + hpricot + json + rails (>= 2.3.0, < 2.4.0) + ruby_parser diff --git a/test/gemfiles/Gemfile.rails-3.0.x b/test/gemfiles/Gemfile.rails-3.0.x new file mode 100644 index 00000000..46ce229f --- /dev/null +++ b/test/gemfiles/Gemfile.rails-3.0.x @@ -0,0 +1,7 @@ +source :gemcutter + +gem 'json' +gem 'ruby_parser' +gem 'hpricot' +gem 'erubis' +gem 'rails', '>= 3.0.0', '< 3.1.0' diff --git a/test/gemfiles/Gemfile.rails-3.0.x.lock b/test/gemfiles/Gemfile.rails-3.0.x.lock new file mode 100644 index 00000000..5c5c8812 --- /dev/null +++ b/test/gemfiles/Gemfile.rails-3.0.x.lock @@ -0,0 +1,83 @@ +GEM + remote: http://rubygems.org/ + specs: + abstract (1.0.0) + actionmailer (3.0.10) + actionpack (= 3.0.10) + mail (~> 2.2.19) + actionpack (3.0.10) + activemodel (= 3.0.10) + activesupport (= 3.0.10) + builder (~> 2.1.2) + erubis (~> 2.6.6) + i18n (~> 0.5.0) + rack (~> 1.2.1) + rack-mount (~> 0.6.14) + rack-test (~> 0.5.7) + tzinfo (~> 0.3.23) + activemodel (3.0.10) + activesupport (= 3.0.10) + builder (~> 2.1.2) + i18n (~> 0.5.0) + activerecord (3.0.10) + activemodel (= 3.0.10) + activesupport (= 3.0.10) + arel (~> 2.0.10) + tzinfo (~> 0.3.23) + activeresource (3.0.10) + activemodel (= 3.0.10) + activesupport (= 3.0.10) + activesupport (3.0.10) + arel (2.0.10) + builder (2.1.2) + erubis (2.6.6) + abstract (>= 1.0.0) + hpricot (0.8.4) + i18n (0.5.0) + json (1.6.1) + mail (2.2.19) + activesupport (>= 2.3.6) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.16) + polyglot (0.3.2) + rack (1.2.4) + rack-mount (0.6.14) + rack (>= 1.0.0) + rack-test (0.5.7) + rack (>= 1.0) + rails (3.0.10) + actionmailer (= 3.0.10) + actionpack (= 3.0.10) + activerecord (= 3.0.10) + activeresource (= 3.0.10) + activesupport (= 3.0.10) + bundler (~> 1.0) + railties (= 3.0.10) + railties (3.0.10) + actionpack (= 3.0.10) + activesupport (= 3.0.10) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (~> 0.14.4) + rake (0.9.2) + rdoc (3.9.4) + ruby_parser (2.3.0) + sexp_processor (~> 3.0) + sexp_processor (3.0.6) + thor (0.14.6) + treetop (1.4.10) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.29) + +PLATFORMS + ruby + +DEPENDENCIES + erubis + hpricot + json + rails (>= 3.0.0, < 3.1.0) + ruby_parser diff --git a/test/gemfiles/Gemfile.rails-3.1.x b/test/gemfiles/Gemfile.rails-3.1.x new file mode 100644 index 00000000..963be6a8 --- /dev/null +++ b/test/gemfiles/Gemfile.rails-3.1.x @@ -0,0 +1,7 @@ +source :gemcutter + +gem 'json' +gem 'ruby_parser' +gem 'hpricot' +gem 'erubis' +gem 'rails', '>= 3.1.0', '< 3.2.0' diff --git a/test/gemfiles/Gemfile.rails-3.1.x.lock b/test/gemfiles/Gemfile.rails-3.1.x.lock new file mode 100644 index 00000000..261352b2 --- /dev/null +++ b/test/gemfiles/Gemfile.rails-3.1.x.lock @@ -0,0 +1,96 @@ +GEM + remote: http://rubygems.org/ + specs: + actionmailer (3.1.0) + actionpack (= 3.1.0) + mail (~> 2.3.0) + actionpack (3.1.0) + activemodel (= 3.1.0) + activesupport (= 3.1.0) + builder (~> 3.0.0) + erubis (~> 2.7.0) + i18n (~> 0.6) + rack (~> 1.3.2) + rack-cache (~> 1.0.3) + rack-mount (~> 0.8.2) + rack-test (~> 0.6.1) + sprockets (~> 2.0.0) + activemodel (3.1.0) + activesupport (= 3.1.0) + bcrypt-ruby (~> 3.0.0) + builder (~> 3.0.0) + i18n (~> 0.6) + activerecord (3.1.0) + activemodel (= 3.1.0) + activesupport (= 3.1.0) + arel (~> 2.2.1) + tzinfo (~> 0.3.29) + activeresource (3.1.0) + activemodel (= 3.1.0) + activesupport (= 3.1.0) + activesupport (3.1.0) + multi_json (~> 1.0) + arel (2.2.1) + bcrypt-ruby (3.0.1) + builder (3.0.0) + erubis (2.7.0) + hike (1.2.1) + hpricot (0.8.4) + i18n (0.6.0) + json (1.6.1) + mail (2.3.0) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.16) + multi_json (1.0.3) + polyglot (0.3.2) + rack (1.3.3) + rack-cache (1.0.3) + rack (>= 0.4) + rack-mount (0.8.3) + rack (>= 1.0.0) + rack-ssl (1.3.2) + rack + rack-test (0.6.1) + rack (>= 1.0) + rails (3.1.0) + actionmailer (= 3.1.0) + actionpack (= 3.1.0) + activerecord (= 3.1.0) + activeresource (= 3.1.0) + activesupport (= 3.1.0) + bundler (~> 1.0) + railties (= 3.1.0) + railties (3.1.0) + actionpack (= 3.1.0) + activesupport (= 3.1.0) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (~> 0.14.6) + rake (0.9.2) + rdoc (3.9.4) + ruby_parser (2.3.0) + sexp_processor (~> 3.0) + sexp_processor (3.0.6) + sprockets (2.0.0) + hike (~> 1.2) + rack (~> 1.0) + tilt (!= 1.3.0, ~> 1.1) + thor (0.14.6) + tilt (1.3.3) + treetop (1.4.10) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.29) + +PLATFORMS + ruby + +DEPENDENCIES + erubis + hpricot + json + rails (>= 3.1.0, < 3.2.0) + ruby_parser diff --git a/test/gemfiles/Gemfile.rails-xss-2.3.x b/test/gemfiles/Gemfile.rails-xss-2.3.x new file mode 100644 index 00000000..7e446f37 --- /dev/null +++ b/test/gemfiles/Gemfile.rails-xss-2.3.x @@ -0,0 +1,8 @@ +source :gemcutter + +gem 'json' +gem 'ruby_parser' +gem 'hpricot' +gem 'erubis' +gem 'rails', '>= 2.3.0', '< 2.4.0' +gem 'rails_xss', '>= 0.1.1' diff --git a/test/gemfiles/Gemfile.rails-xss-2.3.x.lock b/test/gemfiles/Gemfile.rails-xss-2.3.x.lock new file mode 100644 index 00000000..45a8721b --- /dev/null +++ b/test/gemfiles/Gemfile.rails-xss-2.3.x.lock @@ -0,0 +1,40 @@ +GEM + remote: http://rubygems.org/ + specs: + actionmailer (2.3.14) + actionpack (= 2.3.14) + actionpack (2.3.14) + activesupport (= 2.3.14) + rack (~> 1.1.0) + activerecord (2.3.14) + activesupport (= 2.3.14) + activeresource (2.3.14) + activesupport (= 2.3.14) + activesupport (2.3.14) + erubis (2.7.0) + hpricot (0.8.4) + json (1.6.1) + rack (1.1.2) + rails (2.3.14) + actionmailer (= 2.3.14) + actionpack (= 2.3.14) + activerecord (= 2.3.14) + activeresource (= 2.3.14) + activesupport (= 2.3.14) + rake (>= 0.8.3) + rails_xss (0.1.3) + rake (0.9.2) + ruby_parser (2.3.0) + sexp_processor (~> 3.0) + sexp_processor (3.0.6) + +PLATFORMS + ruby + +DEPENDENCIES + erubis + hpricot + json + rails (>= 2.3.0, < 2.4.0) + rails_xss (>= 0.1.1) + ruby_parser