Skip to content
Browse files

adding back a rake task to envoke fixture_builder

  • Loading branch information...
1 parent 880084a commit a2f4209963a313d63ca157c7b4ee65073434252f Nate Clark committed Apr 13, 2011
Showing with 14 additions and 15 deletions.
  1. +0 −1 fixture_builder.gemspec
  2. +0 −1 init.rb
  3. +6 −0 lib/fixture_builder.rb
  4. +8 −13 lib/tasks/fixture_builder.rake
View
1 fixture_builder.gemspec
@@ -22,7 +22,6 @@ Gem::Specification.new do |s|
"Rakefile",
"VERSION",
"fixture_builder.gemspec",
- "init.rb",
"lib/fixture_builder.rb",
"lib/tasks/fixture_builder.rake",
"test/fixture_builder_test.rb",
View
1 init.rb
@@ -1 +0,0 @@
-# Include hook code here
View
6 lib/fixture_builder.rb
@@ -205,4 +205,10 @@ def rebuild_fixtures?
@file_hashes != read_config
end
end
+
+ class Railtie < Rails::Railtie
+ rake_tasks do
+ load "tasks/fixture_builder.rake"
+ end
+ end
end
View
21 lib/tasks/fixture_builder.rake
@@ -7,18 +7,13 @@ namespace :spec do
puts "Automatically generated fixtures removed"
end
- # These tasks don't work properly in rspec2 yet, removing for now
- # desc "Build the generated fixtures to spec/fixtures if dirty"
- # task :build do
- # puts "Building automatically generated fixtures..."
- # raise "Could not rebuild fixtures by running empty specs, look in /tmp/nothing.spec.out" unless system("rake spec:nothing > /tmp/nothing.spec.out")
- # end
- #
- # desc "Clean and rebuild the generated fixtures to spec/fixtures"
- # task :rebuild => [:clean, :build]
- end
+ desc "Build the generated fixtures to spec/fixtures if dirty"
+ task :build => :environment do
+ ActiveRecord::Base.establish_connection('test')
+ Dir.glob(File.join(Rails.root, '{spec,test}', '**', 'fixture_builder.rb')).each{|file| require(file)}
+ end
- # Spec::Rake::SpecTask.new(:nothing) do |t|
- # t.spec_files = FileList["spec/spec_helper.rb"]
- # end
+ desc "Clean and rebuild the generated fixtures to spec/fixtures"
+ task :rebuild => [:clean, :build]
+ end
end

0 comments on commit a2f4209

Please sign in to comment.
Something went wrong with that request. Please try again.