Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modular Rakefile, devs can run only what they're interested in withou…
…t having to install all gems
- Loading branch information
Showing
7 changed files
with
93 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'yard' | ||
|
||
YARD::Rake::YardocTask.new(:doc) do |t| | ||
t.files = ['lib/**/*.rb', 'rails_generators/**/*.rb'] | ||
end |