crab 0.2.7 → 0.2.8
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/README.md +0 -1
- data/bin/crab +27 -14
- data/bin/crab-help +10 -2
- data/bin/crab-it +25 -11
- data/bin/crab-it-help +11 -2
- data/bin/crab-it-list +25 -15
- data/bin/crab-iteration +25 -11
- data/bin/crab-iteration-help +11 -2
- data/bin/crab-iteration-list +25 -15
- data/bin/crab-login +24 -13
- data/bin/crab-logout +22 -9
- data/bin/crab-project +42 -32
- data/bin/crab-rel +25 -11
- data/bin/crab-rel-help +12 -3
- data/bin/crab-rel-list +23 -15
- data/bin/crab-release +25 -11
- data/bin/crab-release-help +12 -3
- data/bin/crab-release-list +23 -15
- data/bin/crab-st +24 -11
- data/bin/crab-st-add +18 -10
- data/bin/crab-st-change +53 -39
- data/bin/crab-st-create +18 -10
- data/bin/crab-st-del +19 -11
- data/bin/crab-st-delete +19 -11
- data/bin/crab-st-find +32 -21
- data/bin/crab-st-help +11 -2
- data/bin/crab-st-list +32 -21
- data/bin/crab-st-ls +32 -21
- data/bin/crab-st-move +26 -14
- data/bin/crab-st-mv +26 -14
- data/bin/crab-st-new +18 -10
- data/bin/crab-st-pull +28 -20
- data/bin/crab-st-ren +26 -14
- data/bin/crab-st-rename +26 -14
- data/bin/crab-st-rm +19 -11
- data/bin/crab-st-show +19 -11
- data/bin/crab-st-up +53 -39
- data/bin/crab-st-update +53 -39
- data/bin/crab-story +24 -11
- data/bin/crab-story-add +18 -10
- data/bin/crab-story-change +53 -39
- data/bin/crab-story-create +18 -10
- data/bin/crab-story-del +19 -11
- data/bin/crab-story-delete +19 -11
- data/bin/crab-story-diff +54 -0
- data/bin/crab-story-find +32 -21
- data/bin/crab-story-help +11 -2
- data/bin/crab-story-list +32 -21
- data/bin/crab-story-ls +32 -21
- data/bin/crab-story-move +26 -14
- data/bin/crab-story-mv +26 -14
- data/bin/crab-story-new +18 -10
- data/bin/crab-story-pull +28 -20
- data/bin/crab-story-ren +26 -14
- data/bin/crab-story-rename +26 -14
- data/bin/crab-story-rm +19 -11
- data/bin/crab-story-show +19 -11
- data/bin/crab-story-up +53 -39
- data/bin/crab-story-update +53 -39
- data/bin/crab-tc +24 -11
- data/bin/crab-tc-add +32 -20
- data/bin/crab-tc-change +18 -8
- data/bin/crab-tc-create +32 -20
- data/bin/crab-tc-del +18 -10
- data/bin/crab-tc-delete +18 -10
- data/bin/crab-tc-find +32 -21
- data/bin/crab-tc-help +11 -2
- data/bin/crab-tc-list +32 -21
- data/bin/crab-tc-ls +32 -21
- data/bin/crab-tc-new +32 -20
- data/bin/crab-tc-rm +18 -10
- data/bin/crab-tc-show +28 -15
- data/bin/crab-tc-up +18 -8
- data/bin/crab-tc-update +18 -8
- data/bin/crab-testcase +24 -11
- data/bin/crab-testcase-add +32 -20
- data/bin/crab-testcase-change +18 -8
- data/bin/crab-testcase-create +32 -20
- data/bin/crab-testcase-del +18 -10
- data/bin/crab-testcase-delete +18 -10
- data/bin/crab-testcase-find +32 -21
- data/bin/crab-testcase-help +11 -2
- data/bin/crab-testcase-list +32 -21
- data/bin/crab-testcase-ls +32 -21
- data/bin/crab-testcase-new +32 -20
- data/bin/crab-testcase-rm +18 -10
- data/bin/crab-testcase-show +28 -15
- data/bin/crab-testcase-up +18 -8
- data/bin/crab-testcase-update +18 -8
- data/bin/crab-truncate +1 -0
- data/bin/crab-version +2 -1
- data/features/subcommand-help.feature +1 -0
- data/lib/crab.rb +2 -0
- data/lib/crab/cucumber_to_rally_adapter.rb +48 -0
- data/lib/crab/rally.rb +21 -1
- data/lib/crab/utilities.rb +10 -2
- data/lib/crab/version.rb +1 -1
- metadata +7 -4
data/bin/crab-testcase-help
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
# vim: set ft=ruby :
|
3
|
+
require 'crab'
|
2
4
|
|
3
|
-
|
5
|
+
class Crab::TestCaseHelp
|
6
|
+
|
7
|
+
def self.run
|
8
|
+
puts <<-HELP
|
4
9
|
Usage: crab testcase <command> [options*]
|
5
10
|
|
6
11
|
Available commands:
|
@@ -14,4 +19,8 @@ Usage: crab testcase <command> [options*]
|
|
14
19
|
update Update a test case (name, priority, testing method, etc)
|
15
20
|
|
16
21
|
--help, -h: Show this message
|
17
|
-
HELP
|
22
|
+
HELP
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Crab::TestCaseHelp.run
|
data/bin/crab-testcase-list
CHANGED
@@ -1,34 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
# vim: set ft=ruby :
|
2
3
|
require 'crab'
|
3
4
|
|
4
|
-
|
5
|
+
class Crab::TestCaseFind
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
class << self
|
8
|
+
|
9
|
+
include Crab::Utilities
|
10
|
+
|
11
|
+
def run(args=ARGV)
|
12
|
+
opts = Trollop::options(args) do
|
13
|
+
banner <<-BANNER
|
8
14
|
crab testcase find: find a testcase in Rally
|
9
15
|
|
10
16
|
Usage: crab testcase find [options*] [text]
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
17
|
+
BANNER
|
18
|
+
opt :project, "Project to use (required unless set by 'crab project')", :short => "-p", :type => String
|
19
|
+
opt :story, "Limit search to testcases of this story", :short => "-s", :type => String
|
20
|
+
opt :priority, "Priority (one of: #{Crab::TestCase::PRIORITIES.join(" ")}", :short => '-P', :type => String
|
21
|
+
opt :risk, "Risk (one of: #{Crab::TestCase::RISKS.join(" ")})", :short => '-r', :type => String
|
22
|
+
opt :method, "Method (one of: #{Crab::TestCase::METHODS.join(" ")})", :short => '-m', :type => String
|
23
|
+
opt :type, "Type (one of: #{Crab::TestCase::TYPES.join(" ")})", :short => '-t', :type => String
|
24
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
25
|
+
end
|
20
26
|
|
21
|
-
pattern =
|
22
|
-
project_name = valid_project_name(opts)
|
27
|
+
pattern = args.map(&:strip).reject(&:empty?)
|
28
|
+
project_name = valid_project_name(opts)
|
23
29
|
|
24
|
-
Crab::Rally.new(opts[:dry]) do |rally|
|
25
|
-
|
26
|
-
|
30
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
31
|
+
project = rally.find_project(project_name)
|
32
|
+
Trollop::die "Project #{opts[:project].inspect} not found" if project.nil?
|
27
33
|
|
28
|
-
|
29
|
-
|
34
|
+
find_opts = {}
|
35
|
+
find_opts[:story] = rally.find_story_with_id opts[:story] if opts[:story_given]
|
30
36
|
|
31
|
-
|
32
|
-
|
37
|
+
rally.find_testcases(project, pattern, find_opts).each do |tc|
|
38
|
+
puts "#{tc.story.formatted_id}/#{tc.formatted_id}: #{tc.name} (#{tc.tags.join(" ")})"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
33
42
|
end
|
34
43
|
end
|
44
|
+
|
45
|
+
Crab::TestCaseFind.run
|
data/bin/crab-testcase-ls
CHANGED
@@ -1,34 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
# vim: set ft=ruby :
|
2
3
|
require 'crab'
|
3
4
|
|
4
|
-
|
5
|
+
class Crab::TestCaseFind
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
class << self
|
8
|
+
|
9
|
+
include Crab::Utilities
|
10
|
+
|
11
|
+
def run(args=ARGV)
|
12
|
+
opts = Trollop::options(args) do
|
13
|
+
banner <<-BANNER
|
8
14
|
crab testcase find: find a testcase in Rally
|
9
15
|
|
10
16
|
Usage: crab testcase find [options*] [text]
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
17
|
+
BANNER
|
18
|
+
opt :project, "Project to use (required unless set by 'crab project')", :short => "-p", :type => String
|
19
|
+
opt :story, "Limit search to testcases of this story", :short => "-s", :type => String
|
20
|
+
opt :priority, "Priority (one of: #{Crab::TestCase::PRIORITIES.join(" ")}", :short => '-P', :type => String
|
21
|
+
opt :risk, "Risk (one of: #{Crab::TestCase::RISKS.join(" ")})", :short => '-r', :type => String
|
22
|
+
opt :method, "Method (one of: #{Crab::TestCase::METHODS.join(" ")})", :short => '-m', :type => String
|
23
|
+
opt :type, "Type (one of: #{Crab::TestCase::TYPES.join(" ")})", :short => '-t', :type => String
|
24
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
25
|
+
end
|
20
26
|
|
21
|
-
pattern =
|
22
|
-
project_name = valid_project_name(opts)
|
27
|
+
pattern = args.map(&:strip).reject(&:empty?)
|
28
|
+
project_name = valid_project_name(opts)
|
23
29
|
|
24
|
-
Crab::Rally.new(opts[:dry]) do |rally|
|
25
|
-
|
26
|
-
|
30
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
31
|
+
project = rally.find_project(project_name)
|
32
|
+
Trollop::die "Project #{opts[:project].inspect} not found" if project.nil?
|
27
33
|
|
28
|
-
|
29
|
-
|
34
|
+
find_opts = {}
|
35
|
+
find_opts[:story] = rally.find_story_with_id opts[:story] if opts[:story_given]
|
30
36
|
|
31
|
-
|
32
|
-
|
37
|
+
rally.find_testcases(project, pattern, find_opts).each do |tc|
|
38
|
+
puts "#{tc.story.formatted_id}/#{tc.formatted_id}: #{tc.name} (#{tc.tags.join(" ")})"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
33
42
|
end
|
34
43
|
end
|
44
|
+
|
45
|
+
Crab::TestCaseFind.run
|
data/bin/crab-testcase-new
CHANGED
@@ -1,29 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
# vim: set ft=ruby :
|
2
3
|
require 'crab'
|
3
4
|
|
4
|
-
|
5
|
+
class Crab::TestCaseCreate
|
5
6
|
|
6
|
-
|
7
|
-
crab testcase create: add a test case to a story in Rally
|
7
|
+
class << self
|
8
8
|
|
9
|
-
|
10
|
-
BANNER
|
9
|
+
include Crab::Utilities
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
system "crab-testcase-help"
|
16
|
-
exit 1
|
17
|
-
end
|
11
|
+
def run(args=ARGV)
|
12
|
+
opts = add_or_update_options <<-BANNER, args
|
13
|
+
crab testcase create: add a test case to a story in Rally
|
18
14
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
15
|
+
Usage: crab testcase create <story> <name> [options*]
|
16
|
+
BANNER
|
17
|
+
|
18
|
+
story_id = args.shift
|
19
|
+
unless story_id
|
20
|
+
logger.error "Error: Story ID not provided."
|
21
|
+
system "crab-testcase-help"
|
22
|
+
exit 1
|
23
|
+
end
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
name = args.join(" ")
|
26
|
+
unless name
|
27
|
+
logger.error "Error: Test case name not provided."
|
28
|
+
system "crab-testcase-help"
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
|
32
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
33
|
+
tc = rally.create_test_case(story_id, name, sanitize_options(opts))
|
34
|
+
puts "#{tc.story.formatted_id}/#{tc.formatted_id}: #{tc.name} (#{tc.tags.join(" ")})"
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
29
39
|
end
|
40
|
+
|
41
|
+
Crab::TestCaseCreate.run
|
data/bin/crab-testcase-rm
CHANGED
@@ -1,18 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
# vim: set ft=ruby :
|
2
3
|
require 'crab'
|
3
4
|
|
4
|
-
|
5
|
-
|
5
|
+
class Crab::TestCaseDelete
|
6
|
+
|
7
|
+
def self.run(args=ARGV)
|
8
|
+
Trollop::options(args) do
|
9
|
+
banner <<-BANNER
|
6
10
|
crab testcase delete: delete a test case in Rally
|
7
11
|
|
8
12
|
Usage: crab testcase delete <id> [options*]
|
9
|
-
BANNER
|
10
|
-
|
11
|
-
end
|
13
|
+
BANNER
|
14
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
15
|
+
end
|
12
16
|
|
13
|
-
tc_id =
|
14
|
-
Crab::Rally.new(opts[:dry]) do |rally|
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
tc_id = args.shift
|
18
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
19
|
+
tc = rally.find_test_case(tc_id)
|
20
|
+
tc.delete
|
21
|
+
puts "Test case #{tc_id} deleted."
|
22
|
+
end
|
23
|
+
end
|
18
24
|
end
|
25
|
+
|
26
|
+
Crab::TestCaseDelete.run
|
data/bin/crab-testcase-show
CHANGED
@@ -1,24 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
# vim: set ft=ruby :
|
2
3
|
require 'crab'
|
3
4
|
|
4
|
-
|
5
|
-
|
5
|
+
class Crab::TestCaseShow
|
6
|
+
|
7
|
+
class << self
|
8
|
+
|
9
|
+
include Crab::Utilities
|
10
|
+
|
11
|
+
def run(args=ARGV)
|
12
|
+
opts = Trollop::options(args) do
|
13
|
+
banner <<-BANNER
|
6
14
|
crab testcase show: displays a testcase in Rally as a Cucumber scenario
|
7
15
|
|
8
16
|
Usage: crab testcase show <id> [options*]"
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
17
|
+
BANNER
|
18
|
+
opt :language, "Language to display Cucumber features in (ISO code)", :default => "en", :short => "-l"
|
19
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
20
|
+
end
|
13
21
|
|
14
|
-
id =
|
15
|
-
unless id
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
22
|
+
id = args.shift
|
23
|
+
unless id
|
24
|
+
logger.error "Error: No test case ID provided."
|
25
|
+
system "crab-testcase-help"
|
26
|
+
exit 1
|
27
|
+
end
|
20
28
|
|
21
|
-
Crab::Rally.new(opts[:dry]) do |rally|
|
22
|
-
|
23
|
-
|
29
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
30
|
+
tc = rally.find_test_case id
|
31
|
+
puts Crab::CucumberScenario.new(opts[:language]).generate_from(tc).strip
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
24
35
|
end
|
36
|
+
|
37
|
+
Crab::TestCaseShow.run
|
data/bin/crab-testcase-up
CHANGED
@@ -1,18 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
# vim: set ft=ruby :
|
2
3
|
require 'crab'
|
3
4
|
|
4
|
-
|
5
|
+
class Crab::TestCaseUpdate
|
5
6
|
|
6
|
-
|
7
|
+
class << self
|
8
|
+
include Crab::Utilities
|
9
|
+
|
10
|
+
def run(args=ARGV)
|
11
|
+
opts = add_or_update_options <<-BANNER, args
|
7
12
|
crab testcase update: update a test case in Rally
|
8
13
|
|
9
14
|
Usage: crab testcase update <id> [options*]
|
10
|
-
BANNER
|
15
|
+
BANNER
|
11
16
|
|
12
|
-
tc_id =
|
17
|
+
tc_id = args.shift
|
13
18
|
|
14
|
-
Crab::Rally.new(opts[:dry]) do |rally|
|
15
|
-
|
16
|
-
|
17
|
-
|
19
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
20
|
+
tc = rally.find_test_case(tc_id)
|
21
|
+
tc.update(sanitize_options(opts))
|
22
|
+
puts "#{tc.story.formatted_id}/#{tc.formatted_id}: #{tc.name} (#{tc.tags.join(" ")})"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
18
26
|
end
|
27
|
+
|
28
|
+
Crab::TestCaseUpdate.run
|
data/bin/crab-testcase-update
CHANGED
@@ -1,18 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
# vim: set ft=ruby :
|
2
3
|
require 'crab'
|
3
4
|
|
4
|
-
|
5
|
+
class Crab::TestCaseUpdate
|
5
6
|
|
6
|
-
|
7
|
+
class << self
|
8
|
+
include Crab::Utilities
|
9
|
+
|
10
|
+
def run(args=ARGV)
|
11
|
+
opts = add_or_update_options <<-BANNER, args
|
7
12
|
crab testcase update: update a test case in Rally
|
8
13
|
|
9
14
|
Usage: crab testcase update <id> [options*]
|
10
|
-
BANNER
|
15
|
+
BANNER
|
11
16
|
|
12
|
-
tc_id =
|
17
|
+
tc_id = args.shift
|
13
18
|
|
14
|
-
Crab::Rally.new(opts[:dry]) do |rally|
|
15
|
-
|
16
|
-
|
17
|
-
|
19
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
20
|
+
tc = rally.find_test_case(tc_id)
|
21
|
+
tc.update(sanitize_options(opts))
|
22
|
+
puts "#{tc.story.formatted_id}/#{tc.formatted_id}: #{tc.name} (#{tc.tags.join(" ")})"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
18
26
|
end
|
27
|
+
|
28
|
+
Crab::TestCaseUpdate.run
|
data/bin/crab-truncate
CHANGED
data/bin/crab-version
CHANGED
@@ -30,6 +30,7 @@ Feature: Subcommand Help
|
|
30
30
|
| story create | Usage: crab story create <name> [options*] |
|
31
31
|
| story update | Usage: crab story update <id> [options*] |
|
32
32
|
| story delete | Usage: crab story delete <id> [options*] |
|
33
|
+
| story diff | Usage: crab story diff <file> [file*] [options*] |
|
33
34
|
| story find | Usage: crab story find [options*] [text] |
|
34
35
|
| story move | Usage: crab story move <id> [options*] |
|
35
36
|
| story pull | Usage: crab story pull <id> [id*] [options*] |
|
data/lib/crab.rb
CHANGED
@@ -3,6 +3,7 @@ require "crab/version"
|
|
3
3
|
# common dependencies
|
4
4
|
require 'active_support/all'
|
5
5
|
require 'fileutils'
|
6
|
+
require 'gherkin'
|
6
7
|
require 'gherkin/i18n'
|
7
8
|
require 'highline/import'
|
8
9
|
require 'rally_rest_api'
|
@@ -14,6 +15,7 @@ require "crab/utilities"
|
|
14
15
|
require "crab/rally"
|
15
16
|
require "crab/story"
|
16
17
|
require "crab/testcase"
|
18
|
+
require "crab/cucumber_to_rally_adapter"
|
17
19
|
|
18
20
|
# cucumber support
|
19
21
|
require "crab/cucumber_feature"
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class Crab::CucumberToRallyAdapter
|
2
|
+
|
3
|
+
def initialize(feature_text, feature_file)
|
4
|
+
@scenarios = []
|
5
|
+
@steps = ActiveSupport::OrderedHash.new []
|
6
|
+
|
7
|
+
parser = Gherkin::Parser::Parser.new(self, false, "root", false)
|
8
|
+
parser.parse feature_text, feature_file, 0
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_reader :scenarios, :steps
|
12
|
+
|
13
|
+
# Rally compat
|
14
|
+
def story_id
|
15
|
+
@feature.name.match(/^\[([^\]]+)\](.*)$/)
|
16
|
+
$1.strip
|
17
|
+
end
|
18
|
+
|
19
|
+
def name
|
20
|
+
@feature.name.match(/^\[([^\]]+)\](.*)$/)
|
21
|
+
$2.strip
|
22
|
+
end
|
23
|
+
|
24
|
+
def description
|
25
|
+
@feature.description.gsub(/^\n/, '')
|
26
|
+
end
|
27
|
+
|
28
|
+
# Cucumber compat
|
29
|
+
def uri(uri)
|
30
|
+
@uri
|
31
|
+
end
|
32
|
+
|
33
|
+
def feature(feature)
|
34
|
+
@feature = feature
|
35
|
+
end
|
36
|
+
|
37
|
+
def scenario(scenario)
|
38
|
+
@scenarios << scenario
|
39
|
+
end
|
40
|
+
|
41
|
+
def step(step)
|
42
|
+
@steps[@scenarios.last] += Array(step)
|
43
|
+
end
|
44
|
+
|
45
|
+
def eof
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|