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 +8 -8
- data/CHANGELOG.md +4 -0
- data/lib/cukedep/constants.rb +1 -1
- data/lib/cukedep/feature-model.rb +4 -3
- data/lib/cukedep/feature-rep.rb +1 -0
- data/lib/cukedep/file-action.rb +36 -26
- data/lib/cukedep/gherkin-facade.rb +6 -3
- data/lib/cukedep/hook-dsl.rb +7 -5
- data/lib/cukedep/sandbox.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmZmMTZlZmJkZDljYTBiYTNlM2Q4ZGNjYjIxNjU5MTIxOTliOWIyOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmIzZDMzMjJlMTE5NTFjODNjYmE2OTI3ZjAzNDEzYzU0MzJhNGQ4NA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGUzMWUyODkyYzU1MGE4ODMyZWJhYWZmMGVkYzI4YjMzNGUwNDdhNTAzYjRh
|
10
|
+
MzEyYTdhNTljZjMxY2I4ZWYxODZlNzc1NmYwYzcxYzA3MzAwNWUzOWI4MTU5
|
11
|
+
NzE3NTEwMDhjY2JmNzY3N2I1YmUyMDkwNGViNTczN2I5Y2EwNDg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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.
|
data/lib/cukedep/constants.rb
CHANGED
@@ -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
|
-
|
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
|
283
|
+
fail(StandardError, msg_p1, msg_p2)
|
283
284
|
end
|
284
285
|
aMapping[a_tag]
|
285
286
|
end
|
data/lib/cukedep/feature-rep.rb
CHANGED
data/lib/cukedep/file-action.rb
CHANGED
@@ -19,15 +19,15 @@ class FileAction
|
|
19
19
|
|
20
20
|
|
21
21
|
# Datavalue semantic: FileActions don't have identity
|
22
|
-
def ==(
|
23
|
-
return true if
|
24
|
-
return false if self.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 =
|
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
|
-
|
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
|
-
|
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
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
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:
|
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],
|
158
|
-
|
159
|
-
@
|
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 ==(
|
164
|
-
return true if
|
173
|
+
def ==(other)
|
174
|
+
return true if object_id == other.object_id
|
165
175
|
|
166
|
-
return (save_action ==
|
167
|
-
(delete_action ==
|
168
|
-
(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
|
42
|
-
|
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
|
data/lib/cukedep/hook-dsl.rb
CHANGED
@@ -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,
|
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
|
-
|
54
|
-
|
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
|
-
|
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
|
data/lib/cukedep/sandbox.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|