-
Notifications
You must be signed in to change notification settings - Fork 28
/
Rakefile
50 lines (43 loc) · 1.19 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require 'bundler'
require 'bundler/setup'
Bundler::GemHelper.install_tasks
require 'rdoc/task'
require 'rspec'
require 'rspec/core/rake_task'
require 'cucumber/rake/task'
task :cleanup_rcov_files do
rm_rf 'coverage.data'
end
desc "Run all examples"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = %w[--color]
end
Cucumber::Rake::Task.new(:cucumber)
# for cucumber features that create a sample project
def in_example_app(command)
Dir.chdir("./tmp/example_app/") do
Bundler.with_clean_env do
sh command
end
end
end
namespace :generate do
desc "generate a fresh app with rspec installed"
task :app do |t|
# unless File.directory?('./tmp/example_app')
sh "bundle exec rails new ./tmp/example_app -m 'features/templates/generate_example_app.rb' --skip-test-unit"
sh "cp 'features/templates/rspec.rake' ./tmp/example_app/lib/tasks"
in_example_app 'rake db:migrate'
in_example_app 'rails g rspec:install'
in_example_app 'bundle install'
# end
end
end
namespace :clobber do
desc "clobber the generated app"
task :app do
rm_rf "tmp/example_app"
end
end
task :ci => [:spec, :'clobber:app', :'generate:app', :cucumber]
task :default => :ci