cukedep 0.1.11 → 0.2.00
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.
- checksums.yaml +6 -14
- data/.ruby-version +1 -1
- data/.travis.yml +10 -10
- data/CHANGELOG.md +6 -0
- data/Gemfile +5 -5
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/Rakefile +30 -30
- data/bin/cukedep +15 -15
- data/lib/cukedep/application.rb +105 -112
- data/lib/cukedep/cli/cmd-line.rb +11 -13
- data/lib/cukedep/config.rb +85 -89
- data/lib/cukedep/constants.rb +5 -5
- data/lib/cukedep/cuke-runner.rb +191 -198
- data/lib/cukedep/customization.rb +30 -30
- data/lib/cukedep/feature-model.rb +43 -46
- data/lib/cukedep/feature-rep.rb +9 -11
- data/lib/cukedep/file-action.rb +11 -18
- data/lib/cukedep/gherkin-facade.rb +11 -6
- data/lib/cukedep/gherkin-listener.rb +12 -42
- data/lib/cukedep/hook-dsl.rb +78 -78
- data/lib/cukedep/sandbox.rb +15 -16
- data/lib/cukedep.rb +1 -2
- data/sample/features/step_definitions/steps.rb +2 -2
- data/sample/model/model.rb +19 -20
- data/spec/cukedep/application_spec.rb +80 -80
- data/spec/cukedep/cli/cmd-line_spec.rb +88 -88
- data/spec/cukedep/cuke-runner_spec.rb +74 -74
- data/spec/cukedep/customization_spec.rb +31 -31
- data/spec/cukedep/debug-file-action.rb +29 -29
- data/spec/cukedep/feature-model_spec.rb +100 -100
- data/spec/cukedep/feature-rep_spec.rb +2 -1
- data/spec/cukedep/file-action_spec.rb +365 -366
- data/spec/cukedep/file-parsing.rb +39 -41
- data/spec/cukedep/gherkin-facade_spec.rb +48 -49
- data/spec/cukedep/gherkin-listener_spec.rb +55 -57
- data/spec/cukedep/hook-dsl_spec.rb +182 -182
- data/spec/cukedep/sample_features/cukedep_hooks.rb +30 -30
- data/spec/cukedep/sample_features/standalone.feature +1 -1
- data/templates/rake.erb +12 -21
- metadata +80 -58
- data/sample/result.html +0 -472
- data/spec/cukedep/sample_features/cukedep.rake +0 -215
- data/spec/cukedep/sample_features/dependencies.dot +0 -38
- data/spec/cukedep/sample_features/feature2id.csv +0 -7
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
# File: cukedep.rake
|
|
2
|
-
# Generated by Cukedep 0.1.11 on 18/06/2015 21:34:32
|
|
3
|
-
|
|
4
|
-
require 'rake'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
# Use development codebase
|
|
8
|
-
require_relative '../../../lib/cukedep/file-action'
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
# Run Cucumber via specialized Rake task
|
|
12
|
-
require 'cucumber/rake/task'
|
|
13
|
-
# UGLY workaround for bug in Cucumber's rake task
|
|
14
|
-
if Gem::VERSION[0].to_i >= 2 && Cucumber::VERSION <= '1.3.2'
|
|
15
|
-
# Monkey-patch a buggy method
|
|
16
|
-
module Cucumber
|
|
17
|
-
module Rake
|
|
18
|
-
module Task
|
|
19
|
-
class ForkedCucumberRunner
|
|
20
|
-
def gem_available?(gemname)
|
|
21
|
-
if Gem::VERSION[0].to_i >= 2
|
|
22
|
-
gem_available_new_rubygems?(gemname)
|
|
23
|
-
else
|
|
24
|
-
gem_available_old_rubygems?(gemname)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end # class
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Create a task called cucumber
|
|
34
|
-
Cucumber::Rake::Task.new do |_|
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
#######################################
|
|
38
|
-
# Retrieving state at end of Cukedep::Application#run! method
|
|
39
|
-
#######################################
|
|
40
|
-
|
|
41
|
-
# Constant holding the location of the original feature files
|
|
42
|
-
SOURCE_DIR = 'C:/Ruby193/lib/ruby/site_ruby/Cukedep/spec/cukedep/sample_features'
|
|
43
|
-
|
|
44
|
-
# Constant holding the location of the Cucumber project
|
|
45
|
-
CUKE_PROJECT = 'C:/Ruby193/lib/ruby/site_ruby/Cukedep/sample'
|
|
46
|
-
|
|
47
|
-
# The list of all "legacy" feature file
|
|
48
|
-
# (feature files without the @feature: tag)
|
|
49
|
-
AllUnidentifiedFeatures = [
|
|
50
|
-
'standalone.feature'
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
# The list of all encountered feature ids
|
|
54
|
-
AllFeatureIdentifiers = [
|
|
55
|
-
:qux,
|
|
56
|
-
:quux,
|
|
57
|
-
:corge,
|
|
58
|
-
:foo,
|
|
59
|
-
:baz,
|
|
60
|
-
:bar
|
|
61
|
-
]
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def run_builtin_actions(anEvent)
|
|
65
|
-
actions = Cukedep::ActionTriplet.builtin(anEvent)
|
|
66
|
-
actions.run!(SOURCE_DIR, CUKE_PROJECT) unless actions.nil?
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
# Helper method. Calculate the filepath of a file with given name
|
|
70
|
-
# if it is located in the source dir.
|
|
71
|
-
def source_path_of(aFilename)
|
|
72
|
-
SOURCE_DIR + '/' + aFilename
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
# Helper method. Calculate the filepath of a file with given name
|
|
76
|
-
# if it is located in the project features dir.
|
|
77
|
-
def project_path_of(aFilename)
|
|
78
|
-
CUKE_PROJECT + '/features/' + aFilename
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
# Helper method. Given the name of files in the source dir, copy them
|
|
82
|
-
# into the project dir.
|
|
83
|
-
def copy_to_project(filenames)
|
|
84
|
-
filenames.each do |fname|
|
|
85
|
-
source_path = source_path_of(fname)
|
|
86
|
-
dest_path = project_path_of(fname)
|
|
87
|
-
FileUtils.copy_file(source_path, dest_path)
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
# Helper method. Given the name of files in the features dir of the project,
|
|
93
|
-
# copy them into the source dir.
|
|
94
|
-
def copy_from_project(*filenames)
|
|
95
|
-
filenames.each do |fname|
|
|
96
|
-
source_path = project_path_of(fname)
|
|
97
|
-
dest_path = source_path_of(fname)
|
|
98
|
-
FileUtils.copy_file(source_path, dest_path)
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
# Helper method. Delete all the files in the
|
|
103
|
-
# the project's features dir that match one of
|
|
104
|
-
# the file name pattern
|
|
105
|
-
def clean_project_dir(fname_patterns)
|
|
106
|
-
curr_dir = Dir.getwd
|
|
107
|
-
begin
|
|
108
|
-
Dir.chdir(CUKE_PROJECT + '/features')
|
|
109
|
-
fname_patterns.each do |patt|
|
|
110
|
-
filenames = Dir.glob(patt)
|
|
111
|
-
filenames.each { |fn| FileUtils.remove_file(fn) }
|
|
112
|
-
end
|
|
113
|
-
ensure # Always restore previous working dir.
|
|
114
|
-
Dir.chdir(curr_dir)
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
# Helper method. Invoke Cucumber with the given project root dir.
|
|
120
|
-
# Assumption: all features files to execute are placed
|
|
121
|
-
# in the appropriate folder.
|
|
122
|
-
def invoke_cuke(projectDir)
|
|
123
|
-
curr_dir = Dir.getwd
|
|
124
|
-
Dir.chdir(projectDir)
|
|
125
|
-
begin
|
|
126
|
-
do_cuke = Rake::Task[:cucumber]
|
|
127
|
-
do_cuke.reenable
|
|
128
|
-
do_cuke.invoke
|
|
129
|
-
ensure
|
|
130
|
-
Dir.chdir(curr_dir)
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
def process_files(filenames)
|
|
136
|
-
run_builtin_actions(:before_each)
|
|
137
|
-
copy_to_project(filenames)
|
|
138
|
-
invoke_cuke(CUKE_PROJECT)
|
|
139
|
-
run_builtin_actions(:after_each)
|
|
140
|
-
# del_from_project(filenames)
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
def process_a_feature(filename)
|
|
144
|
-
process_files([filename])
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
# Default rake task is also top-level task
|
|
149
|
-
task default: :run_all_features
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
desc 'Run all features'
|
|
153
|
-
task run_all_features: [:before_all, :all_features, :after_all] do
|
|
154
|
-
; # Do nothing
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
desc 'Before all'
|
|
159
|
-
task :before_all do
|
|
160
|
-
run_builtin_actions(:before_all)
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
desc 'After_all'
|
|
164
|
-
task :after_all do
|
|
165
|
-
run_builtin_actions(:after_all)
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
task :unidentified do
|
|
170
|
-
process_files(AllUnidentifiedFeatures)
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
# Tasks for feature files involved in dependencies
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
desc 'qux: run a_few_tests.feature'
|
|
177
|
-
task qux do
|
|
178
|
-
process_a_feature('a_few_tests.feature')
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
desc 'quux: run more_tests.feature'
|
|
183
|
-
task quux do
|
|
184
|
-
process_a_feature('more_tests.feature')
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
desc 'corge: run other_tests.feature'
|
|
189
|
-
task corge: [:foo] do
|
|
190
|
-
process_a_feature('other_tests.feature')
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
desc 'foo: run some_tests.feature'
|
|
195
|
-
task foo: [:bar, :qux] do
|
|
196
|
-
process_a_feature('some_tests.feature')
|
|
197
|
-
end
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
desc 'baz: run still_other_tests.feature'
|
|
201
|
-
task baz do
|
|
202
|
-
process_a_feature('still_other_tests.feature')
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
desc 'bar: run yet_other_tests.feature'
|
|
207
|
-
task bar: [:baz, :qux, :quux] do
|
|
208
|
-
process_a_feature('yet_other_tests.feature')
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
task all_features: ([:unidentified] + AllFeatureIdentifiers) do
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
# End of file
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// Graph of dependencies of feature files in directory:
|
|
2
|
-
// 'C:/Ruby193/lib/ruby/site_ruby/Cukedep/spec/cukedep/sample_features'
|
|
3
|
-
// This file uses the DOT syntax, a free utility from the Graphviz toolset.
|
|
4
|
-
// Graphviz is available at: www.graphviz.org
|
|
5
|
-
// File generated on Thu Jun 18 21:34:32 2015.
|
|
6
|
-
|
|
7
|
-
digraph g {
|
|
8
|
-
size = "7, 11"; // Dimensions in inches...
|
|
9
|
-
center = true;
|
|
10
|
-
rankdir = BT; // Draw from bottom to top
|
|
11
|
-
label = "\nDependency graph of 'C:/Ruby193/lib/ruby/site_ruby/Cukedep/spec/cukedep/sample_features'";
|
|
12
|
-
|
|
13
|
-
// Nodes represent feature files
|
|
14
|
-
subgraph island {
|
|
15
|
-
node [shape = box, style=filled, color=lightgray];
|
|
16
|
-
node_4 [label = "standalone"];
|
|
17
|
-
label = "Isolated features";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
subgraph dependencies {
|
|
21
|
-
node [shape = box, fillcolor = none];
|
|
22
|
-
node_0 [label = "a_few_tests -- qux"];
|
|
23
|
-
node_1 [label = "more_tests -- quux"];
|
|
24
|
-
node_2 [label = "other_tests -- corge"];
|
|
25
|
-
node_3 [label = "some_tests -- foo"];
|
|
26
|
-
node_5 [label = "still_other_tests -- baz"];
|
|
27
|
-
node_6 [label = "yet_other_tests -- bar"];
|
|
28
|
-
label = "Dependencies";
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// The edges represent dependencies
|
|
32
|
-
node_2 -> node_3;
|
|
33
|
-
node_3 -> node_6;
|
|
34
|
-
node_3 -> node_0;
|
|
35
|
-
node_6 -> node_5;
|
|
36
|
-
node_6 -> node_0;
|
|
37
|
-
node_6 -> node_1;
|
|
38
|
-
} // End of graph
|