/
ginger
42 lines (32 loc) · 965 Bytes
/
ginger
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
#!/usr/bin/env ruby
require 'rubygems'
require 'ginger'
require 'rake'
if ARGV.length == 0
puts <<-USAGE
ginger #{Ginger::Version::String}
Use ginger to run specs for each scenario defined. Scenarios must be set out in
a file called ginger_scenarios.rb wherever this tool is run. Once they're
defined, then you can run this tool and provide the rake task that would
normally be called.
Examples:
ginger spec
ginger test
ginger spec:models
USAGE
exit 0
end
file_path = File.join Dir.pwd, ".ginger"
File.delete(file_path) if File.exists?(file_path)
scenarios = Ginger::Configuration.instance.scenarios
puts "No Ginger Scenarios defined" if scenarios.empty?
scenarios.each_with_index do |scenario, index|
puts <<-SCENARIO
-------------------
Ginger Scenario #{index+1}
-------------------
SCENARIO
File.open('.ginger', 'w') { |f| f.write index.to_s }
system("rake #{ARGV.join(" ")}")
end
File.delete(file_path) if File.exists?(file_path)