cuke_modeler 2.1.0 → 3.4.0

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 (146) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +53 -1
  3. data/README.md +14 -16
  4. data/cuke_modeler.gemspec +33 -21
  5. data/lib/cuke_modeler.rb +2 -1
  6. data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +13 -0
  7. data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +13 -0
  8. data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +13 -0
  9. data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +13 -0
  10. data/lib/cuke_modeler/adapters/gherkin_14_adapter.rb +13 -0
  11. data/lib/cuke_modeler/adapters/gherkin_15_adapter.rb +13 -0
  12. data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +356 -4
  13. data/lib/cuke_modeler/containing.rb +41 -89
  14. data/lib/cuke_modeler/described.rb +40 -1
  15. data/lib/cuke_modeler/models/background.rb +12 -12
  16. data/lib/cuke_modeler/models/cell.rb +14 -8
  17. data/lib/cuke_modeler/models/comment.rb +6 -6
  18. data/lib/cuke_modeler/models/directory.rb +14 -18
  19. data/lib/cuke_modeler/models/doc_string.rb +11 -8
  20. data/lib/cuke_modeler/models/example.rb +64 -46
  21. data/lib/cuke_modeler/models/feature.rb +38 -20
  22. data/lib/cuke_modeler/models/feature_file.rb +6 -8
  23. data/lib/cuke_modeler/models/model.rb +2 -1
  24. data/lib/cuke_modeler/models/outline.rb +20 -15
  25. data/lib/cuke_modeler/models/row.rb +11 -8
  26. data/lib/cuke_modeler/models/rule.rb +101 -0
  27. data/lib/cuke_modeler/models/scenario.rb +18 -13
  28. data/lib/cuke_modeler/models/step.rb +41 -19
  29. data/lib/cuke_modeler/models/table.rb +10 -7
  30. data/lib/cuke_modeler/models/tag.rb +10 -6
  31. data/lib/cuke_modeler/named.rb +5 -1
  32. data/lib/cuke_modeler/nested.rb +22 -18
  33. data/lib/cuke_modeler/parsed.rb +8 -0
  34. data/lib/cuke_modeler/parsing.rb +55 -74
  35. data/lib/cuke_modeler/sourceable.rb +8 -0
  36. data/lib/cuke_modeler/stepped.rb +8 -0
  37. data/lib/cuke_modeler/taggable.rb +9 -1
  38. data/lib/cuke_modeler/version.rb +1 -1
  39. data/testing/cucumber/features/modeling/feature_modeling.feature +28 -7
  40. data/testing/cucumber/features/modeling/feature_output.feature +45 -23
  41. data/testing/cucumber/features/modeling/rule_modeling.feature +108 -0
  42. data/testing/cucumber/features/modeling/rule_output.feature +111 -0
  43. metadata +68 -161
  44. data/.gitignore +0 -18
  45. data/.simplecov +0 -7
  46. data/.travis.yml +0 -81
  47. data/Gemfile +0 -44
  48. data/Rakefile +0 -73
  49. data/appveyor.yml +0 -88
  50. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +0 -274
  51. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +0 -297
  52. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +0 -309
  53. data/lib/cuke_modeler/adapters/gherkin_5_adapter.rb +0 -12
  54. data/lib/cuke_modeler/adapters/gherkin_6_adapter.rb +0 -310
  55. data/lib/cuke_modeler/adapters/gherkin_7_adapter.rb +0 -307
  56. data/lib/cuke_modeler/adapters/gherkin_8_adapter.rb +0 -12
  57. data/testing/cucumber/step_definitions/action_steps.rb +0 -13
  58. data/testing/cucumber/step_definitions/background_steps.rb +0 -1
  59. data/testing/cucumber/step_definitions/directory_steps.rb +0 -6
  60. data/testing/cucumber/step_definitions/doc_string_steps.rb +0 -1
  61. data/testing/cucumber/step_definitions/feature_file_steps.rb +0 -16
  62. data/testing/cucumber/step_definitions/feature_steps.rb +0 -7
  63. data/testing/cucumber/step_definitions/modeling_steps.rb +0 -49
  64. data/testing/cucumber/step_definitions/setup_steps.rb +0 -32
  65. data/testing/cucumber/step_definitions/step_steps.rb +0 -3
  66. data/testing/cucumber/step_definitions/table_steps.rb +0 -1
  67. data/testing/cucumber/step_definitions/tag_steps.rb +0 -3
  68. data/testing/cucumber/step_definitions/verification_steps.rb +0 -181
  69. data/testing/cucumber/support/env.rb +0 -30
  70. data/testing/dialect_helper.rb +0 -48
  71. data/testing/file_helper.rb +0 -47
  72. data/testing/gemfiles/gherkin2.gemfile +0 -33
  73. data/testing/gemfiles/gherkin3.gemfile +0 -26
  74. data/testing/gemfiles/gherkin4.gemfile +0 -27
  75. data/testing/gemfiles/gherkin5.gemfile +0 -27
  76. data/testing/gemfiles/gherkin6.gemfile +0 -10
  77. data/testing/gemfiles/gherkin7.gemfile +0 -9
  78. data/testing/gemfiles/gherkin8.gemfile +0 -9
  79. data/testing/gemfiles/gherkin9.gemfile +0 -9
  80. data/testing/helper_methods.rb +0 -23
  81. data/testing/rspec/spec/integration/adapters/gherkin_2_adapter_spec.rb +0 -166
  82. data/testing/rspec/spec/integration/adapters/gherkin_3_adapter_spec.rb +0 -166
  83. data/testing/rspec/spec/integration/adapters/gherkin_4_adapter_spec.rb +0 -165
  84. data/testing/rspec/spec/integration/adapters/gherkin_5_adapter_spec.rb +0 -165
  85. data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +0 -159
  86. data/testing/rspec/spec/integration/adapters/gherkin_7_adapter_spec.rb +0 -162
  87. data/testing/rspec/spec/integration/adapters/gherkin_8_adapter_spec.rb +0 -162
  88. data/testing/rspec/spec/integration/adapters/gherkin_9_adapter_spec.rb +0 -162
  89. data/testing/rspec/spec/integration/models/background_integration_spec.rb +0 -438
  90. data/testing/rspec/spec/integration/models/cell_integration_spec.rb +0 -338
  91. data/testing/rspec/spec/integration/models/comment_integration_spec.rb +0 -180
  92. data/testing/rspec/spec/integration/models/directory_integration_spec.rb +0 -218
  93. data/testing/rspec/spec/integration/models/doc_string_integration_spec.rb +0 -398
  94. data/testing/rspec/spec/integration/models/example_integration_spec.rb +0 -753
  95. data/testing/rspec/spec/integration/models/feature_file_integration_spec.rb +0 -276
  96. data/testing/rspec/spec/integration/models/feature_integration_spec.rb +0 -655
  97. data/testing/rspec/spec/integration/models/model_integration_spec.rb +0 -15
  98. data/testing/rspec/spec/integration/models/outline_integration_spec.rb +0 -619
  99. data/testing/rspec/spec/integration/models/row_integration_spec.rb +0 -303
  100. data/testing/rspec/spec/integration/models/scenario_integration_spec.rb +0 -475
  101. data/testing/rspec/spec/integration/models/step_integration_spec.rb +0 -573
  102. data/testing/rspec/spec/integration/models/table_integration_spec.rb +0 -333
  103. data/testing/rspec/spec/integration/models/tag_integration_spec.rb +0 -271
  104. data/testing/rspec/spec/integration/nested_integration_spec.rb +0 -91
  105. data/testing/rspec/spec/integration/parsing_integration_spec.rb +0 -143
  106. data/testing/rspec/spec/integration/shared/models_integration_specs.rb +0 -18
  107. data/testing/rspec/spec/spec_helper.rb +0 -129
  108. data/testing/rspec/spec/unit/cuke_modeler_unit_spec.rb +0 -25
  109. data/testing/rspec/spec/unit/described_unit_spec.rb +0 -23
  110. data/testing/rspec/spec/unit/models/background_unit_spec.rb +0 -83
  111. data/testing/rspec/spec/unit/models/cell_unit_spec.rb +0 -68
  112. data/testing/rspec/spec/unit/models/comment_unit_spec.rb +0 -68
  113. data/testing/rspec/spec/unit/models/directory_unit_spec.rb +0 -127
  114. data/testing/rspec/spec/unit/models/doc_string_unit_spec.rb +0 -100
  115. data/testing/rspec/spec/unit/models/example_unit_spec.rb +0 -133
  116. data/testing/rspec/spec/unit/models/feature_file_unit_spec.rb +0 -125
  117. data/testing/rspec/spec/unit/models/feature_unit_spec.rb +0 -157
  118. data/testing/rspec/spec/unit/models/model_unit_spec.rb +0 -15
  119. data/testing/rspec/spec/unit/models/outline_unit_spec.rb +0 -117
  120. data/testing/rspec/spec/unit/models/row_unit_spec.rb +0 -68
  121. data/testing/rspec/spec/unit/models/scenario_unit_spec.rb +0 -86
  122. data/testing/rspec/spec/unit/models/step_unit_spec.rb +0 -109
  123. data/testing/rspec/spec/unit/models/table_unit_spec.rb +0 -77
  124. data/testing/rspec/spec/unit/models/tag_unit_spec.rb +0 -68
  125. data/testing/rspec/spec/unit/named_unit_spec.rb +0 -23
  126. data/testing/rspec/spec/unit/nested_unit_spec.rb +0 -43
  127. data/testing/rspec/spec/unit/parsed_unit_spec.rb +0 -27
  128. data/testing/rspec/spec/unit/parsing_unit_spec.rb +0 -54
  129. data/testing/rspec/spec/unit/shared/bare_bones_models_unit_specs.rb +0 -14
  130. data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +0 -127
  131. data/testing/rspec/spec/unit/shared/described_models_unit_specs.rb +0 -38
  132. data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +0 -58
  133. data/testing/rspec/spec/unit/shared/models_unit_specs.rb +0 -15
  134. data/testing/rspec/spec/unit/shared/named_models_unit_specs.rb +0 -39
  135. data/testing/rspec/spec/unit/shared/nested_models_unit_specs.rb +0 -51
  136. data/testing/rspec/spec/unit/shared/parsed_models_unit_specs.rb +0 -39
  137. data/testing/rspec/spec/unit/shared/prepopulated_models_unit_specs.rb +0 -18
  138. data/testing/rspec/spec/unit/shared/sourced_models_unit_specs.rb +0 -39
  139. data/testing/rspec/spec/unit/shared/stepped_models_unit_specs.rb +0 -46
  140. data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +0 -18
  141. data/testing/rspec/spec/unit/shared/tagged_models_unit_specs.rb +0 -72
  142. data/testing/rspec/spec/unit/sourceable_unit_spec.rb +0 -27
  143. data/testing/rspec/spec/unit/stepped_unit_spec.rb +0 -23
  144. data/testing/rspec/spec/unit/taggable_unit_spec.rb +0 -69
  145. data/testing/test_languages.json +0 -45
  146. data/todo.txt +0 -25
data/.gitignore DELETED
@@ -1,18 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- .idea/*
data/.simplecov DELETED
@@ -1,7 +0,0 @@
1
- SimpleCov.start do
2
- root File.dirname(__FILE__)
3
-
4
- add_filter '/testing/'
5
-
6
- merge_timeout 300
7
- end
@@ -1,81 +0,0 @@
1
- os:
2
- - linux
3
- - osx
4
-
5
- # JRuby isn't working on the new default distribution
6
- dist: trusty
7
-
8
- language: ruby
9
- rvm:
10
- - 1.8.7
11
- - 1.9.3
12
- - 2.3.8
13
- - 2.4.5
14
- - 2.5.3
15
- - 2.6.0
16
- - jruby-9.1.7.0
17
-
18
- gemfile:
19
- - testing/gemfiles/gherkin2.gemfile
20
- - testing/gemfiles/gherkin3.gemfile
21
- - testing/gemfiles/gherkin4.gemfile
22
- - testing/gemfiles/gherkin5.gemfile
23
- - testing/gemfiles/gherkin6.gemfile
24
- - testing/gemfiles/gherkin7.gemfile
25
- - testing/gemfiles/gherkin8.gemfile
26
- - testing/gemfiles/gherkin9.gemfile
27
-
28
- matrix:
29
- exclude:
30
-
31
- # gherkin 3.x+ does not work with Ruby 1.8.x
32
- - rvm: 1.8.7
33
- gemfile: testing/gemfiles/gherkin3.gemfile
34
- - rvm: 1.8.7
35
- gemfile: testing/gemfiles/gherkin4.gemfile
36
- - rvm: 1.8.7
37
- gemfile: testing/gemfiles/gherkin5.gemfile
38
- - rvm: 1.8.7
39
- gemfile: testing/gemfiles/gherkin6.gemfile
40
- - rvm: 1.8.7
41
- gemfile: testing/gemfiles/gherkin7.gemfile
42
- - rvm: 1.8.7
43
- gemfile: testing/gemfiles/gherkin8.gemfile
44
- - rvm: 1.8.7
45
- gemfile: testing/gemfiles/gherkin9.gemfile
46
-
47
- # gherkin 6.x+ does not work with Ruby 1.9.x
48
- - rvm: 1.9.3
49
- gemfile: testing/gemfiles/gherkin6.gemfile
50
- - rvm: 1.9.3
51
- gemfile: testing/gemfiles/gherkin7.gemfile
52
- - rvm: 1.9.3
53
- gemfile: testing/gemfiles/gherkin8.gemfile
54
- - rvm: 1.9.3
55
- gemfile: testing/gemfiles/gherkin9.gemfile
56
-
57
- # TODO: turn this back on
58
- # gherkin 6.x+ relies on 'google-protobuf', which does not currently work on JRuby (https://github.com/protocolbuffers/protobuf/issues/1594)
59
- - rvm: jruby-9.1.7.0
60
- gemfile: testing/gemfiles/gherkin6.gemfile
61
- - rvm: jruby-9.1.7.0
62
- gemfile: testing/gemfiles/gherkin7.gemfile
63
- - rvm: jruby-9.1.7.0
64
- gemfile: testing/gemfiles/gherkin8.gemfile
65
- - rvm: jruby-9.1.7.0
66
- gemfile: testing/gemfiles/gherkin9.gemfile
67
-
68
- # Travis does not provide 1.8.7 on OSX
69
- - rvm: 1.8.7
70
- os: osx
71
- # Travis does not provide 1.9.3 on OSX
72
- - rvm: 1.9.3
73
- os: osx
74
- # Ruby 2.3.x is currently broken on TravisCI for OSX and is no longer a supported Ruby version, anyway.
75
- - rvm: 2.3.8
76
- os: osx
77
-
78
- before_install:
79
- - gem install bundler -v '< 2'
80
-
81
- script: bundle exec rake cuke_modeler:ci_build
data/Gemfile DELETED
@@ -1,44 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- # Specify your gem's dependencies in cuke_modeler.gemspec
4
- gemspec
5
-
6
- # cuke_modeler can play with pretty much any version of these but they all play differently with Ruby
7
-
8
- if RUBY_VERSION =~ /^1\./
9
-
10
- if RbConfig::CONFIG['host_os'].downcase =~ /mswin|msys|mingw32/
11
- gem 'ffi', '< 1.9.15' # The 'ffi' gem, for Windows, requires Ruby 2.x on/after this version
12
- end
13
-
14
- gem 'unf_ext', '< 0.0.7.3' # Requires Ruby 2.x on/after this version
15
- gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
16
- gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
17
- gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
18
-
19
- if RUBY_VERSION =~ /^1\.8/
20
- gem 'cucumber', '~> 1.0' # Ruby 1.8.x support dropped after this version
21
- gem 'gherkin', '< 2.12.1' # Ruby 1.8.x support dropped after this version
22
- gem 'rainbow', '< 2.0' # Ruby 1.8.x support dropped after this version
23
- gem 'rake', '< 11.0' # Ruby 1.8.x support dropped after this version
24
- gem 'mime-types', '< 2.0' # Ruby 1.8.x support dropped after this version
25
- else
26
- gem 'rake', '< 12.3.0' # Ruby 1.9.x support dropped after this version
27
- gem 'cucumber', '< 3.0.0' # Ruby 1.9.x support dropped after this version
28
- gem 'rainbow', '< 3.0' # Ruby 1.9.x support dropped after this version
29
- gem 'mime-types', '< 3.0' # Ruby 1.x support dropped after this version
30
- end
31
-
32
- gem 'simplecov', '< 0.18' # Ruby 1.x support dropped after this version
33
- gem 'thor', '< 1.0' # Ruby 1.x support dropped after this version
34
- elsif RUBY_VERSION =~ /^2\./
35
-
36
- if RUBY_VERSION =~ /^2\.[23456789]/
37
- gem 'test-unit'
38
- end
39
-
40
- end
41
-
42
- # Note: When testing against 6.x, the latest version (6.0.17) is missing an executable for Windows 64-bit
43
- # gem 'gherkin', '>= 6.0', '< 6.0.17'
44
- gem 'gherkin', '~> 9.0'
data/Rakefile DELETED
@@ -1,73 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require 'rake'
3
- require 'racatt'
4
- require 'coveralls/rake/task'
5
- require 'rainbow'
6
-
7
-
8
- Rainbow.enabled = true
9
-
10
- namespace 'racatt' do
11
- Racatt.create_tasks
12
- end
13
-
14
-
15
- namespace 'cuke_modeler' do
16
-
17
- desc 'Removes the current code coverage data'
18
- task :clear_coverage do
19
- code_coverage_directory = "#{File.dirname(__FILE__)}/coverage"
20
-
21
- FileUtils.remove_dir(code_coverage_directory, true)
22
- end
23
-
24
- desc 'Check documentation with RDoc'
25
- task :check_documentation do
26
- output = `rdoc lib -C`
27
- puts output
28
-
29
- if output =~ /100.00% documented/
30
- puts Rainbow('All code documented').green
31
- else
32
- raise Rainbow('Parts of the gem are undocumented').red
33
- end
34
- end
35
-
36
- desc 'Run all of the tests'
37
- task :test_everything => [:clear_coverage] do
38
- rspec_args = '--tag ~@wip --pattern "testing/rspec/spec/**/*_spec.rb" --force-color'
39
-
40
- cucumber_version = Gem.loaded_specs['cucumber'].version.version
41
-
42
- if cucumber_version =~ /^[123]\./
43
- cucumber_args = 'testing/cucumber/features -r testing/cucumber/support -r testing/cucumber/step_definitions -f progress -t ~@wip --color'
44
- else
45
- cucumber_args = "testing/cucumber/features -r testing/cucumber/support -r testing/cucumber/step_definitions -f progress -t 'not @wip' --color"
46
- end
47
-
48
- Rake::Task['racatt:test_everything'].invoke(rspec_args, cucumber_args)
49
- end
50
-
51
- # creates coveralls:push task
52
- Coveralls::RakeTask.new
53
-
54
- desc 'The task that CI will run. Do not run locally.'
55
- task :ci_build => ['cuke_modeler:test_everything', 'coveralls:push']
56
-
57
- desc 'Check that things look good before trying to release'
58
- task :prerelease_check do
59
- begin
60
- Rake::Task['cuke_modeler:test_everything'].invoke
61
- Rake::Task['cuke_modeler:check_documentation'].invoke
62
- rescue => e
63
- puts Rainbow("Something isn't right!").red
64
- raise e
65
- end
66
-
67
- puts Rainbow('All is well. :)').green
68
- end
69
-
70
- end
71
-
72
-
73
- task :default => 'cuke_modeler:test_everything'
@@ -1,88 +0,0 @@
1
- version: '1.0.{build}'
2
-
3
- environment:
4
- matrix:
5
-
6
- # Gherkin 2.x does not appear to support 32-bit Ruby 2.x and it's not worth it to investigate if this is true or not
7
- - RUBY_VERSION: 24-x64
8
- BUNDLE_GEMFILE: testing/gemfiles/gherkin2.gemfile
9
- - RUBY_VERSION: 25-x64
10
- BUNDLE_GEMFILE: testing/gemfiles/gherkin2.gemfile
11
-
12
- - RUBY_VERSION: 24
13
- BUNDLE_GEMFILE: testing/gemfiles/gherkin3.gemfile
14
- - RUBY_VERSION: 24-x64
15
- BUNDLE_GEMFILE: testing/gemfiles/gherkin3.gemfile
16
- - RUBY_VERSION: 25
17
- BUNDLE_GEMFILE: testing/gemfiles/gherkin3.gemfile
18
- - RUBY_VERSION: 25-x64
19
- BUNDLE_GEMFILE: testing/gemfiles/gherkin3.gemfile
20
-
21
- - RUBY_VERSION: 24
22
- BUNDLE_GEMFILE: testing/gemfiles/gherkin4.gemfile
23
- - RUBY_VERSION: 24-x64
24
- BUNDLE_GEMFILE: testing/gemfiles/gherkin4.gemfile
25
- - RUBY_VERSION: 25
26
- BUNDLE_GEMFILE: testing/gemfiles/gherkin4.gemfile
27
- - RUBY_VERSION: 25-x64
28
- BUNDLE_GEMFILE: testing/gemfiles/gherkin4.gemfile
29
-
30
- - RUBY_VERSION: 24
31
- BUNDLE_GEMFILE: testing/gemfiles/gherkin5.gemfile
32
- - RUBY_VERSION: 24-x64
33
- BUNDLE_GEMFILE: testing/gemfiles/gherkin5.gemfile
34
- - RUBY_VERSION: 25
35
- BUNDLE_GEMFILE: testing/gemfiles/gherkin5.gemfile
36
- - RUBY_VERSION: 25-x64
37
- BUNDLE_GEMFILE: testing/gemfiles/gherkin5.gemfile
38
-
39
- # Gherkin 6.x+ requires at least Ruby 2.2
40
- - RUBY_VERSION: 24
41
- BUNDLE_GEMFILE: testing/gemfiles/gherkin6.gemfile
42
- - RUBY_VERSION: 24-x64
43
- BUNDLE_GEMFILE: testing/gemfiles/gherkin6.gemfile
44
- - RUBY_VERSION: 25
45
- BUNDLE_GEMFILE: testing/gemfiles/gherkin6.gemfile
46
- - RUBY_VERSION: 25-x64
47
- BUNDLE_GEMFILE: testing/gemfiles/gherkin6.gemfile
48
-
49
- - RUBY_VERSION: 24
50
- BUNDLE_GEMFILE: testing/gemfiles/gherkin7.gemfile
51
- - RUBY_VERSION: 24-x64
52
- BUNDLE_GEMFILE: testing/gemfiles/gherkin7.gemfile
53
- - RUBY_VERSION: 25
54
- BUNDLE_GEMFILE: testing/gemfiles/gherkin7.gemfile
55
- - RUBY_VERSION: 25-x64
56
- BUNDLE_GEMFILE: testing/gemfiles/gherkin7.gemfile
57
-
58
- - RUBY_VERSION: 24
59
- BUNDLE_GEMFILE: testing/gemfiles/gherkin8.gemfile
60
- - RUBY_VERSION: 24-x64
61
- BUNDLE_GEMFILE: testing/gemfiles/gherkin8.gemfile
62
- - RUBY_VERSION: 25
63
- BUNDLE_GEMFILE: testing/gemfiles/gherkin8.gemfile
64
- - RUBY_VERSION: 25-x64
65
- BUNDLE_GEMFILE: testing/gemfiles/gherkin8.gemfile
66
-
67
- - RUBY_VERSION: 24
68
- BUNDLE_GEMFILE: testing/gemfiles/gherkin9.gemfile
69
- - RUBY_VERSION: 24-x64
70
- BUNDLE_GEMFILE: testing/gemfiles/gherkin9.gemfile
71
- - RUBY_VERSION: 25
72
- BUNDLE_GEMFILE: testing/gemfiles/gherkin9.gemfile
73
- - RUBY_VERSION: 25-x64
74
- BUNDLE_GEMFILE: testing/gemfiles/gherkin9.gemfile
75
-
76
- install:
77
- - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
78
- - bundle install
79
-
80
- build: off
81
-
82
- before_test:
83
- - ruby -v
84
- - gem -v
85
- - bundle -v
86
-
87
- test_script:
88
- - bundle exec rake cuke_modeler:ci_build
@@ -1,274 +0,0 @@
1
- module CukeModeler
2
-
3
- # NOT A PART OF THE PUBLIC API
4
- # An adapter that can convert the output of version 2.x of the *gherkin* gem into input that is consumable by this gem.
5
-
6
- class Gherkin2Adapter
7
-
8
- # Adapts the given AST into the shape that this gem expects
9
- def adapt(parsed_ast)
10
- parsed_data = {}
11
-
12
- # The entire AST is just an array with one feature and we don't want to save any child data so...an empty array
13
- parsed_data['cuke_modeler_parsing_data'] = []
14
-
15
- # Comments are stored on child elements in gherkin 2.x
16
- comments = []
17
-
18
- # An AST is just one feature
19
- adapt_feature!(parsed_ast.first, comments) if parsed_ast.first
20
- parsed_data['feature'] = parsed_ast.first
21
-
22
- # Adapt and store comments once they have all been gathered
23
- comments.each do |comment|
24
- adapt_comment!(comment)
25
- end
26
- parsed_data['comments'] = comments
27
-
28
-
29
- [parsed_data]
30
- end
31
-
32
- # Adapts the AST sub-tree that is rooted at the given feature node.
33
- def adapt_feature!(parsed_feature, gathered_comments)
34
- # Saving off the original data
35
- parsed_feature['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_feature))
36
-
37
- # Removing parsed data for child elements in order to avoid duplicating data
38
- parsed_feature['cuke_modeler_parsing_data']['tags'] = nil
39
- parsed_feature['cuke_modeler_parsing_data']['elements'] = nil
40
-
41
- if parsed_feature['comments']
42
- parsed_feature['cuke_modeler_parsing_data']['comments'] = nil
43
- gathered_comments.concat(parsed_feature['comments'])
44
- end
45
-
46
- adapt_child_elements!(parsed_feature, gathered_comments)
47
-
48
- if parsed_feature['tags']
49
- parsed_feature['tags'].each do |tag|
50
- adapt_tag!(tag)
51
- end
52
- end
53
- end
54
-
55
- # Adapts the AST sub-tree that is rooted at the given background node.
56
- def adapt_background!(parsed_background, gathered_comments)
57
- # Saving off the original data
58
- parsed_background['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_background))
59
-
60
- # Removing parsed data for child elements in order to avoid duplicating data
61
- parsed_background['cuke_modeler_parsing_data']['steps'] = nil
62
-
63
- if parsed_background['comments']
64
- parsed_background['cuke_modeler_parsing_data']['comments'] = nil
65
- gathered_comments.concat(parsed_background['comments'])
66
- end
67
-
68
- if parsed_background['steps']
69
- parsed_background['steps'].each do |step|
70
- adapt_step!(step, gathered_comments)
71
- end
72
- end
73
- end
74
-
75
- # Adapts the AST sub-tree that is rooted at the given scenario node.
76
- def adapt_scenario!(parsed_scenario, gathered_comments)
77
- # Saving off the original data
78
- parsed_scenario['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_scenario))
79
-
80
- # Removing parsed data for child elements in order to avoid duplicating data
81
- parsed_scenario['cuke_modeler_parsing_data']['tags'] = nil
82
- parsed_scenario['cuke_modeler_parsing_data']['steps'] = nil
83
-
84
- if parsed_scenario['comments']
85
- parsed_scenario['cuke_modeler_parsing_data']['comments'] = nil
86
- gathered_comments.concat(parsed_scenario['comments'])
87
- end
88
-
89
- if parsed_scenario['tags']
90
- parsed_scenario['tags'].each do |tag|
91
- adapt_tag!(tag)
92
- end
93
- end
94
-
95
- if parsed_scenario['steps']
96
- parsed_scenario['steps'].each do |step|
97
- adapt_step!(step, gathered_comments)
98
- end
99
- end
100
- end
101
-
102
- # Adapts the AST sub-tree that is rooted at the given outline node.
103
- def adapt_outline!(parsed_outline, gathered_comments)
104
- # Saving off the original data
105
- parsed_outline['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_outline))
106
-
107
- # Removing parsed data for child elements in order to avoid duplicating data
108
- parsed_outline['cuke_modeler_parsing_data']['tags'] = nil
109
- parsed_outline['cuke_modeler_parsing_data']['steps'] = nil
110
- parsed_outline['cuke_modeler_parsing_data']['examples'] = nil
111
-
112
- if parsed_outline['comments']
113
- parsed_outline['cuke_modeler_parsing_data']['comments'] = nil
114
- gathered_comments.concat(parsed_outline['comments'])
115
- end
116
-
117
- if parsed_outline['tags']
118
- parsed_outline['tags'].each do |tag|
119
- adapt_tag!(tag)
120
- end
121
- end
122
-
123
- if parsed_outline['steps']
124
- parsed_outline['steps'].each do |step|
125
- adapt_step!(step, gathered_comments)
126
- end
127
- end
128
-
129
- if parsed_outline['examples']
130
- parsed_outline['examples'].each do |example|
131
- adapt_example!(example, gathered_comments)
132
- end
133
- end
134
- end
135
-
136
- # Adapts the AST sub-tree that is rooted at the given example node.
137
- def adapt_example!(parsed_example, gathered_comments)
138
- # Saving off the original data
139
- parsed_example['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_example))
140
-
141
- # Removing parsed data for child elements in order to avoid duplicating data
142
- parsed_example['cuke_modeler_parsing_data']['tags'] = nil
143
- parsed_example['cuke_modeler_parsing_data']['rows'] = nil
144
-
145
- if parsed_example['comments']
146
- parsed_example['cuke_modeler_parsing_data']['comments'] = nil
147
- gathered_comments.concat(parsed_example['comments'])
148
- end
149
-
150
- parsed_example['rows'].each do |row|
151
- adapt_table_row!(row, gathered_comments)
152
- end
153
-
154
- if parsed_example['tags']
155
- parsed_example['tags'].each do |tag|
156
- adapt_tag!(tag)
157
- end
158
- end
159
- end
160
-
161
- # Adapts the AST sub-tree that is rooted at the given tag node.
162
- def adapt_tag!(parsed_tag)
163
- # Saving off the original data
164
- parsed_tag['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_tag))
165
- end
166
-
167
- # Adapts the AST sub-tree that is rooted at the given comment node.
168
- def adapt_comment!(parsed_comment)
169
- # Saving off the original data
170
- parsed_comment['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_comment))
171
-
172
- parsed_comment['text'] = parsed_comment.delete('value')
173
- parsed_comment['line'] = parsed_comment.delete('line')
174
- end
175
-
176
- # Adapts the AST sub-tree that is rooted at the given step node.
177
- def adapt_step!(parsed_step, gathered_comments)
178
- # Saving off the original data
179
- parsed_step['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_step))
180
-
181
- # Removing parsed data for child elements in order to avoid duplicating data
182
- parsed_step['cuke_modeler_parsing_data']['rows'] = nil if parsed_step['cuke_modeler_parsing_data']['rows']
183
- parsed_step['cuke_modeler_parsing_data']['doc_string'] = nil if parsed_step['cuke_modeler_parsing_data']['doc_string']
184
-
185
- if parsed_step['comments']
186
- parsed_step['cuke_modeler_parsing_data']['comments'] = nil
187
- gathered_comments.concat(parsed_step['comments'])
188
- end
189
-
190
- adapt_doc_string!(parsed_step['doc_string']) if parsed_step['doc_string']
191
-
192
- if parsed_step['rows']
193
- parsed_step['table'] = {'rows' => parsed_step['rows']}
194
- adapt_step_table!(parsed_step['table'], gathered_comments)
195
- end
196
- end
197
-
198
- # Adapts the AST sub-tree that is rooted at the given doc string node.
199
- def adapt_doc_string!(parsed_doc_string)
200
- # Saving off the original data
201
- parsed_doc_string['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_doc_string))
202
- end
203
-
204
- # Adapts the AST sub-tree that is rooted at the given table node.
205
- def adapt_step_table!(parsed_step_table, gathered_comments)
206
- # Saving off the original data
207
- parsed_step_table['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_step_table['rows']))
208
-
209
- # Removing parsed data for child elements in order to avoid duplicating data
210
- parsed_step_table['cuke_modeler_parsing_data'].clear
211
-
212
-
213
- parsed_step_table['line'] = parsed_step_table['rows'].first['line']
214
-
215
- parsed_step_table['rows'].each do |row|
216
- adapt_table_row!(row, gathered_comments)
217
- end
218
- end
219
-
220
- # Adapts the AST sub-tree that is rooted at the given row node.
221
- def adapt_table_row!(parsed_table_row, gathered_comments)
222
- # Saving off the original data
223
- parsed_table_row['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_table_row))
224
-
225
- # Removing parsed data for child elements in order to avoid duplicating data which the child elements will themselves include
226
- parsed_table_row['cuke_modeler_parsing_data']['cells'] = nil
227
-
228
- if parsed_table_row['comments']
229
- parsed_table_row['cuke_modeler_parsing_data']['comments'] = nil
230
- gathered_comments.concat(parsed_table_row['comments'])
231
- end
232
-
233
- parsed_table_row['cells'].collect! do |cell|
234
- create_cell_for(cell, parsed_table_row['line'])
235
- end
236
- end
237
-
238
- # Adapts the AST sub-tree that is rooted at the given cell node.
239
- def create_cell_for(parsed_cell, line_number)
240
- cell = {}
241
-
242
- # Saving off the original data
243
- cell['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_cell))
244
-
245
- cell['value'] = parsed_cell
246
- cell['line'] = line_number
247
-
248
-
249
- cell
250
- end
251
-
252
-
253
- private
254
-
255
-
256
- def adapt_child_elements!(parsed_feature, gathered_comments)
257
- if parsed_feature['elements']
258
- parsed_feature['elements'].each do |element|
259
- case element['type']
260
- when 'background'
261
- adapt_background!(element, gathered_comments)
262
- when 'scenario'
263
- adapt_scenario!(element, gathered_comments)
264
- when 'scenario_outline'
265
- adapt_outline!(element, gathered_comments)
266
- else
267
- raise(ArgumentError, "Unknown element type: #{element['type']}")
268
- end
269
- end
270
- end
271
- end
272
-
273
- end
274
- end