-
Notifications
You must be signed in to change notification settings - Fork 19
/
Rakefile
66 lines (53 loc) · 1.53 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
require 'rubygems'
require 'appraisal'
require 'cucumber/rake/task'
require 'tmpdir'
cucumber_opts = %w{--require features --format progress}
Cucumber::Rake::Task.new do |t|
t.cucumber_opts = [cucumber_opts, '--tags', '~@puppet_version']
end
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new do |t|
t.rspec_opts = %w{--color --format progress}
end
desc "build gem"
task :build => [:build_docs] do
sh("gem build cucumber-puppet.gemspec")
exit 1 unless File.exists?(Dir.glob("cucumber-puppet-*.gem").to_s)
FileUtils.mkdir_p('pkg')
puts
Dir.glob("cucumber-puppet-*.gem").each do |gem|
dest = File.join('pkg', gem)
FileUtils.mv(gem, dest)
puts "New gem in #{dest}"
end
end
desc "build documentation"
task :build_docs do
manpages = Dir.glob("man/*.ronn")
manpages.each do |m|
sh("ronn -b #{m}")
end
end
desc "run test suite of puppet features"
task :testsuite do
testsuite = Dir.mktmpdir
begin
Dir.chdir(testsuite)
basedir = File.dirname(__FILE__)
sh("ruby -I#{basedir}/lib #{basedir}/bin/cucumber-puppet-gen world > /dev/null")
sh("ruby -I#{basedir}/lib #{basedir}/bin/cucumber-puppet-gen testsuite --force > /dev/null")
sh("ruby -I#{basedir}/lib #{basedir}/bin/cucumber-puppet --format progress features")
ensure
Dir.chdir(basedir)
FileUtils.remove_entry_secure testsuite
end
end
desc "run all tests"
task :tests => [:spec, :cucumber, :testsuite]
task :default => :tests
task :test => :tests
desc "uninstall gem"
task :uninstall do
sh("gem uninstall -x cucumber-puppet")
end