crab 0.2.4 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/bin/crab-it +18 -0
  2. data/bin/crab-it-help +12 -0
  3. data/bin/crab-it-list +28 -0
  4. data/bin/crab-iteration-help +1 -0
  5. data/bin/crab-rel +18 -0
  6. data/bin/crab-rel-help +12 -0
  7. data/bin/crab-rel-list +28 -0
  8. data/bin/crab-st +18 -0
  9. data/bin/crab-st-add +19 -0
  10. data/bin/crab-st-change +62 -0
  11. data/bin/crab-st-create +19 -0
  12. data/bin/crab-st-del +21 -0
  13. data/bin/crab-st-delete +21 -0
  14. data/bin/crab-st-find +34 -0
  15. data/bin/crab-st-help +19 -0
  16. data/bin/crab-st-list +34 -0
  17. data/bin/crab-st-ls +34 -0
  18. data/bin/crab-st-move +26 -0
  19. data/bin/crab-st-mv +26 -0
  20. data/bin/crab-st-new +19 -0
  21. data/bin/crab-st-pull +37 -0
  22. data/bin/crab-st-ren +27 -0
  23. data/bin/crab-st-rename +27 -0
  24. data/bin/crab-st-rm +21 -0
  25. data/bin/crab-st-show +19 -0
  26. data/bin/crab-st-up +62 -0
  27. data/bin/crab-st-update +62 -0
  28. data/bin/crab-story-change +1 -1
  29. data/bin/crab-story-help +9 -1
  30. data/bin/crab-story-up +1 -1
  31. data/bin/crab-story-update +1 -1
  32. data/bin/crab-tc +18 -0
  33. data/bin/crab-tc-add +29 -0
  34. data/bin/crab-tc-change +18 -0
  35. data/bin/crab-tc-create +29 -0
  36. data/bin/crab-tc-del +18 -0
  37. data/bin/crab-tc-delete +18 -0
  38. data/bin/crab-tc-find +34 -0
  39. data/bin/crab-tc-help +16 -0
  40. data/bin/crab-tc-list +34 -0
  41. data/bin/crab-tc-ls +34 -0
  42. data/bin/crab-tc-new +29 -0
  43. data/bin/crab-tc-rm +18 -0
  44. data/bin/crab-tc-show +24 -0
  45. data/bin/crab-tc-up +18 -0
  46. data/bin/crab-tc-update +18 -0
  47. data/bin/crab-testcase-find +1 -5
  48. data/bin/crab-testcase-list +21 -12
  49. data/bin/crab-testcase-ls +1 -5
  50. data/lib/crab/rally.rb +14 -14
  51. data/lib/crab/version.rb +1 -1
  52. metadata +85 -3
data/bin/crab-it 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-iteration-help"
9
+ exit 0
10
+ end
11
+
12
+ unless system("crab-iteration-#{cmd}", *ARGV)
13
+ if $?.exitstatus == 127 # bash 'command not found'
14
+ $stderr.puts "Unknown subcommand \"iteration #{cmd}\""
15
+ system "crab-iteration-help"
16
+ exit 127
17
+ end
18
+ end
data/bin/crab-it-help ADDED
@@ -0,0 +1,12 @@
1
+ # vim: set ft=ruby :
2
+
3
+ puts <<-HELP
4
+ Usage: crab iteration <command> [options*]
5
+
6
+ Available commands:
7
+
8
+ list List iterations available
9
+ help Show this help text
10
+
11
+ --help, -h: Show this message
12
+ HELP
data/bin/crab-it-list ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+ # vim: set ft=ruby:
3
+
4
+ require 'crab'
5
+
6
+ include Crab::Utilities
7
+
8
+ opts = Trollop::options do
9
+ banner <<-BANNER
10
+ crab iteration list: list iterations available in the current project
11
+
12
+ Usage: crab iteration list [options*]
13
+ BANNER
14
+ opt :project, "Project to use (required unless set by 'crab project')", :short => "-p", :type => String
15
+ opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
16
+ end
17
+
18
+ pattern = ARGV.map(&:strip).reject(&:empty?)
19
+ project_name = valid_project_name(opts)
20
+
21
+ Crab::Rally.new(opts[:dry]) do |rally|
22
+ project = rally.find_project(project_name)
23
+ Trollop::die "Project #{opts[:project].inspect} not found" if project.nil?
24
+
25
+ rally.find_iterations(project).each do |iteration|
26
+ puts iteration.name
27
+ end
28
+ end
@@ -5,6 +5,7 @@ Usage: crab iteration <command> [options*]
5
5
 
6
6
  Available commands:
7
7
 
8
+ list List iterations available
8
9
  help Show this help text
9
10
 
10
11
  --help, -h: Show this message
data/bin/crab-rel 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-release-help"
9
+ exit 0
10
+ end
11
+
12
+ unless system("crab-release-#{cmd}", *ARGV)
13
+ if $?.exitstatus == 127 # bash 'command not found'
14
+ $stderr.puts "Unknown subcommand \"release #{cmd}\""
15
+ system "crab-release-help"
16
+ exit 127
17
+ end
18
+ end
data/bin/crab-rel-help ADDED
@@ -0,0 +1,12 @@
1
+ # vim: set ft=ruby :
2
+
3
+ puts <<-HELP
4
+ Usage: crab release <command> [options*]
5
+
6
+ Available commands:
7
+
8
+ list List releases available in the current project
9
+ help Show this help text
10
+
11
+ --help, -h: Show this message
12
+ HELP
data/bin/crab-rel-list ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+ # vim: set ft=ruby:
3
+
4
+ require 'crab'
5
+
6
+ include Crab::Utilities
7
+
8
+ opts = Trollop::options do
9
+ banner <<-BANNER
10
+ crab release list: list releases available in the current project
11
+
12
+ Usage: crab release list [options*]
13
+ BANNER
14
+ opt :project, "Project to use (required unless set by 'crab project')", :short => "-p", :type => String
15
+ opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
16
+ end
17
+
18
+ pattern = ARGV.map(&:strip).reject(&:empty?)
19
+ project_name = valid_project_name(opts)
20
+
21
+ Crab::Rally.new(opts[:dry]) do |rally|
22
+ project = rally.find_project(project_name)
23
+ Trollop::die "Project #{opts[:project].inspect} not found" if project.nil?
24
+
25
+ rally.find_releases(project).each do |release|
26
+ puts release.name
27
+ end
28
+ end
data/bin/crab-st 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-story-help"
9
+ exit 0
10
+ end
11
+
12
+ unless system("crab-story-#{cmd}", *ARGV)
13
+ if $?.exitstatus == 127 # bash 'command not found'
14
+ $stderr.puts "Unknown subcommand \"story #{cmd}\""
15
+ system "crab-story-help"
16
+ exit 127
17
+ end
18
+ end
data/bin/crab-st-add 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
@@ -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
@@ -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-del 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
@@ -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-find ADDED
@@ -0,0 +1,34 @@
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 find: find a story in Rally
9
+
10
+ Usage: crab story find [options*] [text]
11
+ BANNER
12
+ opt :project, "Project to use (required unless set by 'crab project')", :short => "-p", :type => String
13
+ opt :iteration, "Limit search to this iteration", :short => "-i", :type => String
14
+ opt :release, "Limit search to this release", :short => "-r", :type => String
15
+ opt :parent, "Limit search to children of this story", :short => "-P", :type => String
16
+ opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
17
+ end
18
+
19
+ pattern = ARGV.map(&:strip).reject(&:empty?)
20
+ project_name = valid_project_name(opts)
21
+
22
+ Crab::Rally.new(opts[:dry]) do |rally|
23
+ project = rally.find_project(project_name)
24
+ Trollop::die "Project #{opts[:project].inspect} not found" if project.nil?
25
+
26
+ find_opts = {}
27
+ find_opts[:iteration] = rally.find_iteration_by_name opts[:iteration], project if opts[:iteration_given]
28
+ find_opts[:release] = rally.find_release_by_name opts[:release], project if opts[:release_given]
29
+ find_opts[:parent] = rally.find_story_with_id opts[:parent] if opts[:parent_given]
30
+
31
+ rally.find_stories(project, pattern, find_opts).each do |story|
32
+ puts "#{story.formatted_id}: #{story.name} (#{story.state})"
33
+ end
34
+ end
data/bin/crab-st-help ADDED
@@ -0,0 +1,19 @@
1
+ # vim: set ft=ruby :
2
+
3
+ puts <<-HELP
4
+ Usage: crab story <command> [options*]
5
+
6
+ Available commands:
7
+
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
17
+
18
+ --help, -h: Show this message
19
+ HELP
data/bin/crab-st-list ADDED
@@ -0,0 +1,34 @@
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 find: find a story in Rally
9
+
10
+ Usage: crab story find [options*] [text]
11
+ BANNER
12
+ opt :project, "Project to use (required unless set by 'crab project')", :short => "-p", :type => String
13
+ opt :iteration, "Limit search to this iteration", :short => "-i", :type => String
14
+ opt :release, "Limit search to this release", :short => "-r", :type => String
15
+ opt :parent, "Limit search to children of this story", :short => "-P", :type => String
16
+ opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
17
+ end
18
+
19
+ pattern = ARGV.map(&:strip).reject(&:empty?)
20
+ project_name = valid_project_name(opts)
21
+
22
+ Crab::Rally.new(opts[:dry]) do |rally|
23
+ project = rally.find_project(project_name)
24
+ Trollop::die "Project #{opts[:project].inspect} not found" if project.nil?
25
+
26
+ find_opts = {}
27
+ find_opts[:iteration] = rally.find_iteration_by_name opts[:iteration], project if opts[:iteration_given]
28
+ find_opts[:release] = rally.find_release_by_name opts[:release], project if opts[:release_given]
29
+ find_opts[:parent] = rally.find_story_with_id opts[:parent] if opts[:parent_given]
30
+
31
+ rally.find_stories(project, pattern, find_opts).each do |story|
32
+ puts "#{story.formatted_id}: #{story.name} (#{story.state})"
33
+ end
34
+ end
data/bin/crab-st-ls ADDED
@@ -0,0 +1,34 @@
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 find: find a story in Rally
9
+
10
+ Usage: crab story find [options*] [text]
11
+ BANNER
12
+ opt :project, "Project to use (required unless set by 'crab project')", :short => "-p", :type => String
13
+ opt :iteration, "Limit search to this iteration", :short => "-i", :type => String
14
+ opt :release, "Limit search to this release", :short => "-r", :type => String
15
+ opt :parent, "Limit search to children of this story", :short => "-P", :type => String
16
+ opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
17
+ end
18
+
19
+ pattern = ARGV.map(&:strip).reject(&:empty?)
20
+ project_name = valid_project_name(opts)
21
+
22
+ Crab::Rally.new(opts[:dry]) do |rally|
23
+ project = rally.find_project(project_name)
24
+ Trollop::die "Project #{opts[:project].inspect} not found" if project.nil?
25
+
26
+ find_opts = {}
27
+ find_opts[:iteration] = rally.find_iteration_by_name opts[:iteration], project if opts[:iteration_given]
28
+ find_opts[:release] = rally.find_release_by_name opts[:release], project if opts[:release_given]
29
+ find_opts[:parent] = rally.find_story_with_id opts[:parent] if opts[:parent_given]
30
+
31
+ rally.find_stories(project, pattern, find_opts).each do |story|
32
+ puts "#{story.formatted_id}: #{story.name} (#{story.state})"
33
+ end
34
+ end
data/bin/crab-st-move 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