Skip to content

Commit

Permalink
Rails cleanup. Don't hard-fail on existence of jasmine.rake in Rails …
Browse files Browse the repository at this point in the history
…3. Don't require entire Rails lib to load railtie. Remove unused files
  • Loading branch information
ragaskar committed Apr 14, 2011
1 parent dfea6d1 commit dc144e0
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 38 deletions.
10 changes: 4 additions & 6 deletions HOW_TO_TEST.markdown
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions install.rb

This file was deleted.

1 change: 0 additions & 1 deletion jasmine.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
21 changes: 1 addition & 20 deletions lib/jasmine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 0 additions & 9 deletions lib/jasmine/generator.rb

This file was deleted.

20 changes: 20 additions & 0 deletions lib/jasmine/railtie.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit dc144e0

Please sign in to comment.