Permalink
Browse files

modular Rakefile, devs can run only what they're interested in withou…

…t having to install all gems
  • Loading branch information...
1 parent 252c882 commit 38c7ff3c0ed09ecb972d90e2cae3f1d3285ec6f3 @ianwhite ianwhite committed Apr 27, 2010
Showing with 93 additions and 89 deletions.
  1. +6 −0 History.txt
  2. +14 −89 Rakefile
  3. +24 −0 Rakefile.d/cucumber.rake
  4. +19 −0 Rakefile.d/jeweller.rake
  5. +18 −0 Rakefile.d/rcov.rake
  6. +7 −0 Rakefile.d/rspec.rake
  7. +5 −0 Rakefile.d/yard.rake
View
@@ -1,3 +1,9 @@
+== master
+
+* 1 improvement
+ * modular Rakefile, devs can run only what they're interested in without having to install all gems
+
+
== 0.2.9 - 27 Apr 2010 (the #railscamp7 release)
* 5 improvements
View
103 Rakefile
@@ -1,95 +1,20 @@
-# use pluginized rpsec if it exists
-rspec_base = File.expand_path(File.dirname(__FILE__) + '/../rspec/lib')
-$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base) and !$LOAD_PATH.include?(rspec_base)
-
-require 'spec/rake/spectask'
-require 'spec/rake/verify_rcov'
-require 'cucumber/rake/task'
-
-$LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
-require 'pickle/version'
-
-PluginName = 'pickle'
-
-task :default => [:spec]
-
-desc "Run the specs for #{PluginName}"
-Spec::Rake::SpecTask.new(:spec) do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = ["--colour"]
-end
-
-desc "Generate RCov report for #{PluginName}"
-Spec::Rake::SpecTask.new(:rcov) do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.rcov = true
- t.rcov_dir = 'doc/coverage'
- t.rcov_opts = ['--text-report', '--exclude', "gems/,features/,/Library,spec/,rcov.rb,#{File.expand_path(File.join(File.dirname(__FILE__),'../../..'))}"]
-end
-
-namespace :rcov do
- desc "Verify RCov threshold for #{PluginName}"
- RCov::VerifyTask.new(:verify => :rcov) do |t|
- t.threshold = 98.29
- t.index_html = File.join(File.dirname(__FILE__), 'doc/coverage/index.html')
+$:.unshift File.expand_path('lib')
+
+# load given tasks file, reporting errors without failing
+def load_tasks(tasks)
+ load tasks
+rescue Exception => exception
+ $stderr << "** loading #{tasks.sub(File.expand_path('.'),'')} failed: "
+ case exception
+ when LoadError
+ $stderr << "to use, install the gems it requires\n"
+ else
+ $stderr << ([exception.message] + exception.backtrace[0..2]).join("\n ") << "\n\n"
end
end
-desc "Run features for #{PluginName} (progress)"
-Cucumber::Rake::Task.new(:cucumber => [:cucumber_test_app]) do |t|
- t.cucumber_opts = ['--format', 'pretty', '--require', 'features']
-end
+Dir["Rakefile.d/*.rake"].sort.each {|t| load_tasks t}
-desc "setup a rails app for running cucumber"
-file "cucumber_test_app" do
- puts "** setting up cucumber test app ** (rails 2.3 only at present)"
- Rake::Task['cucumber:setup'].invoke
-end
-
-namespace :cucumber do
- task :setup do
- rm_rf "cucumber_test_app"
- sh "rails cucumber_test_app"
- cd "cucumber_test_app" do
- sh "script/generate rspec"
- sh "script/generate cucumber"
- end
- sh "ln -s #{File.expand_path('.')} cucumber_test_app/vendor/plugins/pickle"
- end
-end
+task :default => :spec
task :ci => ['rcov:verify', 'cucumber']
-
-begin
- require 'jeweler'
-
- Jeweler::Tasks.new do |s|
- s.name = "pickle"
- s.version = Pickle::Version::String
- s.summary = "Easy model creation and reference in your cucumber features"
- s.description = "Easy model creation and reference in your cucumber features"
- s.email = "ian.w.white@gmail.com"
- s.homepage = "http://github.com/ianwhite/pickle/tree"
- s.authors = ["Ian White"]
- end
-
- Jeweler::GemcutterTasks.new
-
- namespace :release do
- task :all => ['release', 'gemcutter:release']
- end
-
-rescue LoadError
- puts "Jeweler not available for gem tasks. Install it with: sudo gem install jeweler"
-end
-
-begin
- require 'yard'
-
- YARD::Rake::YardocTask.new(:doc) do |t|
- t.files = ['lib/**/*.rb', 'generators/**/*.rb']
- end
-
-rescue LoadError
- puts "YARD not available for doc tasks. Install it with: sudo gem install yard"
-end
View
@@ -0,0 +1,24 @@
+require 'cucumber/rake/task'
+
+desc "Run features"
+Cucumber::Rake::Task.new(:cucumber => [:cucumber_test_app]) do |t|
+ t.cucumber_opts = ['--format', 'pretty', '--require', 'features']
+end
+
+desc "setup a rails app for running cucumber"
+file "cucumber_test_app" do
+ puts "** setting up cucumber test app ** (rails 2.3 only at present)"
+ Rake::Task['cucumber:setup'].invoke
+end
+
+namespace :cucumber do
+ task :setup do
+ rm_rf "cucumber_test_app"
+ sh "rails cucumber_test_app"
+ cd "cucumber_test_app" do
+ sh "script/generate rspec"
+ sh "script/generate cucumber"
+ end
+ sh "ln -s #{File.expand_path('.')} cucumber_test_app/vendor/plugins/pickle"
+ end
+end
View
@@ -0,0 +1,19 @@
+require 'jeweler'
+require 'pickle/version'
+
+Jeweler::Tasks.new do |s|
+ s.name = "pickle"
+ s.version = Pickle::Version::String
+ s.summary = "Easy model creation and reference in your cucumber features"
+ s.description = "Easy model creation and reference in your cucumber features"
+ s.email = "ian.w.white@gmail.com"
+ s.homepage = "http://github.com/ianwhite/pickle/tree"
+ s.authors = ["Ian White"]
+end
+
+Jeweler::GemcutterTasks.new
+
+namespace :release do
+ desc "release to github and gemcutter"
+ task :all => ['release', 'gemcutter:release']
+end
View
@@ -0,0 +1,18 @@
+require 'spec/rake/spectask'
+require 'spec/rake/verify_rcov'
+
+desc "Generate RCov report"
+Spec::Rake::SpecTask.new(:rcov) do |t|
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ t.rcov = true
+ t.rcov_dir = 'doc/coverage'
+ t.rcov_opts = ['--text-report', '--exclude', "gems/,features/,/Library,spec/,rcov.rb"]
+end
+
+namespace :rcov do
+ desc "Verify RCov threshold"
+ RCov::VerifyTask.new(:verify => :rcov) do |t|
+ t.threshold = 98.29
+ t.index_html = 'doc/coverage/index.html'
+ end
+end
View
@@ -0,0 +1,7 @@
+require 'spec/rake/spectask'
+
+desc "Run the specs"
+Spec::Rake::SpecTask.new(:spec) do |t|
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ t.spec_opts = ["--colour"]
+end
View
@@ -0,0 +1,5 @@
+require 'yard'
+
+YARD::Rake::YardocTask.new(:doc) do |t|
+ t.files = ['lib/**/*.rb', 'rails_generators/**/*.rb']
+end

0 comments on commit 38c7ff3

Please sign in to comment.