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.
Files changed (45) hide show
  1. checksums.yaml +6 -14
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +10 -10
  4. data/CHANGELOG.md +6 -0
  5. data/Gemfile +5 -5
  6. data/LICENSE.txt +1 -1
  7. data/README.md +1 -1
  8. data/Rakefile +30 -30
  9. data/bin/cukedep +15 -15
  10. data/lib/cukedep/application.rb +105 -112
  11. data/lib/cukedep/cli/cmd-line.rb +11 -13
  12. data/lib/cukedep/config.rb +85 -89
  13. data/lib/cukedep/constants.rb +5 -5
  14. data/lib/cukedep/cuke-runner.rb +191 -198
  15. data/lib/cukedep/customization.rb +30 -30
  16. data/lib/cukedep/feature-model.rb +43 -46
  17. data/lib/cukedep/feature-rep.rb +9 -11
  18. data/lib/cukedep/file-action.rb +11 -18
  19. data/lib/cukedep/gherkin-facade.rb +11 -6
  20. data/lib/cukedep/gherkin-listener.rb +12 -42
  21. data/lib/cukedep/hook-dsl.rb +78 -78
  22. data/lib/cukedep/sandbox.rb +15 -16
  23. data/lib/cukedep.rb +1 -2
  24. data/sample/features/step_definitions/steps.rb +2 -2
  25. data/sample/model/model.rb +19 -20
  26. data/spec/cukedep/application_spec.rb +80 -80
  27. data/spec/cukedep/cli/cmd-line_spec.rb +88 -88
  28. data/spec/cukedep/cuke-runner_spec.rb +74 -74
  29. data/spec/cukedep/customization_spec.rb +31 -31
  30. data/spec/cukedep/debug-file-action.rb +29 -29
  31. data/spec/cukedep/feature-model_spec.rb +100 -100
  32. data/spec/cukedep/feature-rep_spec.rb +2 -1
  33. data/spec/cukedep/file-action_spec.rb +365 -366
  34. data/spec/cukedep/file-parsing.rb +39 -41
  35. data/spec/cukedep/gherkin-facade_spec.rb +48 -49
  36. data/spec/cukedep/gherkin-listener_spec.rb +55 -57
  37. data/spec/cukedep/hook-dsl_spec.rb +182 -182
  38. data/spec/cukedep/sample_features/cukedep_hooks.rb +30 -30
  39. data/spec/cukedep/sample_features/standalone.feature +1 -1
  40. data/templates/rake.erb +12 -21
  41. metadata +80 -58
  42. data/sample/result.html +0 -472
  43. data/spec/cukedep/sample_features/cukedep.rake +0 -215
  44. data/spec/cukedep/sample_features/dependencies.dot +0 -38
  45. 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
@@ -1,7 +0,0 @@
1
- identifier,feature file
2
- qux,a_few_tests.feature
3
- quux,more_tests.feature
4
- corge,other_tests.feature
5
- foo,some_tests.feature
6
- baz,still_other_tests.feature
7
- bar,yet_other_tests.feature