diff --git a/HOW_TO_TEST.markdown b/HOW_TO_TEST.markdown index da76ac2c..61dceb6f 100644 --- a/HOW_TO_TEST.markdown +++ b/HOW_TO_TEST.markdown @@ -1,11 +1,9 @@ -At the moment we don't have an automated way to test the Jasmine Gem in both configurations: Rails 2 / RSpec 1.x & Rails 3 / RSpec 2. CI will handle a broad matrix, but you need to ensure that your changes work across Rails 2&3. +To test changes to the jasmine-gem: -So here are the manual steps: - -* Edit jasmine.gemspec and uncomment the lines for Rails 2, comment out the lines for Rails 3 +* Export RAILS_VERSION as either "pojs-rspec1", "pojs-rspec2", or "rails2" to test environments other than Rails 3. * Delete `Gemfile.lock` +* Clear out your current gemset * exec a `bundle install` * `rake` until specs are green -* Repeat with the Rails 3 development gems -* Repeat again with the Rails 2 development gems +* Repeat * Check in diff --git a/install.rb b/install.rb deleted file mode 100644 index 1718f3cf..00000000 --- a/install.rb +++ /dev/null @@ -1,2 +0,0 @@ -xjasmine_bin = File.expand_path(File.join(File.dirname(__FILE__), 'bin', 'jasmine')) -`#{jasmine_bin} init` \ No newline at end of file diff --git a/jasmine.gemspec b/jasmine.gemspec index 3d789871..b07c79ed 100644 --- a/jasmine.gemspec +++ b/jasmine.gemspec @@ -16,7 +16,6 @@ Gem::Specification.new do |s| s.files = `git ls-files`.split("\n") | Dir.glob('jasmine/**/*') s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } - s.default_executable = %q{jasmine} s.require_paths = ["lib"] s.rdoc_options = ["--charset=UTF-8"] diff --git a/lib/jasmine.rb b/lib/jasmine.rb index 0100d943..213f1672 100644 --- a/lib/jasmine.rb +++ b/lib/jasmine.rb @@ -5,29 +5,10 @@ 'spec_builder', 'command_line_tool'] -jasmine_files << 'generator' if Gem.available? "rails", ">= 3.0" - jasmine_files.each do |file| require File.join('jasmine', file) end -if Jasmine.rails3? - module Jasmine - class Railtie < Rails::Railtie +require File.join('jasmine', "railtie") if Jasmine.rails3? - config.before_configuration do - old_jasmine_rakefile = ::Rails.root.join('lib', 'tasks', 'jasmine.rake') - if old_jasmine_rakefile.exist? - raise RuntimeError.new( - "You no longer need to have jasmine.rake in your project, as it is now automatically loaded " + - "from the Jasmine gem. Please delete '#{old_jasmine_rakefile}' before continuing." - ) - end - end - rake_tasks do - load "jasmine/tasks/jasmine.rake" - end - end - end -end \ No newline at end of file diff --git a/lib/jasmine/generator.rb b/lib/jasmine/generator.rb deleted file mode 100644 index c06821b5..00000000 --- a/lib/jasmine/generator.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'rails' - -module Jasmine - class Railtie < ::Rails::Railtie - rake_tasks do - load "jasmine/tasks/jasmine.rake" - end - end -end diff --git a/lib/jasmine/railtie.rb b/lib/jasmine/railtie.rb new file mode 100644 index 00000000..131c2004 --- /dev/null +++ b/lib/jasmine/railtie.rb @@ -0,0 +1,20 @@ +require "rails/railtie" +module Jasmine + class Railtie < Rails::Railtie + + config.before_configuration do + old_jasmine_rakefile = ::Rails.root.join('lib', 'tasks', 'jasmine.rake') + if old_jasmine_rakefile.exist? && !ENV["USE_JASMINE_RAKE"] + puts %Q{ + You no longer need to have jasmine.rake in your project, as it is now automatically loaded + from the Jasmine gem. To silence this warning, set "USE_JASMINE_RAKE=true" in your environment + or remove jasmine.rake. + } + end + end + + rake_tasks do + load "jasmine/tasks/jasmine.rake" + end + end +end \ No newline at end of file