crab 0.2.6 → 0.2.7
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-st-change +0 -3
- data/bin/crab-st-show +2 -1
- data/bin/crab-st-up +0 -3
- data/bin/crab-st-update +0 -3
- data/bin/crab-story-change +0 -3
- data/bin/crab-story-show +2 -1
- data/bin/crab-story-up +0 -3
- data/bin/crab-story-update +0 -3
- data/bin/crab-tc-help +1 -0
- data/bin/crab-testcase-help +1 -0
- data/lib/crab/cucumber_feature.rb +7 -2
- data/lib/crab/rally.rb +23 -20
- data/lib/crab/version.rb +1 -1
- metadata +4 -4
data/bin/crab-st-change
CHANGED
@@ -41,17 +41,14 @@ Crab::Rally.new(opts[:dry]) do |rally|
|
|
41
41
|
|
42
42
|
if cmd_opts[:iteration_given]
|
43
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
44
|
end
|
46
45
|
|
47
46
|
if cmd_opts[:release_given]
|
48
47
|
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
48
|
end
|
51
49
|
|
52
50
|
if cmd_opts[:parent_given]
|
53
51
|
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
52
|
end
|
56
53
|
|
57
54
|
opts[:name] = story.name if opts[:name].blank?
|
data/bin/crab-st-show
CHANGED
@@ -8,6 +8,7 @@ crab story show: displays a story in Rally as a Cucumber feature
|
|
8
8
|
Usage: crab story show <id> [options*]"
|
9
9
|
BANNER
|
10
10
|
opt :language, "Language to display Cucumber features in (ISO code)", :default => "en", :short => "-l"
|
11
|
+
opt :testcases, "Also convert test cases to scenarios (similar to crab testcase show)", :short => "-t", :default => true
|
11
12
|
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
12
13
|
end
|
13
14
|
|
@@ -15,5 +16,5 @@ id = ARGV.first
|
|
15
16
|
Crab::Rally.new(opts[:dry]) do |rally|
|
16
17
|
story = rally.find_story_with_id(id)
|
17
18
|
|
18
|
-
puts Crab::CucumberFeature.new(opts[:language]).generate_from
|
19
|
+
puts Crab::CucumberFeature.new(opts[:language]).generate_from(story, opts[:testcases])
|
19
20
|
end
|
data/bin/crab-st-up
CHANGED
@@ -41,17 +41,14 @@ Crab::Rally.new(opts[:dry]) do |rally|
|
|
41
41
|
|
42
42
|
if cmd_opts[:iteration_given]
|
43
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
44
|
end
|
46
45
|
|
47
46
|
if cmd_opts[:release_given]
|
48
47
|
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
48
|
end
|
51
49
|
|
52
50
|
if cmd_opts[:parent_given]
|
53
51
|
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
52
|
end
|
56
53
|
|
57
54
|
opts[:name] = story.name if opts[:name].blank?
|
data/bin/crab-st-update
CHANGED
@@ -41,17 +41,14 @@ Crab::Rally.new(opts[:dry]) do |rally|
|
|
41
41
|
|
42
42
|
if cmd_opts[:iteration_given]
|
43
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
44
|
end
|
46
45
|
|
47
46
|
if cmd_opts[:release_given]
|
48
47
|
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
48
|
end
|
51
49
|
|
52
50
|
if cmd_opts[:parent_given]
|
53
51
|
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
52
|
end
|
56
53
|
|
57
54
|
opts[:name] = story.name if opts[:name].blank?
|
data/bin/crab-story-change
CHANGED
@@ -41,17 +41,14 @@ Crab::Rally.new(opts[:dry]) do |rally|
|
|
41
41
|
|
42
42
|
if cmd_opts[:iteration_given]
|
43
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
44
|
end
|
46
45
|
|
47
46
|
if cmd_opts[:release_given]
|
48
47
|
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
48
|
end
|
51
49
|
|
52
50
|
if cmd_opts[:parent_given]
|
53
51
|
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
52
|
end
|
56
53
|
|
57
54
|
opts[:name] = story.name if opts[:name].blank?
|
data/bin/crab-story-show
CHANGED
@@ -8,6 +8,7 @@ crab story show: displays a story in Rally as a Cucumber feature
|
|
8
8
|
Usage: crab story show <id> [options*]"
|
9
9
|
BANNER
|
10
10
|
opt :language, "Language to display Cucumber features in (ISO code)", :default => "en", :short => "-l"
|
11
|
+
opt :testcases, "Also convert test cases to scenarios (similar to crab testcase show)", :short => "-t", :default => true
|
11
12
|
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
12
13
|
end
|
13
14
|
|
@@ -15,5 +16,5 @@ id = ARGV.first
|
|
15
16
|
Crab::Rally.new(opts[:dry]) do |rally|
|
16
17
|
story = rally.find_story_with_id(id)
|
17
18
|
|
18
|
-
puts Crab::CucumberFeature.new(opts[:language]).generate_from
|
19
|
+
puts Crab::CucumberFeature.new(opts[:language]).generate_from(story, opts[:testcases])
|
19
20
|
end
|
data/bin/crab-story-up
CHANGED
@@ -41,17 +41,14 @@ Crab::Rally.new(opts[:dry]) do |rally|
|
|
41
41
|
|
42
42
|
if cmd_opts[:iteration_given]
|
43
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
44
|
end
|
46
45
|
|
47
46
|
if cmd_opts[:release_given]
|
48
47
|
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
48
|
end
|
51
49
|
|
52
50
|
if cmd_opts[:parent_given]
|
53
51
|
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
52
|
end
|
56
53
|
|
57
54
|
opts[:name] = story.name if opts[:name].blank?
|
data/bin/crab-story-update
CHANGED
@@ -41,17 +41,14 @@ Crab::Rally.new(opts[:dry]) do |rally|
|
|
41
41
|
|
42
42
|
if cmd_opts[:iteration_given]
|
43
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
44
|
end
|
46
45
|
|
47
46
|
if cmd_opts[:release_given]
|
48
47
|
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
48
|
end
|
51
49
|
|
52
50
|
if cmd_opts[:parent_given]
|
53
51
|
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
52
|
end
|
56
53
|
|
57
54
|
opts[:name] = story.name if opts[:name].blank?
|
data/bin/crab-tc-help
CHANGED
@@ -7,6 +7,7 @@ Usage: crab testcase <command> [options*]
|
|
7
7
|
|
8
8
|
create Create a new test case in a story
|
9
9
|
delete Delete an existing test case
|
10
|
+
find Find test cases
|
10
11
|
help Show this help text
|
11
12
|
list List test cases in a story
|
12
13
|
show Show a test case (and its steps) as a Cucumber scenario
|
data/bin/crab-testcase-help
CHANGED
@@ -7,6 +7,7 @@ Usage: crab testcase <command> [options*]
|
|
7
7
|
|
8
8
|
create Create a new test case in a story
|
9
9
|
delete Delete an existing test case
|
10
|
+
find Find test cases
|
10
11
|
help Show this help text
|
11
12
|
list List test cases in a story
|
12
13
|
show Show a test case (and its steps) as a Cucumber scenario
|
@@ -6,15 +6,20 @@ module Crab
|
|
6
6
|
@language = Gherkin::I18n.new(language)
|
7
7
|
end
|
8
8
|
|
9
|
-
def generate_from(story)
|
9
|
+
def generate_from(story, include_testcases)
|
10
10
|
text = <<-FEATURE
|
11
11
|
# language: #{@language.iso_code}
|
12
12
|
#{@language.keywords('feature').last}: [#{story.formatted_id}] #{story.name}
|
13
13
|
|
14
14
|
#{story.description}
|
15
|
+
FEATURE
|
15
16
|
|
17
|
+
if include_testcases
|
18
|
+
text << <<-SCENARIOS
|
16
19
|
#{Array(story.scenarios).map {|scenario| CucumberScenario.new(@language.iso_code).generate_from scenario }}
|
17
|
-
|
20
|
+
SCENARIOS
|
21
|
+
end
|
22
|
+
|
18
23
|
text.strip
|
19
24
|
end
|
20
25
|
end
|
data/lib/crab/rally.rb
CHANGED
@@ -33,15 +33,8 @@ module Crab
|
|
33
33
|
end
|
34
34
|
|
35
35
|
rally_testcases = @rally.find(:test_case, :fetch => true, :project => project) do
|
36
|
-
|
37
|
-
|
38
|
-
(pattern.map(&:downcase) + pattern.map(&:capitalize)).each do |word|
|
39
|
-
contains :name, word
|
40
|
-
contains :description, word
|
41
|
-
contains :notes, word
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
36
|
+
Crab::Rally.search_for_words_in pattern, self
|
37
|
+
|
45
38
|
equal :work_product, opts[:story].rally_object if opts[:story]
|
46
39
|
equal :risk, opts[:risk].capitalize if opts[:risk]
|
47
40
|
equal :method, opts[:method].capitalize if opts[:method]
|
@@ -58,15 +51,8 @@ module Crab
|
|
58
51
|
end
|
59
52
|
|
60
53
|
rally_stories = @rally.find(:hierarchical_requirement, :fetch => true, :project => project) do
|
61
|
-
|
62
|
-
|
63
|
-
(pattern.map(&:downcase) + pattern.map(&:capitalize)).each do |word|
|
64
|
-
contains :name, word
|
65
|
-
contains :description, word
|
66
|
-
contains :notes, word
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
54
|
+
Crab::Rally.search_for_words_in pattern, self
|
55
|
+
|
70
56
|
equal :iteration, opts[:iteration] if opts[:iteration]
|
71
57
|
equal :release, opts[:release] if opts[:release]
|
72
58
|
equal :parent, opts[:parent].rally_object if opts[:parent]
|
@@ -84,7 +70,9 @@ module Crab
|
|
84
70
|
end
|
85
71
|
|
86
72
|
def find_iteration_by_name(name, project)
|
87
|
-
@rally.find(:iteration, :project => project) { equal :name, name }.first
|
73
|
+
iteration = @rally.find(:iteration, :project => project) { equal :name, name }.first
|
74
|
+
Trollop::die "Unknown iteration \"#{name}\"" if iteration.nil?
|
75
|
+
iteration
|
88
76
|
end
|
89
77
|
|
90
78
|
def find_releases(project)
|
@@ -92,7 +80,9 @@ module Crab
|
|
92
80
|
end
|
93
81
|
|
94
82
|
def find_release_by_name(name, project)
|
95
|
-
@rally.find(:release, :project => project) { equal :name, name }.first
|
83
|
+
release = @rally.find(:release, :project => project) { equal :name, name }.first
|
84
|
+
Trollop::die "Unknown release \"#{name}\"" if release.nil?
|
85
|
+
release
|
96
86
|
end
|
97
87
|
|
98
88
|
def create_story(opts)
|
@@ -119,5 +109,18 @@ module Crab
|
|
119
109
|
Crab::TestCase.new(@rally.find(:test_case) { equal :formatted_i_d, tc_id }.first, @dry_run)
|
120
110
|
end
|
121
111
|
|
112
|
+
private
|
113
|
+
|
114
|
+
def self.search_for_words_in(pattern, query)
|
115
|
+
unless pattern.join.empty?
|
116
|
+
query._or_ do
|
117
|
+
(pattern.map(&:downcase) + pattern.map(&:capitalize)).each do |word|
|
118
|
+
contains :name, word
|
119
|
+
contains :description, word
|
120
|
+
contains :notes, word
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
122
125
|
end
|
123
126
|
end
|
data/lib/crab/version.rb
CHANGED
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:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 7
|
10
|
+
version: 0.2.7
|
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-
|
18
|
+
date: 2011-10-01 00:00:00 -03:00
|
19
19
|
default_executable: crab
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|