cukedep 0.0.6 → 0.0.7

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
- NTFmZmYzYjM3ODEyODM5Yjg4OWIxYTU2Njk2MDcyMzhiOGIwYjA2Nw==
4
+ ZTViZGY3MjYyZjAyOThlODc2YmQ4ODE1M2Y4NGI0N2IzMzliNmU5Yw==
5
5
  data.tar.gz: !binary |-
6
- ZGUyMmMxMjJhYmVmMmU1YTNmOGU3YWNjODBkMDA1OWQxOTg1MDlhMw==
6
+ ZWFkN2Y4YThkZDNiODQ4ZDczMmFkMTBhNTk4OTQ0NTMzNWZmN2FlYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZDQyNDUzMzdkYzIyZTMwMGEyNDE0ZjRjMGJiYmViODBmY2U4OWNlNDQ2NzBl
10
- ZmE3YmJhMjk1ODNkZDQ0NGRmODQ1NTZhNzU0MDUyOGZlODViMmQ1M2I4MWQ2
11
- Y2JkOGU5NjJmZWUzZDcxNmRlMzEzYWI0NzVjY2E1NjM2MzU5NDI=
9
+ MTEzZjdmYmVhNmNhMzU2MWVhMGFhYzhhYmM2NDdlOGNkOTMzNzkwYjBmNGNi
10
+ YmNkYWE5YzBlZTU4N2Y1OTJiOGI2MGRjNjg3MzMzZGFiYmUxMmRlYTQ4ZWZl
11
+ YjE0MDViOTc5M2E0ZmQxOGE2NDYzNWM5ODU5YWMwMzdlYjU1NTQ=
12
12
  data.tar.gz: !binary |-
13
- MDkxMWFiZmYzM2Q1ZTNmMWExZjcxOTA0MGRkOGRhZTljNjMzMzQ4N2U3ZDM2
14
- MWZjOTU5N2FjYmIyY2RhMDUwNmFiNjI3YTE0N2UwOTMyNjU5ZDdhYWJhMjRh
15
- YTQyNTUwMjZmOGY4NTI4YTg5ZGIyMTZjMGNlMzA5NWU0YjRlZGU=
13
+ ZjllNDM1ZDE4NGRmMWQzMGE5ZWUxYzIyMjg4ZGU2NGE1ZTg2ZWRiZWEwN2Nj
14
+ OTQ2ZGE1MTc1ZDRlNTRmZTgzYjJkZjk1Zjg3MzU2ZjE4Y2MzZmIyNjg0NDYx
15
+ OWVmMDhhMWEzYzc4YmRjNzgzM2I3YzA5NTlhOTZjNmVhZGY3NzE=
@@ -1,8 +1,11 @@
1
+ ### 0.0.7 / 2013-10-25
2
+ * [CHANGE] Method `Application#generate_files` now uses the filenames as specified in the `cukedep.yml` file.
3
+
1
4
  ### 0.0.6 / 2013-10-25
2
- * [CHANGE] Files `README.md` Added rationale text and recap paragraph.
5
+ * [CHANGE] File `README.md` Added rationale text and recap paragraph.
3
6
 
4
7
  ### 0.0.5 / 2013-10-24
5
- * [CHANGE] Files `README.md` Added section on how to specify dependencies.
8
+ * [CHANGE] File `README.md` Added section on how to specify dependencies.
6
9
 
7
10
  ### 0.0.4 / 2013-10-24
8
11
  * [CHANGE] Files `Gemfile`, `cukedep.gemspec`. Updated dependencies towards other gems.
@@ -37,7 +37,8 @@ public
37
37
  feature_files = parse_features
38
38
 
39
39
  model = FeatureModel.new(feature_files)
40
- generate_files(model)
40
+ generate_files(model, config)
41
+
41
42
  unless options[:dryrun]
42
43
  rake_cmd = 'rake -f cukedep.rake'
43
44
  system(rake_cmd)
@@ -96,7 +97,7 @@ protected
96
97
  end
97
98
 
98
99
 
99
- def generate_files(aModel)
100
+ def generate_files(aModel, aConfig)
100
101
  # Sort the feature files by dependency order.
101
102
  aModel.sort_features_by_dep
102
103
 
@@ -105,9 +106,9 @@ protected
105
106
  # Generate CSV files detailing the feature to identifier mapping
106
107
  # and vise versa
107
108
  # TODO: replace hardcoded names by value from config
108
- aModel.mapping_reports('feature2id.csv', 'id2feature.csv', true)
109
- aModel.draw_dependency_graph('dependencies.dot', true)
110
- aModel.generate_rake_tasks('cukedep.rake', proj_dir)
109
+ aModel.mapping_reports(aConfig.feature2id.name, aConfig.id2feature.name, true)
110
+ aModel.draw_dependency_graph(aConfig.graph_file.name, true)
111
+ aModel.generate_rake_tasks(aConfig.rake_file, proj_dir)
111
112
  end
112
113
  end # class
113
114
 
@@ -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.0.6'
6
+ Version = '0.0.7'
7
7
 
8
8
  # Brief description of the gem.
9
9
  Description = 'Manage dependencies between Cucumber feature files'
@@ -0,0 +1,13 @@
1
+ ---
2
+ - !ruby/struct:Sample::Video
3
+ title: The empire of Cucumber
4
+ state: :available
5
+ - !ruby/struct:Sample::Video
6
+ title: The revenge of the Cucumber
7
+ state: :available
8
+ - !ruby/struct:Sample::Video
9
+ title: The peeled Cucumber
10
+ state: :available
11
+ - !ruby/struct:Sample::Video
12
+ title: The masked Cucumber
13
+ state: :available
@@ -0,0 +1,13 @@
1
+ ---
2
+ - !ruby/struct:Sample::Member
3
+ name: John Doe
4
+ - !ruby/struct:Sample::Member
5
+ name: Jed Eye
6
+ - !ruby/struct:Sample::Member
7
+ name: Bill Bo
8
+ - !ruby/struct:Sample::Member
9
+ name: Jack Orjones
10
+ - !ruby/struct:Sample::Member
11
+ name: Mary Gherkin
12
+ - !ruby/struct:Sample::Member
13
+ name: Waldo Cuke
@@ -0,0 +1,4 @@
1
+ ---
2
+ - !ruby/struct:Sample::Rental
3
+ video: The masked Cucumber
4
+ member: John Doe
@@ -0,0 +1,7 @@
1
+ ---
2
+ - !ruby/struct:Sample::User
3
+ credential: it's me
4
+ - !ruby/struct:Sample::User
5
+ credential: himself
6
+ - !ruby/struct:Sample::User
7
+ credential: nemo
@@ -0,0 +1,191 @@
1
+ # File: cukedep.rake
2
+ # Generated by Cukedep 0.0.6 on 25/10/2013 21:52:06
3
+
4
+ require 'rake'
5
+
6
+ # Run Cucumber via specialized Rake task
7
+ require 'cucumber/rake/task'
8
+ # UGLY workaround for bug in Cucumber's rake task
9
+ if Gem::VERSION[0].to_i >= 2 && Cucumber::VERSION <= '1.3.2'
10
+ # Monkey-patch a buggy method
11
+ class Cucumber::Rake::Task::ForkedCucumberRunner
12
+ def gem_available?(gemname)
13
+ if Gem::VERSION[0].to_i >= 2
14
+ gem_available_new_rubygems?(gemname)
15
+ else
16
+ gem_available_old_rubygems?(gemname)
17
+ end
18
+ end
19
+ end # class
20
+ end
21
+
22
+ # Create a task called cucumber
23
+ Cucumber::Rake::Task.new do |t|
24
+ end
25
+
26
+
27
+ # Constant holding the location of the original feature files
28
+ SOURCE_DIR = 'C:/Ruby193/lib/ruby/site_ruby/Cukedep/spec/cukedep/sample_features'
29
+
30
+ # Constant holding the location of the project
31
+ CUKE_PROJECT = 'C:/Ruby193/lib/ruby/site_ruby/Cukedep/sample'
32
+
33
+ # Helper method. Calculate the filepath of a file with given name
34
+ # if it is located in the source dir.
35
+ def source_path_of(aFilename)
36
+ SOURCE_DIR + '/' + aFilename
37
+ end
38
+
39
+ # Helper method. Calculate the filepath of a file with given name
40
+ # if it is located in the project featurers dir.
41
+ def project_path_of(aFilename)
42
+ CUKE_PROJECT + '/features/' + aFilename
43
+ end
44
+
45
+ # Helper method. Given the name of files in the source dir, copy them
46
+ # into the project dir.
47
+ def copy_to_project(filenames)
48
+ filenames.each do |fname|
49
+ source_path = source_path_of(fname)
50
+ dest_path = project_path_of(fname)
51
+ FileUtils.copy_file(source_path, dest_path)
52
+ end
53
+ end
54
+
55
+
56
+ # Helper method. Given the name of files in the features dir of the project,
57
+ # copy them into the source dir.
58
+ def copy_from_project(*filenames)
59
+ filenames.each do |fname|
60
+ source_path = project_path_of(fname)
61
+ dest_path = source_path_of(fname)
62
+ FileUtils.copy_file(source_path, dest_path)
63
+ end
64
+ end
65
+
66
+ def del_from_project(filenames)
67
+ filenames.each do |fname|
68
+ dest_path = project_path_of(fname)
69
+ FileUtils.remove_file(dest_path)
70
+ end
71
+ end
72
+
73
+ # Helper method. Delete all the files in the
74
+ # the project's features dir that match one of
75
+ # the file name pattern
76
+ def clean_project_dir(fname_patterns)
77
+ curr_dir = Dir.getwd()
78
+ begin
79
+ Dir.chdir(CUKE_PROJECT + '/features')
80
+ fname_patterns.each do |patt|
81
+ filenames = Dir.glob(patt)
82
+ filenames.each { |fn| FileUtils.remove_file(fn) }
83
+ end
84
+ ensure #Always restore previous working dir.
85
+ Dir.chdir(curr_dir)
86
+ end
87
+ end
88
+
89
+
90
+ def process_files(filenames)
91
+ copy_to_project(filenames)
92
+ curr_dir = Dir.getwd()
93
+ Dir.chdir(CUKE_PROJECT)
94
+ begin
95
+ do_cuke = Rake::Task[:cucumber]
96
+ do_cuke.reenable
97
+ do_cuke.invoke
98
+ ensure
99
+ Dir.chdir(curr_dir)
100
+ end
101
+ del_from_project(filenames)
102
+ end
103
+
104
+ def process_a_feature(filename)
105
+ process_files([filename])
106
+ end
107
+
108
+
109
+ AllUnidentifiedFeatures = [
110
+ 'standalone.feature'
111
+ ]
112
+
113
+
114
+ AllFeatureIdentifiers = [
115
+ :qux,
116
+ :quux,
117
+ :corge,
118
+ :foo,
119
+ :baz,
120
+ :bar
121
+ ]
122
+
123
+ # Default rake task is also top-level task
124
+ task :default => :run_all_features
125
+
126
+
127
+ desc 'Run all features'
128
+ task :run_all_features => [:before_all, :all_features, :after_all] do
129
+ ; # Do nothing
130
+ end
131
+
132
+
133
+ # Remove feature files from a cuke project
134
+ task :dir_cleanup do
135
+ clean_project_dir(['*.feature'])
136
+ end
137
+
138
+
139
+
140
+ desc 'Before all'
141
+ task :before_all => [:dir_cleanup] do
142
+ ; # Do nothing
143
+ end
144
+
145
+ desc 'After_all'
146
+ task :after_all do
147
+ ; # Do nothing
148
+ end
149
+
150
+
151
+ task :unidentified do
152
+ process_files(AllUnidentifiedFeatures)
153
+ end
154
+
155
+ # Tasks for feature files involved in dependencies
156
+
157
+
158
+ task :qux do
159
+ process_a_feature('a_few_tests.feature')
160
+ end
161
+
162
+
163
+ task :quux do
164
+ process_a_feature('more_tests.feature')
165
+ end
166
+
167
+
168
+ task :corge => [:foo] do
169
+ process_a_feature('other_tests.feature')
170
+ end
171
+
172
+
173
+ task :foo => [:bar, :qux] do
174
+ process_a_feature('some_tests.feature')
175
+ end
176
+
177
+
178
+ task :baz do
179
+ process_a_feature('still_other_tests.feature')
180
+ end
181
+
182
+
183
+ task :bar => [:baz, :qux, :quux] do
184
+ process_a_feature('yet_other_tests.feature')
185
+ end
186
+
187
+
188
+ task :all_features => ([:unidentified] + AllFeatureIdentifiers) do
189
+ end
190
+
191
+ # End of file
@@ -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 Fri Oct 25 21:52:06 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,7 @@
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
@@ -0,0 +1,7 @@
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cukedep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitri Geshef
@@ -125,7 +125,11 @@ files:
125
125
  - lib/cukedep/gherkin-listener.rb
126
126
  - sample/features/step_definitions/steps.rb
127
127
  - sample/features/support/env.rb
128
+ - sample/model/catalogue.yml
129
+ - sample/model/members.yml
128
130
  - sample/model/model.rb
131
+ - sample/model/rentals.yml
132
+ - sample/model/users.yml
129
133
  - spec/cukedep/application_spec.rb
130
134
  - spec/cukedep/cli/cmd-line_spec.rb
131
135
  - spec/cukedep/feature-model_spec.rb
@@ -134,6 +138,10 @@ files:
134
138
  - spec/cukedep/gherkin-listener_spec.rb
135
139
  - spec/spec_helper.rb
136
140
  - spec/cukedep/sample_features/a_few_tests.feature
141
+ - spec/cukedep/sample_features/cukedep.rake
142
+ - spec/cukedep/sample_features/dependencies.dot
143
+ - spec/cukedep/sample_features/feature2id.csv
144
+ - spec/cukedep/sample_features/id2feature.csv
137
145
  - spec/cukedep/sample_features/more_tests.feature
138
146
  - spec/cukedep/sample_features/other_tests.feature
139
147
  - spec/cukedep/sample_features/some_tests.feature