scrab 0.0.1.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/scrab CHANGED
@@ -22,13 +22,16 @@ opt_parser = OptionParser.new do |o|
22
22
  end
23
23
 
24
24
  opt_parser.parse!
25
-
26
25
  command_name = ARGV.shift
27
26
 
27
+ if command_name.nil?
28
+ puts opt_parser
29
+ exit
30
+ end
31
+
28
32
  begin
29
- command = Scrab::CommandFactory.get(command_name, STDOUT)
33
+ command = Scrab.command(command_name, STDOUT)
30
34
  command.run(options, *ARGV)
31
35
  rescue Scrab::StandardError => e
32
36
  puts e.message
33
- puts opt_parser
34
37
  end
data/lib/scrab.rb CHANGED
@@ -3,21 +3,23 @@ Bundler.setup(:default)
3
3
 
4
4
  require "rally_rest_api"
5
5
  require "gherkin"
6
- require "scrab/version"
7
- require "scrab/command_set"
8
- require "scrab/rally"
9
- require "scrab/story"
10
- require "scrab/scenario"
11
- require "scrab/step"
12
- require "scrab/feature_parser"
13
6
 
14
7
  module Scrab
15
8
  class StandardError < ::StandardError; end
9
+ Commands = Module.new
10
+
11
+ def self.lib_path
12
+ @lib_path ||= Pathname.new(File.dirname(__FILE__) + "/scrab")
13
+ end
14
+
15
+ def self.commands_path
16
+ @commands_path ||= lib_path.join('commands')
17
+ end
16
18
 
17
- LibPath = Pathname.new(File.dirname(__FILE__) + "/scrab")
18
- CommandsPath = LibPath.join('commands')
19
- Commands = Module.new
20
- CommandFactory = CommandSet.new(Commands, CommandsPath)
19
+ def self.command(command, out)
20
+ @command_factory ||= CommandSet.new(Commands, self.commands_path)
21
+ @command_factory.get(command, out)
22
+ end
21
23
 
22
24
  def self.rally_config_path
23
25
  "#{ENV['HOME']}/.rally"
@@ -36,3 +38,11 @@ module Scrab
36
38
  @logger ||= Logger.new(File.dirname(__FILE__) + "/../logs/rally.log")
37
39
  end
38
40
  end
41
+
42
+ require "scrab/version"
43
+ require "scrab/command_set"
44
+ require "scrab/rally"
45
+ require "scrab/story"
46
+ require "scrab/scenario"
47
+ require "scrab/step"
48
+ require "scrab/feature_parser"
@@ -1,5 +1,5 @@
1
1
  class Scrab::CommandSet
2
- class CommandNotFoundError < StandardError
2
+ class CommandNotFoundError < Scrab::StandardError
3
3
  def initialize(command_name)
4
4
  super "Command not found: #{command_name}"
5
5
  end
@@ -16,6 +16,8 @@ class Scrab::Commands::Push
16
16
  else
17
17
  @out.puts "FAILED."
18
18
  end
19
+ rescue Scrab::Rally::StoryNotFoundError
20
+ @out.puts "NOT FOUND."
19
21
  rescue Scrab::FeatureParser::ParsingError => e
20
22
  @out.puts "Failed to parse '#{feature}':\n\t#{e.message}"
21
23
  end
@@ -1,5 +1,5 @@
1
1
  class Scrab::FeatureParser
2
- class ParsingError < StandardError
2
+ class ParsingError < Scrab::StandardError
3
3
  def initialize(line, desc)
4
4
  super "Couldn't parse '#{line}': #{desc}"
5
5
  end
data/lib/scrab/rally.rb CHANGED
@@ -1,9 +1,15 @@
1
1
  class Scrab::Rally
2
- class ProjectNotFoundError < StandardError
2
+ class ProjectNotFoundError < Scrab::StandardError
3
3
  def initialize(project)
4
4
  super "Project '#{project}' not found"
5
5
  end
6
6
  end
7
+
8
+ class StoryNotFoundError < Scrab::StandardError
9
+ def initialize(story)
10
+ super "Story '#{story.id}' not found"
11
+ end
12
+ end
7
13
 
8
14
  def initialize(options)
9
15
  @conn = RallyRestAPI.new(options)
@@ -18,6 +24,7 @@ class Scrab::Rally
18
24
  private
19
25
  def update_story(story)
20
26
  rest_object = @conn.find(:hierarchical_requirement, :pagesize => 1, :project => @project) { equal :formatted_i_d, story.id }.first
27
+ raise StoryNotFoundError.new(story) if rest_object.nil?
21
28
  @conn.update(rest_object, :name => story.name, :description => story.narrative)
22
29
  update_story_scenarios(rest_object, story.scenarios)
23
30
  end
data/lib/scrab/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scrab
2
- VERSION = "0.0.1.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,9 @@
1
+ Feature: [US0000] Non existing story
2
+ As a user
3
+ I want to do something
4
+ So that that something is done
5
+
6
+ Scenario: User does something
7
+ Given the user exists
8
+ When he does something
9
+ Then something is done
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
16
- requirement: &70205489955580 !ruby/object:Gem::Requirement
16
+ requirement: &70311929389920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70205489955580
24
+ version_requirements: *70311929389920
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rally_rest_api
27
- requirement: &70205489955140 !ruby/object:Gem::Requirement
27
+ requirement: &70311929389480 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70205489955140
35
+ version_requirements: *70311929389480
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: gherkin
38
- requirement: &70205489954720 !ruby/object:Gem::Requirement
38
+ requirement: &70311929389060 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70205489954720
46
+ version_requirements: *70311929389060
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70205489954300 !ruby/object:Gem::Requirement
49
+ requirement: &70311929388640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70205489954300
57
+ version_requirements: *70311929388640
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard
60
- requirement: &70205489953880 !ruby/object:Gem::Requirement
60
+ requirement: &70311929388220 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70205489953880
68
+ version_requirements: *70311929388220
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-rspec
71
- requirement: &70205489953460 !ruby/object:Gem::Requirement
71
+ requirement: &70311929387800 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70205489953460
79
+ version_requirements: *70311929387800
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rb-fsevent
82
- requirement: &70205489953040 !ruby/object:Gem::Requirement
82
+ requirement: &70311929387380 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70205489953040
90
+ version_requirements: *70311929387380
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: growl_notify
93
- requirement: &70205489952620 !ruby/object:Gem::Requirement
93
+ requirement: &70311929386960 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70205489952620
101
+ version_requirements: *70311929386960
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: fakeweb
104
- requirement: &70205489952200 !ruby/object:Gem::Requirement
104
+ requirement: &70311929386540 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70205489952200
112
+ version_requirements: *70311929386540
113
113
  description: Simple tool for pushing cucumber features into Rally testcases
114
114
  email:
115
115
  - divoxx@gmail.com
@@ -137,6 +137,7 @@ files:
137
137
  - scrab.gemspec
138
138
  - spec/acceptance/pushing_story_spec.rb
139
139
  - spec/fixtures/invalid-name.feature
140
+ - spec/fixtures/non-existing-story.feature
140
141
  - spec/fixtures/story.feature
141
142
  - spec/objects/command_set_spec.rb
142
143
  - spec/objects/commands/push_spec.rb
@@ -175,6 +176,7 @@ summary: Simple tool for pushing cucumber features into Rally testcases
175
176
  test_files:
176
177
  - spec/acceptance/pushing_story_spec.rb
177
178
  - spec/fixtures/invalid-name.feature
179
+ - spec/fixtures/non-existing-story.feature
178
180
  - spec/fixtures/story.feature
179
181
  - spec/objects/command_set_spec.rb
180
182
  - spec/objects/commands/push_spec.rb