crab 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/crab-it +18 -0
- data/bin/crab-it-help +12 -0
- data/bin/crab-it-list +28 -0
- data/bin/crab-iteration-help +1 -0
- data/bin/crab-rel +18 -0
- data/bin/crab-rel-help +12 -0
- data/bin/crab-rel-list +28 -0
- data/bin/crab-st +18 -0
- data/bin/crab-st-add +19 -0
- data/bin/crab-st-change +62 -0
- data/bin/crab-st-create +19 -0
- data/bin/crab-st-del +21 -0
- data/bin/crab-st-delete +21 -0
- data/bin/crab-st-find +34 -0
- data/bin/crab-st-help +19 -0
- data/bin/crab-st-list +34 -0
- data/bin/crab-st-ls +34 -0
- data/bin/crab-st-move +26 -0
- data/bin/crab-st-mv +26 -0
- data/bin/crab-st-new +19 -0
- data/bin/crab-st-pull +37 -0
- data/bin/crab-st-ren +27 -0
- data/bin/crab-st-rename +27 -0
- data/bin/crab-st-rm +21 -0
- data/bin/crab-st-show +19 -0
- data/bin/crab-st-up +62 -0
- data/bin/crab-st-update +62 -0
- data/bin/crab-story-change +1 -1
- data/bin/crab-story-help +9 -1
- data/bin/crab-story-up +1 -1
- data/bin/crab-story-update +1 -1
- data/bin/crab-tc +18 -0
- data/bin/crab-tc-add +29 -0
- data/bin/crab-tc-change +18 -0
- data/bin/crab-tc-create +29 -0
- data/bin/crab-tc-del +18 -0
- data/bin/crab-tc-delete +18 -0
- data/bin/crab-tc-find +34 -0
- data/bin/crab-tc-help +16 -0
- data/bin/crab-tc-list +34 -0
- data/bin/crab-tc-ls +34 -0
- data/bin/crab-tc-new +29 -0
- data/bin/crab-tc-rm +18 -0
- data/bin/crab-tc-show +24 -0
- data/bin/crab-tc-up +18 -0
- data/bin/crab-tc-update +18 -0
- data/bin/crab-testcase-find +1 -5
- data/bin/crab-testcase-list +21 -12
- data/bin/crab-testcase-ls +1 -5
- data/lib/crab/rally.rb +14 -14
- data/lib/crab/version.rb +1 -1
- metadata +85 -3
data/bin/crab-st-mv
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
include Crab::Utilities
|
5
|
+
|
6
|
+
opts = Trollop::options do
|
7
|
+
banner <<-BANNER
|
8
|
+
crab story move: move a story from one status to the next (or previous)
|
9
|
+
|
10
|
+
Usage: crab story move <id> [options*]
|
11
|
+
BANNER
|
12
|
+
opt :back, "Move story backwards (from accepted to completed, for example)"
|
13
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
14
|
+
end
|
15
|
+
|
16
|
+
id = ARGV.join(" ")
|
17
|
+
Trollop::die "No story given" if id.empty?
|
18
|
+
|
19
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
20
|
+
story = rally.find_story_with_id id
|
21
|
+
state = state_from(story.state)
|
22
|
+
|
23
|
+
story.update :schedule_state => (opts[:back] ? state_before(state) : state_after(state))
|
24
|
+
|
25
|
+
puts "#{story.formatted_id}: #{story.name} (#{story.state})"
|
26
|
+
end
|
data/bin/crab-st-new
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
opts = Trollop::options do
|
5
|
+
banner <<-BANNER
|
6
|
+
crab story create: create a new story in Rally
|
7
|
+
|
8
|
+
Usage: crab story create <name> [options*]
|
9
|
+
BANNER
|
10
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
11
|
+
end
|
12
|
+
|
13
|
+
name = ARGV.join(" ")
|
14
|
+
Trollop::die "Please specify a name for the story" if name.blank?
|
15
|
+
|
16
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
17
|
+
story = rally.create_story :name => name
|
18
|
+
puts "#{story.formatted_id}: #{story.name} (#{story.state})"
|
19
|
+
end
|
data/bin/crab-st-pull
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
opts = Trollop::options do
|
5
|
+
banner <<-BANNER
|
6
|
+
crab story pull: pulls stories from Rally and writes them out as Cucumber features
|
7
|
+
|
8
|
+
Usage: crab story pull <id> [id*] [options*]
|
9
|
+
BANNER
|
10
|
+
opt :language, "Language to generate Cucumber features in (ISO code)", :default => "en", :short => "-l"
|
11
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
12
|
+
end
|
13
|
+
|
14
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
15
|
+
|
16
|
+
ARGV.each do |story_number|
|
17
|
+
story = rally.find_story_with_id story_number
|
18
|
+
Trollop::die "Could not find story with ID #{story_number}" if story.nil?
|
19
|
+
|
20
|
+
puts "#{story.formatted_id}: #{story.full_file_name}"
|
21
|
+
|
22
|
+
fileutils_opts = opts[:dry] ? { :noop => true, :verbose => true } : {}
|
23
|
+
|
24
|
+
FileUtils.mkdir_p File.dirname(story.full_file_name), fileutils_opts
|
25
|
+
FileUtils.touch story.full_file_name, fileutils_opts
|
26
|
+
|
27
|
+
output = Crab::CucumberFeature.new(opts[:language]).generate_from story
|
28
|
+
|
29
|
+
if opts[:dry]
|
30
|
+
puts "Would write to #{story.full_file_name}:\n\n#{output}"
|
31
|
+
else
|
32
|
+
File.open(story.full_file_name, "w") do |file|
|
33
|
+
file.write output
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/bin/crab-st-ren
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
include Crab::Utilities
|
5
|
+
|
6
|
+
opts = Trollop::options do
|
7
|
+
banner <<-BANNER
|
8
|
+
crab story rename: rename a story
|
9
|
+
|
10
|
+
Usage: crab story rename <id> <name> [options*]
|
11
|
+
BANNER
|
12
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
13
|
+
end
|
14
|
+
|
15
|
+
id = ARGV.shift
|
16
|
+
Trollop::die "No story given" if id.empty?
|
17
|
+
|
18
|
+
name = ARGV.join(" ").squish
|
19
|
+
Trollop::die "No name given" if name.empty?
|
20
|
+
|
21
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
22
|
+
story = rally.find_story_with_id id
|
23
|
+
|
24
|
+
story.update :name => name
|
25
|
+
|
26
|
+
puts "#{story.formatted_id}: #{story.name} (#{story.state})"
|
27
|
+
end
|
data/bin/crab-st-rename
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
include Crab::Utilities
|
5
|
+
|
6
|
+
opts = Trollop::options do
|
7
|
+
banner <<-BANNER
|
8
|
+
crab story rename: rename a story
|
9
|
+
|
10
|
+
Usage: crab story rename <id> <name> [options*]
|
11
|
+
BANNER
|
12
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
13
|
+
end
|
14
|
+
|
15
|
+
id = ARGV.shift
|
16
|
+
Trollop::die "No story given" if id.empty?
|
17
|
+
|
18
|
+
name = ARGV.join(" ").squish
|
19
|
+
Trollop::die "No name given" if name.empty?
|
20
|
+
|
21
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
22
|
+
story = rally.find_story_with_id id
|
23
|
+
|
24
|
+
story.update :name => name
|
25
|
+
|
26
|
+
puts "#{story.formatted_id}: #{story.name} (#{story.state})"
|
27
|
+
end
|
data/bin/crab-st-rm
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
opts = Trollop::options do
|
5
|
+
banner <<-BANNER
|
6
|
+
crab story delete: delete an existing story in Rally
|
7
|
+
|
8
|
+
Usage: crab story delete <id> [options*]
|
9
|
+
BANNER
|
10
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
11
|
+
end
|
12
|
+
|
13
|
+
id = ARGV.join(" ")
|
14
|
+
Trollop::die "Story ID must be specified" if id.blank?
|
15
|
+
|
16
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
17
|
+
story = rally.find_story_with_id id
|
18
|
+
story.delete
|
19
|
+
|
20
|
+
puts "Story #{id} deleted."
|
21
|
+
end
|
data/bin/crab-st-show
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
opts = Trollop::options do
|
5
|
+
banner <<-BANNER
|
6
|
+
crab story show: displays a story in Rally as a Cucumber feature
|
7
|
+
|
8
|
+
Usage: crab story show <id> [options*]"
|
9
|
+
BANNER
|
10
|
+
opt :language, "Language to display Cucumber features in (ISO code)", :default => "en", :short => "-l"
|
11
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
12
|
+
end
|
13
|
+
|
14
|
+
id = ARGV.first
|
15
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
16
|
+
story = rally.find_story_with_id(id)
|
17
|
+
|
18
|
+
puts Crab::CucumberFeature.new(opts[:language]).generate_from story
|
19
|
+
end
|
data/bin/crab-st-up
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
include Crab::Utilities
|
5
|
+
|
6
|
+
cmd_opts = Trollop::options do
|
7
|
+
banner <<-BANNER
|
8
|
+
crab story update: update a story in Rally
|
9
|
+
|
10
|
+
Usage: crab story update <id> [options*]
|
11
|
+
BANNER
|
12
|
+
opt :name, "Name (title)", :type => String, :short => "-n"
|
13
|
+
opt :state, "State (one of: #{Crab::Story::VALID_STATES.join(" ")})", :type => String, :short => "-t"
|
14
|
+
opt :estimate, "Estimate", :type => :int, :short => "-e"
|
15
|
+
opt :iteration, "Iteration", :type => String, :short => "-i"
|
16
|
+
opt :release, "Release", :type => String, :short => "-r"
|
17
|
+
opt :blocked, "Blocked", :short => "-b"
|
18
|
+
opt :unblocked, "Unblocked", :short => "-u"
|
19
|
+
opt :parent, "Parent", :type => String, :short => "-p"
|
20
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
21
|
+
end
|
22
|
+
|
23
|
+
Trollop::die "No story given" if ARGV.empty?
|
24
|
+
Trollop::die "Nothing to update. Please provide some options" unless cmd_opts.any? {|k, v| k.to_s =~ /_given$/ }
|
25
|
+
|
26
|
+
opts = {}
|
27
|
+
opts[:name] = cmd_opts[:name] if cmd_opts[:name_given]
|
28
|
+
opts[:schedule_state] = state_from(cmd_opts[:state]) if cmd_opts[:state_given]
|
29
|
+
|
30
|
+
if cmd_opts[:estimate_given]
|
31
|
+
opts[:plan_estimate] = cmd_opts[:estimate] # nobody is going to remember "Plan Estimate", really
|
32
|
+
end
|
33
|
+
|
34
|
+
opts[:blocked] = cmd_opts[:blocked] if cmd_opts[:blocked_given]
|
35
|
+
opts[:blocked] = !cmd_opts[:unblocked] if cmd_opts[:unblocked_given]
|
36
|
+
|
37
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
38
|
+
rally.connect
|
39
|
+
|
40
|
+
story = rally.find_story_with_id ARGV.first
|
41
|
+
|
42
|
+
if cmd_opts[:iteration_given]
|
43
|
+
opts[:iteration] = rally.find_iteration_by_name cmd_opts[:iteration], story.rally_object.project
|
44
|
+
Trollop::die "Unknown iteration \"#{cmd_opts[:iteration]}\"" if opts[:iteration].nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
if cmd_opts[:release_given]
|
48
|
+
opts[:release] = rally.find_release_by_name cmd_opts[:release], story.rally_object.project
|
49
|
+
Trollop::die "Unknown release \"#{cmd_opts[:release]}\"" if opts[:release].nil?
|
50
|
+
end
|
51
|
+
|
52
|
+
if cmd_opts[:parent_given]
|
53
|
+
opts[:parent] = rally.find_story_with_id(cmd_opts[:parent]).rally_object
|
54
|
+
Trollop::die "Unknown story \"#{cmd_opts[:parent]}\"" if opts[:parent].nil?
|
55
|
+
end
|
56
|
+
|
57
|
+
opts[:name] = story.name if opts[:name].blank?
|
58
|
+
|
59
|
+
story.update opts
|
60
|
+
|
61
|
+
puts "#{story.formatted_id}: #{story.name} (#{story.state})"
|
62
|
+
end
|
data/bin/crab-st-update
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
include Crab::Utilities
|
5
|
+
|
6
|
+
cmd_opts = Trollop::options do
|
7
|
+
banner <<-BANNER
|
8
|
+
crab story update: update a story in Rally
|
9
|
+
|
10
|
+
Usage: crab story update <id> [options*]
|
11
|
+
BANNER
|
12
|
+
opt :name, "Name (title)", :type => String, :short => "-n"
|
13
|
+
opt :state, "State (one of: #{Crab::Story::VALID_STATES.join(" ")})", :type => String, :short => "-t"
|
14
|
+
opt :estimate, "Estimate", :type => :int, :short => "-e"
|
15
|
+
opt :iteration, "Iteration", :type => String, :short => "-i"
|
16
|
+
opt :release, "Release", :type => String, :short => "-r"
|
17
|
+
opt :blocked, "Blocked", :short => "-b"
|
18
|
+
opt :unblocked, "Unblocked", :short => "-u"
|
19
|
+
opt :parent, "Parent", :type => String, :short => "-p"
|
20
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
21
|
+
end
|
22
|
+
|
23
|
+
Trollop::die "No story given" if ARGV.empty?
|
24
|
+
Trollop::die "Nothing to update. Please provide some options" unless cmd_opts.any? {|k, v| k.to_s =~ /_given$/ }
|
25
|
+
|
26
|
+
opts = {}
|
27
|
+
opts[:name] = cmd_opts[:name] if cmd_opts[:name_given]
|
28
|
+
opts[:schedule_state] = state_from(cmd_opts[:state]) if cmd_opts[:state_given]
|
29
|
+
|
30
|
+
if cmd_opts[:estimate_given]
|
31
|
+
opts[:plan_estimate] = cmd_opts[:estimate] # nobody is going to remember "Plan Estimate", really
|
32
|
+
end
|
33
|
+
|
34
|
+
opts[:blocked] = cmd_opts[:blocked] if cmd_opts[:blocked_given]
|
35
|
+
opts[:blocked] = !cmd_opts[:unblocked] if cmd_opts[:unblocked_given]
|
36
|
+
|
37
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
38
|
+
rally.connect
|
39
|
+
|
40
|
+
story = rally.find_story_with_id ARGV.first
|
41
|
+
|
42
|
+
if cmd_opts[:iteration_given]
|
43
|
+
opts[:iteration] = rally.find_iteration_by_name cmd_opts[:iteration], story.rally_object.project
|
44
|
+
Trollop::die "Unknown iteration \"#{cmd_opts[:iteration]}\"" if opts[:iteration].nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
if cmd_opts[:release_given]
|
48
|
+
opts[:release] = rally.find_release_by_name cmd_opts[:release], story.rally_object.project
|
49
|
+
Trollop::die "Unknown release \"#{cmd_opts[:release]}\"" if opts[:release].nil?
|
50
|
+
end
|
51
|
+
|
52
|
+
if cmd_opts[:parent_given]
|
53
|
+
opts[:parent] = rally.find_story_with_id(cmd_opts[:parent]).rally_object
|
54
|
+
Trollop::die "Unknown story \"#{cmd_opts[:parent]}\"" if opts[:parent].nil?
|
55
|
+
end
|
56
|
+
|
57
|
+
opts[:name] = story.name if opts[:name].blank?
|
58
|
+
|
59
|
+
story.update opts
|
60
|
+
|
61
|
+
puts "#{story.formatted_id}: #{story.name} (#{story.state})"
|
62
|
+
end
|
data/bin/crab-story-change
CHANGED
@@ -45,7 +45,7 @@ Crab::Rally.new(opts[:dry]) do |rally|
|
|
45
45
|
end
|
46
46
|
|
47
47
|
if cmd_opts[:release_given]
|
48
|
-
opts[:release] = rally.find_release_by_name cmd_opts[:release], story.project
|
48
|
+
opts[:release] = rally.find_release_by_name cmd_opts[:release], story.rally_object.project
|
49
49
|
Trollop::die "Unknown release \"#{cmd_opts[:release]}\"" if opts[:release].nil?
|
50
50
|
end
|
51
51
|
|
data/bin/crab-story-help
CHANGED
@@ -5,7 +5,15 @@ Usage: crab story <command> [options*]
|
|
5
5
|
|
6
6
|
Available commands:
|
7
7
|
|
8
|
-
|
8
|
+
create Create stories
|
9
|
+
delete Delete stories
|
10
|
+
find Find stories
|
11
|
+
help This help message
|
12
|
+
move Move story status (from completed to accepted, etc)
|
13
|
+
pull Pull stories as Cucumber features
|
14
|
+
rename Rename stories
|
15
|
+
show Show stories as Cucumber features
|
16
|
+
update Update stories
|
9
17
|
|
10
18
|
--help, -h: Show this message
|
11
19
|
HELP
|
data/bin/crab-story-up
CHANGED
@@ -45,7 +45,7 @@ Crab::Rally.new(opts[:dry]) do |rally|
|
|
45
45
|
end
|
46
46
|
|
47
47
|
if cmd_opts[:release_given]
|
48
|
-
opts[:release] = rally.find_release_by_name cmd_opts[:release], story.project
|
48
|
+
opts[:release] = rally.find_release_by_name cmd_opts[:release], story.rally_object.project
|
49
49
|
Trollop::die "Unknown release \"#{cmd_opts[:release]}\"" if opts[:release].nil?
|
50
50
|
end
|
51
51
|
|
data/bin/crab-story-update
CHANGED
@@ -45,7 +45,7 @@ Crab::Rally.new(opts[:dry]) do |rally|
|
|
45
45
|
end
|
46
46
|
|
47
47
|
if cmd_opts[:release_given]
|
48
|
-
opts[:release] = rally.find_release_by_name cmd_opts[:release], story.project
|
48
|
+
opts[:release] = rally.find_release_by_name cmd_opts[:release], story.rally_object.project
|
49
49
|
Trollop::die "Unknown release \"#{cmd_opts[:release]}\"" if opts[:release].nil?
|
50
50
|
end
|
51
51
|
|
data/bin/crab-tc
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# vim: set ft=ruby:
|
3
|
+
|
4
|
+
cmd = ARGV.shift # get the subcommand
|
5
|
+
|
6
|
+
case cmd
|
7
|
+
when "-h", "--help", NilClass
|
8
|
+
system "crab-testcase-help"
|
9
|
+
exit 0
|
10
|
+
end
|
11
|
+
|
12
|
+
unless system("crab-testcase-#{cmd}", *ARGV)
|
13
|
+
if $?.exitstatus == 127 # bash 'command not found'
|
14
|
+
$stderr.puts "Unknown subcommand \"testcase #{cmd}\""
|
15
|
+
system "crab-testcase-help"
|
16
|
+
exit 127
|
17
|
+
end
|
18
|
+
end
|
data/bin/crab-tc-add
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
include Crab::Utilities
|
5
|
+
|
6
|
+
opts = add_or_update_options <<-BANNER
|
7
|
+
crab testcase create: add a test case to a story in Rally
|
8
|
+
|
9
|
+
Usage: crab testcase create <story> <name> [options*]
|
10
|
+
BANNER
|
11
|
+
|
12
|
+
story_id = ARGV.shift
|
13
|
+
unless story_id
|
14
|
+
$stderr.puts "Error: Story ID not provided."
|
15
|
+
system "crab-testcase-help"
|
16
|
+
exit 1
|
17
|
+
end
|
18
|
+
|
19
|
+
name = ARGV.join(" ")
|
20
|
+
unless name
|
21
|
+
$stderr.puts "Error: Test case name not provided."
|
22
|
+
system "crab-testcase-help"
|
23
|
+
exit 1
|
24
|
+
end
|
25
|
+
|
26
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
27
|
+
tc = rally.create_test_case(story_id, name, sanitize_options(opts))
|
28
|
+
puts "#{tc.story.formatted_id}/#{tc.formatted_id}: #{tc.name} (#{tc.tags.join(" ")})"
|
29
|
+
end
|
data/bin/crab-tc-change
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
include Crab::Utilities
|
5
|
+
|
6
|
+
opts = add_or_update_options <<-BANNER
|
7
|
+
crab testcase update: update a test case in Rally
|
8
|
+
|
9
|
+
Usage: crab testcase update <id> [options*]
|
10
|
+
BANNER
|
11
|
+
|
12
|
+
tc_id = ARGV.shift
|
13
|
+
|
14
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
15
|
+
tc = rally.find_test_case(tc_id)
|
16
|
+
tc.update(sanitize_options(opts))
|
17
|
+
puts "#{tc.story.formatted_id}/#{tc.formatted_id}: #{tc.name} (#{tc.tags.join(" ")})"
|
18
|
+
end
|
data/bin/crab-tc-create
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
include Crab::Utilities
|
5
|
+
|
6
|
+
opts = add_or_update_options <<-BANNER
|
7
|
+
crab testcase create: add a test case to a story in Rally
|
8
|
+
|
9
|
+
Usage: crab testcase create <story> <name> [options*]
|
10
|
+
BANNER
|
11
|
+
|
12
|
+
story_id = ARGV.shift
|
13
|
+
unless story_id
|
14
|
+
$stderr.puts "Error: Story ID not provided."
|
15
|
+
system "crab-testcase-help"
|
16
|
+
exit 1
|
17
|
+
end
|
18
|
+
|
19
|
+
name = ARGV.join(" ")
|
20
|
+
unless name
|
21
|
+
$stderr.puts "Error: Test case name not provided."
|
22
|
+
system "crab-testcase-help"
|
23
|
+
exit 1
|
24
|
+
end
|
25
|
+
|
26
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
27
|
+
tc = rally.create_test_case(story_id, name, sanitize_options(opts))
|
28
|
+
puts "#{tc.story.formatted_id}/#{tc.formatted_id}: #{tc.name} (#{tc.tags.join(" ")})"
|
29
|
+
end
|