cukedep 0.0.8 → 0.1.03
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 +8 -8
- data/CHANGELOG.md +26 -0
- data/bin/cukedep +1 -1
- data/lib/cukedep/application.rb +7 -7
- data/lib/cukedep/config.rb +64 -7
- data/lib/cukedep/constants.rb +5 -1
- data/lib/cukedep/cuke-runner.rb +202 -0
- data/lib/cukedep/customization.rb +35 -0
- data/lib/cukedep/feature-rep.rb +2 -2
- data/lib/cukedep/file-action.rb +211 -0
- data/lib/cukedep/hook-dsl.rb +80 -0
- data/lib/cukedep/sandbox.rb +21 -0
- data/sample/cucumber.yml +4 -0
- data/sample/model/catalogue.yml +13 -0
- data/sample/model/members.yml +13 -0
- data/sample/model/model.rb +2 -2
- data/sample/model/rentals.yml +4 -0
- data/sample/model/users.yml +7 -0
- data/sample/result.html +472 -0
- data/spec/cukedep/application_spec.rb +8 -8
- data/spec/cukedep/cuke-runner_spec.rb +80 -0
- data/spec/cukedep/customization_spec.rb +36 -0
- data/spec/cukedep/file-action_spec.rb +374 -0
- data/spec/cukedep/gherkin-facade_spec.rb +54 -0
- data/spec/cukedep/hook-dsl_spec.rb +185 -0
- data/spec/cukedep/sample_features/cukedep.rake +204 -0
- data/spec/cukedep/sample_features/cukedep_hooks.rb +30 -0
- data/spec/cukedep/sample_features/dependencies.dot +38 -0
- data/spec/cukedep/sample_features/feature2id.csv +7 -0
- data/spec/cukedep/sample_features/files_to_copy/README.md +12 -0
- data/spec/cukedep/sample_features/files_to_copy/file1.txt +5 -0
- data/spec/cukedep/sample_features/files_to_copy/file2.txt +5 -0
- data/spec/cukedep/sample_features/files_to_copy/file3.txt +9 -0
- data/spec/spec_helper.rb +1 -0
- data/templates/rake.erb +184 -160
- metadata +26 -2
@@ -0,0 +1,38 @@
|
|
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 Wed Nov 27 23:12:50 2013.
|
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
|
@@ -0,0 +1,12 @@
|
|
1
|
+
== README.md
|
2
|
+
Besides this file, the directory contains
|
3
|
+
three sample text files:
|
4
|
+
- file1.txt
|
5
|
+
- file2.txt
|
6
|
+
- file3.txt
|
7
|
+
|
8
|
+
|
9
|
+
They contain random text generated from a 'Ipsum lorem' text generator.
|
10
|
+
|
11
|
+
All these files are used for testing purposes.
|
12
|
+
|
@@ -0,0 +1,5 @@
|
|
1
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean accumsan nulla urna, ut luctus tellus
|
2
|
+
sollicitudin id. Aliquam ut ipsum ut neque malesuada sagittis et at nisi. In hac habitasse platea dictumst. In
|
3
|
+
hac habitasse platea dictumst. Vestibulum vulputate elit quis mattis malesuada. Etiam rutrum porttitor orci, vel
|
4
|
+
fringilla sapien mattis rhoncus. Pellentesque nec porttitor lorem. Aliquam erat volutpat. Nullam ut dui vitae
|
5
|
+
velit fermentum fermentum. Nulla nisi urna, vulputate a vehicula sed, rhoncus ut ipsum.
|
@@ -0,0 +1,5 @@
|
|
1
|
+
Aenean quis lectus sed dui suscipit egestas. Proin eleifend venenatis odio a iaculis. Nam lobortis fermentum
|
2
|
+
mauris, id adipiscing elit iaculis vitae. Curabitur sed placerat risus, tristique fringilla nisi. Pellentesque
|
3
|
+
congue ante ligula, sed tempor nisi laoreet nec. Proin rhoncus pretium dui sed mattis. Nulla at nisl interdum,
|
4
|
+
luctus dolor eget, venenatis lorem. Pellentesque laoreet aliquet pulvinar. Suspendisse id augue at mauris
|
5
|
+
euismod dignissim nec vitae dolor.
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Sed eu ligula quis quam sollicitudin cursus. Aenean porta lacinia lectus id laoreet. Donec semper pellentesque
|
2
|
+
dui nec tristique. Pellentesque at lacus commodo, volutpat urna ut, sollicitudin tellus. Phasellus elementum
|
3
|
+
auctor adipiscing. Aenean leo nibh, hendrerit vitae vehicula ut, molestie non leo. Vestibulum libero nisi,
|
4
|
+
consequat ac orci in, condimentum dignissim massa. Suspendisse id justo nec magna mattis posuere eu sed felis.
|
5
|
+
Fusce aliquam facilisis odio, congue vulputate sem. Vivamus ultrices est non porttitor mattis. Nam dignissim
|
6
|
+
egestas nisi sit amet fringilla. Maecenas scelerisque sit amet nunc vel elementum. Proin fermentum, justo
|
7
|
+
egestas euismod ornare, lorem ipsum rhoncus diam, sit amet suscipit metus orci at dui. Mauris suscipit, urna id
|
8
|
+
tempor tempor, augue augue suscipit nunc, eget mattis mi sem id metus. Fusce eu ipsum sapien. Nullam vitae
|
9
|
+
volutpat lorem.
|
data/spec/spec_helper.rb
CHANGED
data/templates/rake.erb
CHANGED
@@ -1,161 +1,185 @@
|
|
1
|
-
# File: <%=rakefile%>
|
2
|
-
# Generated by Cukedep <%=Cukedep::Version%> on <%=Time.now.strftime('%d/%m/%Y %H:%M:%S')%>
|
3
|
-
|
4
|
-
require 'rake'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
#
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
Cucumber
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
#
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
#
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
# the file name
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
end
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
task
|
154
|
-
|
155
|
-
end
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
1
|
+
# File: <%=rakefile%>
|
2
|
+
# Generated by Cukedep <%=Cukedep::Version%> on <%=Time.now.strftime('%d/%m/%Y %H:%M:%S')%>
|
3
|
+
|
4
|
+
require 'rake'
|
5
|
+
|
6
|
+
<%require 'pathname'
|
7
|
+
# In case of development version, use classes from the project direct
|
8
|
+
# Otherwise rely on code from gem.
|
9
|
+
rake_dir = Pathname.new(Dir.getwd)
|
10
|
+
cukedep_dir = Pathname.new(Cukedep::RootDir).realdirpath
|
11
|
+
development_env = nil # Will be true iff w. dir is child of Cukedep project dir.
|
12
|
+
rake_dir.ascend do |a_parent|
|
13
|
+
development_env = true if a_parent.realdirpath == cukedep_dir
|
14
|
+
end
|
15
|
+
if development_env
|
16
|
+
rel_path = cukedep_dir.relative_path_from(rake_dir)%>
|
17
|
+
# Use development codebase
|
18
|
+
require_relative '<%=rel_path.to_s + '/lib/cukedep/file-action'%>'
|
19
|
+
<% else%>
|
20
|
+
require 'cukedep/file-action'
|
21
|
+
<% end%>
|
22
|
+
|
23
|
+
# Run Cucumber via specialized Rake task
|
24
|
+
require 'cucumber/rake/task'
|
25
|
+
# UGLY workaround for bug in Cucumber's rake task
|
26
|
+
if Gem::VERSION[0].to_i >= 2 && Cucumber::VERSION <= '1.3.2'
|
27
|
+
# Monkey-patch a buggy method
|
28
|
+
class Cucumber::Rake::Task::ForkedCucumberRunner
|
29
|
+
def gem_available?(gemname)
|
30
|
+
if Gem::VERSION[0].to_i >= 2
|
31
|
+
gem_available_new_rubygems?(gemname)
|
32
|
+
else
|
33
|
+
gem_available_old_rubygems?(gemname)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end # class
|
37
|
+
end
|
38
|
+
|
39
|
+
# Create a task called cucumber
|
40
|
+
Cucumber::Rake::Task.new do |t|
|
41
|
+
end
|
42
|
+
|
43
|
+
#######################################
|
44
|
+
# Retrieving state at end of Cukedep::Application#run! method
|
45
|
+
#######################################
|
46
|
+
|
47
|
+
# Constant holding the location of the original feature files
|
48
|
+
SOURCE_DIR = '<%=source_dir%>'
|
49
|
+
|
50
|
+
# Constant holding the location of the Cucumber project
|
51
|
+
CUKE_PROJECT = '<%=proj_dir%>'
|
52
|
+
|
53
|
+
# The list of all "legacy" feature file (feature files without the @feature: tag)
|
54
|
+
AllUnidentifiedFeatures = [<%anonymous_list = anonymous.map { |name| "'#{name}'"}%>
|
55
|
+
<%=anonymous_list.join(",\n ")%>
|
56
|
+
]
|
57
|
+
|
58
|
+
# The list of all encountered feature ids
|
59
|
+
AllFeatureIdentifiers = [ <%identifier_list = feature_ids.map {|f_id| ":#{f_id}"}%>
|
60
|
+
<%=identifier_list.join(",\n ")%>
|
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
|
+
<%deps.each do |dep|%>
|
175
|
+
<%dep_list = dep.dependents.map { |ff| ":#{ff.feature.identifier}" } %>
|
176
|
+
desc "<%=dep.dependee.feature.identifier%>: run <%=dep.dependee.basename%>"
|
177
|
+
task :<%=dep.dependee.feature.identifier%> <%= dep_list.empty? ? '' : %Q|=> [#{dep_list.join(', ') }]| %> do
|
178
|
+
process_a_feature('<%=dep.dependee.basename%>')
|
179
|
+
end
|
180
|
+
<%end%>
|
181
|
+
|
182
|
+
task :all_features => ([:unidentified] + AllFeatureIdentifiers) do
|
183
|
+
end
|
184
|
+
|
161
185
|
# 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.
|
4
|
+
version: 0.1.03
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitri Geshef
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -120,27 +120,51 @@ files:
|
|
120
120
|
- lib/cukedep/cli/cmd-line.rb
|
121
121
|
- lib/cukedep/config.rb
|
122
122
|
- lib/cukedep/constants.rb
|
123
|
+
- lib/cukedep/cuke-runner.rb
|
124
|
+
- lib/cukedep/customization.rb
|
123
125
|
- lib/cukedep/feature-model.rb
|
124
126
|
- lib/cukedep/feature-rep.rb
|
127
|
+
- lib/cukedep/file-action.rb
|
125
128
|
- lib/cukedep/gherkin-facade.rb
|
126
129
|
- lib/cukedep/gherkin-listener.rb
|
130
|
+
- lib/cukedep/hook-dsl.rb
|
131
|
+
- lib/cukedep/sandbox.rb
|
132
|
+
- sample/cucumber.yml
|
127
133
|
- sample/features/step_definitions/steps.rb
|
128
134
|
- sample/features/support/env.rb
|
135
|
+
- sample/model/catalogue.yml
|
136
|
+
- sample/model/members.yml
|
129
137
|
- sample/model/model.rb
|
138
|
+
- sample/model/rentals.yml
|
139
|
+
- sample/model/users.yml
|
140
|
+
- sample/result.html
|
130
141
|
- spec/cukedep/application_spec.rb
|
131
142
|
- spec/cukedep/cli/cmd-line_spec.rb
|
143
|
+
- spec/cukedep/cuke-runner_spec.rb
|
144
|
+
- spec/cukedep/customization_spec.rb
|
132
145
|
- spec/cukedep/feature-model_spec.rb
|
133
146
|
- spec/cukedep/feature-rep_spec.rb
|
147
|
+
- spec/cukedep/file-action_spec.rb
|
134
148
|
- spec/cukedep/file-parsing.rb
|
149
|
+
- spec/cukedep/gherkin-facade_spec.rb
|
135
150
|
- spec/cukedep/gherkin-listener_spec.rb
|
151
|
+
- spec/cukedep/hook-dsl_spec.rb
|
152
|
+
- spec/cukedep/sample_features/cukedep_hooks.rb
|
136
153
|
- spec/spec_helper.rb
|
137
154
|
- spec/cukedep/sample_features/a_few_tests.feature
|
155
|
+
- spec/cukedep/sample_features/cukedep.rake
|
156
|
+
- spec/cukedep/sample_features/dependencies.dot
|
157
|
+
- spec/cukedep/sample_features/feature2id.csv
|
138
158
|
- spec/cukedep/sample_features/more_tests.feature
|
139
159
|
- spec/cukedep/sample_features/other_tests.feature
|
140
160
|
- spec/cukedep/sample_features/some_tests.feature
|
141
161
|
- spec/cukedep/sample_features/standalone.feature
|
142
162
|
- spec/cukedep/sample_features/still_other_tests.feature
|
143
163
|
- spec/cukedep/sample_features/yet_other_tests.feature
|
164
|
+
- spec/cukedep/sample_features/files_to_copy/file1.txt
|
165
|
+
- spec/cukedep/sample_features/files_to_copy/file2.txt
|
166
|
+
- spec/cukedep/sample_features/files_to_copy/file3.txt
|
167
|
+
- spec/cukedep/sample_features/files_to_copy/README.md
|
144
168
|
- templates/rake.erb
|
145
169
|
homepage: https://github.com/famished-tiger/Cukedep
|
146
170
|
licenses:
|