kosmas58-pickler 0.0.9.11 → 0.0.9.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,7 @@ class Pickler
30
30
  options << args
31
31
  define_method("option_#{args.object_id}", &block)
32
32
  end
33
-
33
+
34
34
  def self.banner_arguments(value = nil)
35
35
  if value
36
36
  @banner_arguments = value
@@ -351,6 +351,14 @@ encouraged to change.
351
351
  @includes = %w(unscheduled unstarted)
352
352
  end
353
353
 
354
+ on "--language=lang", "sets the language, defaults to 'en'" do |lang|
355
+ pickler.lang = lang
356
+ end
357
+
358
+ on "--trace", "Gives feedback when features are not valid" do
359
+ pickler.trace = true
360
+ end
361
+
354
362
  process do |*args|
355
363
  args.replace(pickler.scenario_features(@includes)) if args.empty?
356
364
  args.each do |arg|
data/lib/pickler.rb CHANGED
@@ -22,6 +22,7 @@ class Pickler
22
22
  end
23
23
 
24
24
  attr_reader :directory
25
+ attr_writer :lang, :trace
25
26
 
26
27
  def initialize(path = '.')
27
28
  @directory = File.expand_path(path)
@@ -81,6 +82,24 @@ class Pickler
81
82
  project.deliver_all_finished_stories
82
83
  end
83
84
 
85
+ def language
86
+ require 'cucumber'
87
+
88
+ @language ||= Cucumber::Parser::I18n::Language[@lang]
89
+ end
90
+
91
+ def parser
92
+ @parser ||= language.parser
93
+ end
94
+
95
+ def parse(story)
96
+ parser.parse_or_fail(story.to_s)
97
+ rescue StandardError => e
98
+ puts "Feature '#{story.name}' has not been recognized as a valid cucumber story given locale '#{@lang}' \n\t\t => #{e.inspect}\n" if @trace
99
+
100
+ false
101
+ end
102
+
84
103
  def project_id
85
104
  config["project_id"] || (self.class.config["projects"]||{})[File.basename(@directory)]
86
105
  end
@@ -99,8 +118,7 @@ class Pickler
99
118
  end
100
119
 
101
120
  def scenario_word
102
- parser
103
- Cucumber.keyword_hash['scenario']
121
+ language.scenario_keyword
104
122
  end
105
123
 
106
124
  def format
@@ -112,10 +130,10 @@ class Pickler
112
130
  end
113
131
 
114
132
  def scenario_features(excluded_states = %w(unscheduled unstarted))
115
- project.stories(scenario_word, :includedone => true).reject do |s|
116
- Array(excluded_states).map {|s| s.to_s}.include?(s.current_state)
133
+ project.stories(scenario_word, :includedone => true).reject do |story|
134
+ Array(excluded_states).map {|s| s.to_s}.include?(story.current_state)
117
135
  end.select do |s|
118
- s.to_s =~ /^\s*#{Regexp.escape(project.scenario_word)}:/ && project.parser.parse(s.to_s)
136
+ s.to_s =~ /^\s*#{Regexp.escape(scenario_word)}/ && parse(s)
119
137
  end
120
138
  end
121
139
 
data/pickler.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "pickler"
3
- s.version = "0.0.9.11"
3
+ s.version = "0.0.9.12"
4
4
  s.summary = "PIvotal traCKer Liaison to cucumbER"
5
5
  s.description = "Synchronize between Cucumber and Pivotal Tracker"
6
6
  s.authors = ["Tim Pope", "Liam Morley", "Kamal Fariz Mahyuddin", "Kosmas Schuetz"]
@@ -24,6 +24,6 @@ Gem::Specification.new do |s|
24
24
  "lib/pickler/tracker/note.rb"
25
25
  ]
26
26
  s.add_dependency("activesupport", [">= 2.0.0"])
27
- s.add_dependency("cucumber", [">= 0.3.0"])
27
+ s.add_dependency("cucumber", [">= 0.3.9"])
28
28
  s.add_dependency("nokogiri", [">= 1.3.1"])
29
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kosmas58-pickler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9.11
4
+ version: 0.0.9.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pope
@@ -33,7 +33,7 @@ dependencies:
33
33
  requirements:
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 0.3.0
36
+ version: 0.3.9
37
37
  version:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: nokogiri
@@ -70,6 +70,7 @@ files:
70
70
  - lib/pickler/tracker/note.rb
71
71
  has_rdoc: false
72
72
  homepage: http://github.com/tpope/pickler
73
+ licenses:
73
74
  post_install_message:
74
75
  rdoc_options: []
75
76
 
@@ -90,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
91
  requirements: []
91
92
 
92
93
  rubyforge_project:
93
- rubygems_version: 1.2.0
94
+ rubygems_version: 1.3.5
94
95
  signing_key:
95
96
  specification_version: 2
96
97
  summary: PIvotal traCKer Liaison to cucumbER