crab 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. data/README.md +0 -1
  2. data/bin/crab +27 -14
  3. data/bin/crab-help +10 -2
  4. data/bin/crab-it +25 -11
  5. data/bin/crab-it-help +11 -2
  6. data/bin/crab-it-list +25 -15
  7. data/bin/crab-iteration +25 -11
  8. data/bin/crab-iteration-help +11 -2
  9. data/bin/crab-iteration-list +25 -15
  10. data/bin/crab-login +24 -13
  11. data/bin/crab-logout +22 -9
  12. data/bin/crab-project +42 -32
  13. data/bin/crab-rel +25 -11
  14. data/bin/crab-rel-help +12 -3
  15. data/bin/crab-rel-list +23 -15
  16. data/bin/crab-release +25 -11
  17. data/bin/crab-release-help +12 -3
  18. data/bin/crab-release-list +23 -15
  19. data/bin/crab-st +24 -11
  20. data/bin/crab-st-add +18 -10
  21. data/bin/crab-st-change +53 -39
  22. data/bin/crab-st-create +18 -10
  23. data/bin/crab-st-del +19 -11
  24. data/bin/crab-st-delete +19 -11
  25. data/bin/crab-st-find +32 -21
  26. data/bin/crab-st-help +11 -2
  27. data/bin/crab-st-list +32 -21
  28. data/bin/crab-st-ls +32 -21
  29. data/bin/crab-st-move +26 -14
  30. data/bin/crab-st-mv +26 -14
  31. data/bin/crab-st-new +18 -10
  32. data/bin/crab-st-pull +28 -20
  33. data/bin/crab-st-ren +26 -14
  34. data/bin/crab-st-rename +26 -14
  35. data/bin/crab-st-rm +19 -11
  36. data/bin/crab-st-show +19 -11
  37. data/bin/crab-st-up +53 -39
  38. data/bin/crab-st-update +53 -39
  39. data/bin/crab-story +24 -11
  40. data/bin/crab-story-add +18 -10
  41. data/bin/crab-story-change +53 -39
  42. data/bin/crab-story-create +18 -10
  43. data/bin/crab-story-del +19 -11
  44. data/bin/crab-story-delete +19 -11
  45. data/bin/crab-story-diff +54 -0
  46. data/bin/crab-story-find +32 -21
  47. data/bin/crab-story-help +11 -2
  48. data/bin/crab-story-list +32 -21
  49. data/bin/crab-story-ls +32 -21
  50. data/bin/crab-story-move +26 -14
  51. data/bin/crab-story-mv +26 -14
  52. data/bin/crab-story-new +18 -10
  53. data/bin/crab-story-pull +28 -20
  54. data/bin/crab-story-ren +26 -14
  55. data/bin/crab-story-rename +26 -14
  56. data/bin/crab-story-rm +19 -11
  57. data/bin/crab-story-show +19 -11
  58. data/bin/crab-story-up +53 -39
  59. data/bin/crab-story-update +53 -39
  60. data/bin/crab-tc +24 -11
  61. data/bin/crab-tc-add +32 -20
  62. data/bin/crab-tc-change +18 -8
  63. data/bin/crab-tc-create +32 -20
  64. data/bin/crab-tc-del +18 -10
  65. data/bin/crab-tc-delete +18 -10
  66. data/bin/crab-tc-find +32 -21
  67. data/bin/crab-tc-help +11 -2
  68. data/bin/crab-tc-list +32 -21
  69. data/bin/crab-tc-ls +32 -21
  70. data/bin/crab-tc-new +32 -20
  71. data/bin/crab-tc-rm +18 -10
  72. data/bin/crab-tc-show +28 -15
  73. data/bin/crab-tc-up +18 -8
  74. data/bin/crab-tc-update +18 -8
  75. data/bin/crab-testcase +24 -11
  76. data/bin/crab-testcase-add +32 -20
  77. data/bin/crab-testcase-change +18 -8
  78. data/bin/crab-testcase-create +32 -20
  79. data/bin/crab-testcase-del +18 -10
  80. data/bin/crab-testcase-delete +18 -10
  81. data/bin/crab-testcase-find +32 -21
  82. data/bin/crab-testcase-help +11 -2
  83. data/bin/crab-testcase-list +32 -21
  84. data/bin/crab-testcase-ls +32 -21
  85. data/bin/crab-testcase-new +32 -20
  86. data/bin/crab-testcase-rm +18 -10
  87. data/bin/crab-testcase-show +28 -15
  88. data/bin/crab-testcase-up +18 -8
  89. data/bin/crab-testcase-update +18 -8
  90. data/bin/crab-truncate +1 -0
  91. data/bin/crab-version +2 -1
  92. data/features/subcommand-help.feature +1 -0
  93. data/lib/crab.rb +2 -0
  94. data/lib/crab/cucumber_to_rally_adapter.rb +48 -0
  95. data/lib/crab/rally.rb +21 -1
  96. data/lib/crab/utilities.rb +10 -2
  97. data/lib/crab/version.rb +1 -1
  98. metadata +7 -4
@@ -14,20 +14,25 @@ module Crab
14
14
 
15
15
  def connect
16
16
  get_credentials
17
+ logger.info "Connecting to Rally as #{@username}..."
17
18
  @rally = ::RallyRestAPI.new :username => @username, :password => @password
18
19
  end
19
20
 
20
21
  def get_credentials
22
+ logger.info "Getting credentials..."
21
23
  @username, @password = File.read(valid_credentials_file).split /\n/
22
24
  end
23
25
 
24
26
  def find_story_with_id story_id
27
+ logger.info "Looking up story with ID #{story_id}"
25
28
  story = @rally.find(:hierarchical_requirement) { equal :formatted_i_d, story_id }.first
26
29
  Trollop::die "Story with ID #{story_id.inspect} not found" if story.nil?
27
30
  Crab::Story.new(story, @dry_run)
28
31
  end
29
32
 
30
33
  def find_testcases(project, pattern, opts)
34
+ logger.info "Looking for testcases matching #{pattern.inspect} with options #{opts.keys.inspect} in #{project.name.inspect}"
35
+
31
36
  if pattern.join.empty? && opts.empty?
32
37
  return @rally.find_all(:test_case, :fetch => true, :project => project).map {|tc| Crab::TestCase.new(tc, @dry_run) }
33
38
  end
@@ -42,10 +47,12 @@ module Crab
42
47
  equal :type, opts[:type].capitalize if opts[:type]
43
48
  end
44
49
 
50
+ logger.info "Found #{rally_testcases.size} test cases"
45
51
  rally_testcases.map {|tc| Crab::TestCase.new(tc, @dry_run) }
46
52
  end
47
53
 
48
54
  def find_stories(project, pattern, opts)
55
+ logger.info "Looking for stories matching #{pattern.inspect} with options #{opts.keys.inspect} in #{project.name.inspect}"
49
56
  if pattern.join.empty? && opts.empty?
50
57
  return @rally.find_all(:hierarchical_requirement, :fetch => true, :project => project).map {|s| Crab::Story.new(s, @dry_run) }
51
58
  end
@@ -58,34 +65,42 @@ module Crab
58
65
  equal :parent, opts[:parent].rally_object if opts[:parent]
59
66
  end
60
67
 
68
+ logger.info "Found #{rally_stories.size} stories"
61
69
  rally_stories.map {|story| Crab::Story.new(story, @dry_run) }
62
70
  end
63
71
 
64
72
  def find_project(name)
73
+ logger.info "Looking for project #{name.inspect}"
65
74
  @rally.find(:project, :fetch => true) { equal :name, name }.first
66
75
  end
67
76
 
68
77
  def find_iterations(project)
78
+ logger.info "Looking for all iterations in #{project.name.inspect}"
69
79
  @rally.find_all(:iteration, :project => project)
70
80
  end
71
81
 
72
82
  def find_iteration_by_name(name, project)
83
+ logger.info "Looking for iteration #{name.inspect} in #{project.name.inspect}"
73
84
  iteration = @rally.find(:iteration, :project => project) { equal :name, name }.first
74
85
  Trollop::die "Unknown iteration \"#{name}\"" if iteration.nil?
75
86
  iteration
76
87
  end
77
88
 
78
89
  def find_releases(project)
90
+ logger.info "Looking for all releases in #{project.name.inspect}"
79
91
  @rally.find_all(:release, :project => project, :fetch => true)
80
92
  end
81
93
 
82
94
  def find_release_by_name(name, project)
95
+ logger.info "Looking for release #{name.inspect} in #{project.name.inspect}"
83
96
  release = @rally.find(:release, :project => project) { equal :name, name }.first
84
97
  Trollop::die "Unknown release \"#{name}\"" if release.nil?
85
98
  release
86
99
  end
87
100
 
88
101
  def create_story(opts)
102
+ logger.info "Creating story with #{opts.keys.inspect}"
103
+
89
104
  if @dry_run
90
105
  Crab::DryRun::Story.new opts
91
106
  else
@@ -97,6 +112,8 @@ module Crab
97
112
  story = find_story_with_id story_id
98
113
  opts = {:name => name, :work_product => story.rally_object, :project => story.rally_object.project}.merge(opts)
99
114
 
115
+ logger.info "Creating test case with #{opts.keys.inspect}"
116
+
100
117
  if @dry_run
101
118
  puts "Would create test case for story with ID #{story_id} with #{opts.inspect}"
102
119
  else
@@ -106,7 +123,10 @@ module Crab
106
123
  end
107
124
 
108
125
  def find_test_case(tc_id)
109
- Crab::TestCase.new(@rally.find(:test_case) { equal :formatted_i_d, tc_id }.first, @dry_run)
126
+ logger.info "Looking up test case with ID #{tc_id}"
127
+ tc = @rally.find(:test_case) { equal :formatted_i_d, tc_id }.first
128
+ Trollop::die "Test case with ID #{tc_id.inspect} not found" if tc.nil?
129
+ Crab::TestCase.new(tc, @dry_run)
110
130
  end
111
131
 
112
132
  private
@@ -1,6 +1,14 @@
1
1
  module Crab
2
2
  module Utilities
3
3
 
4
+ def logger
5
+ $logger ||= Logger.new(STDERR)
6
+ $logger.formatter = Logger::Formatter.new
7
+ $logger.progname = 'crab'
8
+ # TODO - make this a global command-line or config option: $logger.level = Logger::WARN
9
+ $logger
10
+ end
11
+
4
12
  def credentials_file
5
13
  FileUtils.mkdir_p File.expand_path("~/.crab")
6
14
  File.expand_path("~/.crab/credentials")
@@ -41,8 +49,8 @@ module Crab
41
49
  end
42
50
 
43
51
  # TODO REFACTOR testcase related stuff that didn't have a good home
44
- def add_or_update_options(banner)
45
- Trollop::options do
52
+ def add_or_update_options(banner, args)
53
+ Trollop::options(args) do
46
54
  banner banner
47
55
  opt :priority, "Priority (one of: #{Crab::TestCase::PRIORITIES.join(" ")}", :default => "important", :short => '-p'
48
56
  opt :risk, "Risk (one of: #{Crab::TestCase::RISKS.join(" ")})", :default => "medium", :short => '-r'
@@ -1,3 +1,3 @@
1
1
  module Crab
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crab
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 7
10
- version: 0.2.7
9
+ - 8
10
+ version: 0.2.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Carlos Villela
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-01 00:00:00 -03:00
18
+ date: 2011-10-02 00:00:00 -03:00
19
19
  default_executable: crab
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -191,6 +191,7 @@ executables:
191
191
  - crab-story-create
192
192
  - crab-story-del
193
193
  - crab-story-delete
194
+ - crab-story-diff
194
195
  - crab-story-find
195
196
  - crab-story-help
196
197
  - crab-story-list
@@ -290,6 +291,7 @@ files:
290
291
  - bin/crab-story-create
291
292
  - bin/crab-story-del
292
293
  - bin/crab-story-delete
294
+ - bin/crab-story-diff
293
295
  - bin/crab-story-find
294
296
  - bin/crab-story-help
295
297
  - bin/crab-story-list
@@ -351,6 +353,7 @@ files:
351
353
  - lib/crab.rb
352
354
  - lib/crab/cucumber_feature.rb
353
355
  - lib/crab/cucumber_scenario.rb
356
+ - lib/crab/cucumber_to_rally_adapter.rb
354
357
  - lib/crab/rally.rb
355
358
  - lib/crab/story.rb
356
359
  - lib/crab/testcase.rb