cukedep 0.1.04 → 0.1.05

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2U1MzA1ZGE1MjhjMTYzYmM3NmQ4MzViNzUxNjBiNjQxNTMyODU1OA==
4
+ YmZmMTZlZmJkZDljYTBiYTNlM2Q4ZGNjYjIxNjU5MTIxOTliOWIyOQ==
5
5
  data.tar.gz: !binary |-
6
- MDkxZTE4MGJjYjYyYTcwMTgwYTRjMTc3MWE0YTQxMzQwZjM4ZGQ3Ng==
6
+ YmIzZDMzMjJlMTE5NTFjODNjYmE2OTI3ZjAzNDEzYzU0MzJhNGQ4NA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YWRhNTE5NTBlYzRmYTg4NWRjYjdmYmYwMDFmYjcyN2M2YmM0YzI2YjkxMGU3
10
- YTQ0YTMyOGJlYjU2NTc2ODBkZTJmN2Q1ZThlZTFhNzhhODAwYWMxOTQ0Yzc3
11
- ZGNmMmNkYjlkYTYyYWY2MjJjMTQ3NTUzNWE1ZWZhMDBjOTQ2NDY=
9
+ MGUzMWUyODkyYzU1MGE4ODMyZWJhYWZmMGVkYzI4YjMzNGUwNDdhNTAzYjRh
10
+ MzEyYTdhNTljZjMxY2I4ZWYxODZlNzc1NmYwYzcxYzA3MzAwNWUzOWI4MTU5
11
+ NzE3NTEwMDhjY2JmNzY3N2I1YmUyMDkwNGViNTczN2I5Y2EwNDg=
12
12
  data.tar.gz: !binary |-
13
- YWU3YzA2ODAzMWQ5ZjdkYTNiNzZhNzMzNjFkOGYzNWViYTgxNDg4NzAwNWJm
14
- NmE2ZWM3YmQ5NWFhOTA5ZWYxYWE3ZjczMzE0ZTU1M2Q4MTUyNDAwNTY2NDcw
15
- ZGFhMDM3ZGZiNWRhYzAwMjQ0MGYzYTkwMmI1MTgyOTc5N2Q4MzQ=
13
+ ZjE3NWYwYzIyOGY1ZTVhZjJkMGYwMGM2MDFiOGNiM2ZjNGQxMmVkNTkxMDFj
14
+ MDY3Mjg2MTljYzJjZjMxNjE2NTRjYTRjMzU3NmY3NDM1ODJkODZlZDE0NGUw
15
+ OGM4YjcxZmI0YmVkNDZlZTdmZjAyMmQyNTgxYjg1OTdmOTJhM2Q=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.1.05 / 2014-02-20
2
+ * [CHANGE] File `.rubocop.yml`. Updated, cop EmptyLinesAroundBody disabled.
3
+ * [CHANGE] Style of several /lib files improved: `feature-model`, `feature-rep`, `file-action`, `gherkin-facade`, `hook-dsl`, `sandbox`.
4
+
1
5
  ### 0.1.04 / 2013-01-14
2
6
  * [CHANGE] File `.travis.yml`. Addition of MRI Ruby 2.1.0 to Travis CI.
3
7
  * [CHANGE] File `LICENSE.txt`. Addition of 2014 in copyright year.
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Cukedep # Module used as a namespace
5
5
  # The version number of the gem.
6
- Version = '0.1.04'
6
+ Version = '0.1.05'
7
7
 
8
8
  # Brief description of the gem.
9
9
  Description = 'Manage dependencies between Cucumber feature files'
@@ -14,7 +14,7 @@ module Cukedep # This module is used as a namespace
14
14
  # See also: Is this topological sort in Ruby flawed?
15
15
  class FeatureModel
16
16
 
17
- FeatureDependencies = Struct.new(:dependee, :dependents)
17
+ FeatureDependencies = Struct.new(:dependee, :dependents)
18
18
 
19
19
  # Helper class used internally by FeatureModel class.
20
20
  # Purpose: to try to create a valid dependency graph and perform a
@@ -164,7 +164,7 @@ EOS
164
164
 
165
165
  # Output the nodes as graph vertices + their edges with parent node
166
166
  def emit_body(anIO)
167
- anIO.puts <<-EOS
167
+ anIO.puts <<-EOS
168
168
  subgraph island {
169
169
  node [shape = box, style=filled, color=lightgray];
170
170
  EOS
@@ -243,6 +243,7 @@ EOS
243
243
 
244
244
 
245
245
  protected
246
+
246
247
  def validated_model(theFeatureFiles)
247
248
  return theFeatureFiles
248
249
  end
@@ -279,7 +280,7 @@ EOS
279
280
  unless aMapping.include?(a_tag)
280
281
  msg_p1 = "Feature with identifier '#{its_id}'"
281
282
  msg_p2 = " depends on unknown feature '#{a_tag}'"
282
- fail(StandardError, msg_p1 = msg_p2)
283
+ fail(StandardError, msg_p1, msg_p2)
283
284
  end
284
285
  aMapping[a_tag]
285
286
  end
@@ -31,6 +31,7 @@ class FeatureRep
31
31
  end
32
32
 
33
33
  public
34
+
34
35
  # The list of all feature identifiers retrieved from the dependency tags
35
36
  def dependency_tags()
36
37
  dep_tags = tags.select { |t| t =~ DependencyPrefix }
@@ -19,15 +19,15 @@ class FileAction
19
19
 
20
20
 
21
21
  # Datavalue semantic: FileActions don't have identity
22
- def ==(another)
23
- return true if self.object_id == another.object_id
24
- return false if self.class != another.class
22
+ def ==(other)
23
+ return true if object_id == other.object_id
24
+ return false if self.class != other.class
25
25
 
26
26
  attrs = [:patterns, :delta]
27
27
  equality = true
28
28
 
29
29
  attrs.each do |accessor|
30
- equality = self.send(accessor) == another.send(accessor)
30
+ equality = send(accessor) == other.send(accessor)
31
31
  break unless equality
32
32
  end
33
33
 
@@ -36,10 +36,13 @@ class FileAction
36
36
 
37
37
 
38
38
  protected
39
+
39
40
  def validate_file_patterns(filePatterns)
40
- raise StandardError, 'Expecting a list of file patterns' unless filePatterns.kind_of?(Array)
41
+ err_msg = 'Expecting a list of file patterns'
42
+ fail StandardError, err_msg unless filePatterns.kind_of?(Array)
41
43
  filePatterns.each do |filePatt|
42
- raise StandardError, "Invalid value in list of file patterns: #{filePatt}" unless filePatt.kind_of?(String)
44
+ err_msg = "Invalid value in list of file patterns: #{filePatt}"
45
+ fail StandardError, err_msg unless filePatt.kind_of?(String)
43
46
  end
44
47
 
45
48
  return filePatterns
@@ -47,11 +50,11 @@ class FileAction
47
50
 
48
51
  def validate_delta(aDelta)
49
52
  case aDelta
50
- when NilClass then validated = nil
51
- when String
52
- validated = aDelta.empty? ? nil : aDelta
53
- else
54
- raise StandardError, 'Invalid relative path #{aDelta}'
53
+ when NilClass then validated = nil
54
+ when String
55
+ validated = aDelta.empty? ? nil : aDelta
56
+ else
57
+ fail StandardError, 'Invalid relative path #{aDelta}'
55
58
  end
56
59
 
57
60
  return validated
@@ -89,7 +92,7 @@ class DeleteAction < FileAction
89
92
  def run!(targetDir)
90
93
  return if patterns.empty?
91
94
  orig_dir = Dir.getwd # Store current work directory
92
- #pp orig_dir
95
+ # pp orig_dir
93
96
 
94
97
  begin
95
98
  Dir.chdir(full_path(targetDir))
@@ -103,6 +106,7 @@ class DeleteAction < FileAction
103
106
  end
104
107
 
105
108
  private
109
+
106
110
  def single_action(aFilename)
107
111
  FileUtils.remove_file(aFilename)
108
112
  end
@@ -136,6 +140,7 @@ class CopyAction < FileAction
136
140
  end
137
141
 
138
142
  private
143
+
139
144
  def single_action(aFilename, aDirectory)
140
145
  FileUtils.cp(aFilename, aDirectory)
141
146
  end
@@ -143,29 +148,34 @@ class CopyAction < FileAction
143
148
  end # class
144
149
 
145
150
 
146
- # An (file) action triplet combines three FileActions that are executed in sequence.
151
+ # An (file) action triplet combines three FileActions
152
+ # that are executed in sequence.
147
153
  class ActionTriplet
148
154
 
149
155
  attr_reader(:save_action)
150
156
  attr_reader(:delete_action)
151
157
  attr_reader(:copy_action)
152
158
 
153
- #[theActionSettings] An object that responds to the [] operator.
154
- # The argument of the operator must be: :save_patterns, :save_subdir, :delete_patterns, :delete_subdir,
159
+ # [theActionSettings] An object that responds to the [] operator.
160
+ # The argument of the operator must be:
161
+ # :save_patterns, :save_subdir, :delete_patterns, :delete_subdir,
155
162
  # :copy_patterns, :copy_subdir
156
163
  def initialize(theActionSettings)
157
- @save_action = CopyAction.new(theActionSettings[:save_patterns], theActionSettings[:save_subdir])
158
- @delete_action = DeleteAction.new(theActionSettings[:delete_patterns], theActionSettings[:delete_subdir])
159
- @copy_action = CopyAction.new(theActionSettings[:copy_patterns], theActionSettings[:copy_subdir])
164
+ @save_action = CopyAction.new(theActionSettings[:save_patterns],
165
+ theActionSettings[:save_subdir])
166
+ @delete_action = DeleteAction.new(theActionSettings[:delete_patterns],
167
+ theActionSettings[:delete_subdir])
168
+ @copy_action = CopyAction.new(theActionSettings[:copy_patterns],
169
+ theActionSettings[:copy_subdir])
160
170
  end
161
171
 
162
172
 
163
- def ==(another)
164
- return true if self.object_id == another.object_id
173
+ def ==(other)
174
+ return true if object_id == other.object_id
165
175
 
166
- return (save_action == another.save_action) &&
167
- (delete_action == another.delete_action) &&
168
- (copy_action == another.copy_action)
176
+ return (save_action == other.save_action) &&
177
+ (delete_action == other.delete_action) &&
178
+ (copy_action == other.copy_action)
169
179
  end
170
180
 
171
181
 
@@ -181,7 +191,7 @@ class ActionTriplet
181
191
  # Return nil if no triplet was found for the event.
182
192
  def self.builtin(anEvent)
183
193
  @@builtin_actions ||= {
184
- before_each: ActionTriplet.new( {
194
+ before_each: ActionTriplet.new({
185
195
  save_patterns: [],
186
196
  save_subdir: '',
187
197
  delete_patterns: ['*.feature'],
@@ -189,7 +199,7 @@ class ActionTriplet
189
199
  copy_patterns: [],
190
200
  copy_subdir: './features'
191
201
  }),
192
- after_each: ActionTriplet.new( {
202
+ after_each: ActionTriplet.new({
193
203
  save_patterns: [],
194
204
  save_subdir: '',
195
205
  delete_patterns: ['*.feature'], # Remove feature files after the run
@@ -208,4 +218,4 @@ end # class
208
218
 
209
219
  end # module
210
220
 
211
- # End of file
221
+ # End of file
@@ -38,8 +38,11 @@ module Cukedep # This module is used as a namespace
38
38
  # Parse them
39
39
  filenames.each do |fname|
40
40
  puts " #{fname}" if verbose
41
- # To prevent encoding issue, open the file with an explicit external encoding
42
- File::open(fname, "r:#{external_encoding}") { |f| parser.parse(f.read, fname, 0) }
41
+ # To prevent encoding issue, open the file
42
+ # with an explicit external encoding
43
+ File.open(fname, "r:#{external_encoding}") do |f|
44
+ parser.parse(f.read, fname, 0)
45
+ end
43
46
  end
44
47
 
45
48
  return aListener
@@ -49,4 +52,4 @@ module Cukedep # This module is used as a namespace
49
52
 
50
53
  end # module
51
54
 
52
- # End of file
55
+ # End of file
@@ -27,7 +27,7 @@ module HookDSL
27
27
  def after_cuke(aScope, &aBlock)
28
28
  kind = :after
29
29
  scope = validated_scope(kind, aScope)
30
- register_hook(kind, aScope, aBlock) if block_given?
30
+ register_hook(kind, scope, aBlock) if block_given?
31
31
  end
32
32
 
33
33
  =begin
@@ -46,18 +46,19 @@ module HookDSL
46
46
  =end
47
47
 
48
48
  private
49
+
49
50
  def register_hook(aKind, aScope, aBlock)
50
51
  scope = validated_scope(aKind, aScope)
51
52
 
52
53
  ivar = "@#{aKind}_hooks".to_sym
53
- self.instance_variable_set(ivar, {}) if self.instance_variable_get(ivar).nil?
54
- self.instance_variable_get(ivar)[scope] = aBlock
54
+ instance_variable_set(ivar, {}) if instance_variable_get(ivar).nil?
55
+ instance_variable_get(ivar)[scope] = aBlock
55
56
  end
56
57
 
57
58
  def validated_scope(aKind, aScope)
58
59
  unless ValidHookScopes.include?(aScope)
59
60
  msg = "Unknown scope '#{aScope}' for #{aKind}_cuke hook."
60
- raise StandardError, msg
61
+ fail StandardError, msg
61
62
  end
62
63
 
63
64
  return aScope
@@ -71,10 +72,11 @@ module HookDSL
71
72
  end
72
73
 
73
74
  handler = hooks.nil? ? nil : hooks.fetch(aScope)
75
+ return handler
74
76
  end
75
77
 
76
78
  end # module
77
79
 
78
80
  end # module
79
81
 
80
- # End of file
82
+ # End of file
@@ -18,4 +18,4 @@ module Cukedep # This module is used as a namespace
18
18
 
19
19
  end # module
20
20
 
21
- # End of file
21
+ # End of file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cukedep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.04
4
+ version: 0.1.05
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitri Geshef
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-14 00:00:00.000000000 Z
11
+ date: 2014-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber