coherence 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cb9e7e0465f033972661434425e72452b0dc955a
4
+ data.tar.gz: 820454283abc4bca3634c41a214c0008affdad4d
5
+ SHA512:
6
+ metadata.gz: 7d59445accff86ebc6d0e8dab83a22612b8bc8f304d0978d7a3ade5b763b1b8b024bf09c99fb3904f3ccfcd0839d46b40a75cfed5182364ac919625326ceb0f4
7
+ data.tar.gz: 00e87150b00619de5af9fc9fe48caeb8d4b722d14aca7a91bf0fcda35ae8bf4454c9414ad8ef8173ac7467868ff9ad2b3e30661e0e062e5acadcf4f2a92628f3
data/.gitignore ADDED
@@ -0,0 +1,22 @@
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
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jeff Nyman
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Coherent::Spec
2
+
3
+ Coherence is a framework that supports the creation and execution of test specifications that are written with the Gherkin structural language. Coherence will provide an interface that my [Lucid](https://github.com/jnyman/lucid/) tool can plug into.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'coherence'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install coherence
18
+
19
+ ## Usage
20
+
21
+ Coherence is in the very early stages of its existence and it will not be a stand-alone application. More details will follow as I figure out how all of this is going to work.
22
+
23
+ ## Contributing
24
+
25
+ 1. [Fork the project](http://gun.io/blog/how-to-github-fork-branch-and-pull-request/).
26
+ 2. Create a feature branch. (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes. (`git commit -am 'new feature'`)
28
+ 4. Push the branch. (`git push origin my-new-feature`)
29
+ 5. Create a new [pull request](https://help.github.com/articles/using-pull-requests).
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/coherence.gemspec ADDED
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'coherence/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'coherence'
8
+ spec.version = Coherence::VERSION
9
+ spec.authors = ['Jeff Nyman']
10
+ spec.email = ['jeffnyman@gmail.com']
11
+ spec.summary = %q{Test Description Language Specification and Execution Engine}
12
+ spec.description = %q{
13
+ Coherent Spec is a framework that supports the creation and execution
14
+ of test specifications that are written with the Gherkin structural
15
+ language.
16
+ }
17
+ spec.homepage = 'https://github.com/jnyman/coherence'
18
+ spec.license = 'MIT'
19
+
20
+ spec.files = `git ls-files -z`.split("\x0")
21
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
+ spec.require_paths = %w(lib)
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.6'
26
+ spec.add_development_dependency 'rake'
27
+
28
+ spec.required_ruby_version = '>= 1.9.3'
29
+ spec.required_rubygems_version = '>= 1.8.29'
30
+
31
+ spec.add_runtime_dependency 'gherkin', '>= 2.12.0'
32
+
33
+ spec.post_install_message = %{
34
+ (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
35
+
36
+ Coherence #{Coherence::VERSION} has been installed.
37
+
38
+ (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
39
+ }
40
+ end
data/lib/coherence.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'coherence/version'
2
+
3
+ module Coherence
4
+ end
@@ -0,0 +1 @@
1
+ require 'coherence/engine/dsl'
@@ -0,0 +1,2 @@
1
+ require 'coherence/engine/ast/feature'
2
+ require 'coherence/engine/ast/scenario'
@@ -0,0 +1,19 @@
1
+ module Coherence
2
+ module Engine
3
+ module AST
4
+
5
+ class Feature
6
+ #def initialize(keyword, title)
7
+ def initialize(keyword, name)
8
+ #@keyword, @title = keyword, title
9
+ @keyword, @name = keyword, name
10
+ end
11
+
12
+ def name
13
+ @name
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,68 @@
1
+ require 'coherence/engine/ast'
2
+
3
+ module Coherence
4
+ module Engine
5
+ module AST
6
+
7
+ class GherkinBuilder
8
+ def initialize(path='unknown')
9
+ @path = path
10
+ end
11
+
12
+ def uri(uri)
13
+ @path = uri
14
+ end
15
+
16
+ def feature(node)
17
+ @feature = FeatureBuilder.new(@path, node)
18
+ end
19
+
20
+ def scenario(node)
21
+ @scenario = ScenarioBuilder.new(@path, node)
22
+ end
23
+
24
+ def step(node)
25
+ @step = StepBuilder.new(@path, node)
26
+ end
27
+
28
+ def eof
29
+ end
30
+
31
+ def language=(language)
32
+ @language = language
33
+ end
34
+
35
+ def language
36
+ @language || raise('Spec language has not been set.')
37
+ end
38
+
39
+ def result
40
+ return nil unless @feature
41
+ @feature.result(language)
42
+ end
43
+
44
+ class Builder
45
+ attr_reader :file, :node
46
+
47
+ def initialize(file, node)
48
+ @file, @node = file, node
49
+ end
50
+ end
51
+
52
+ class FeatureBuilder < Builder
53
+ def result(language)
54
+ feature = AST::Feature.new(node.keyword, node.name)
55
+ end
56
+ end # class: FeatureBuilder
57
+
58
+ class ScenarioBuilder < Builder
59
+ end # class : ScenarioBuilder
60
+
61
+ class StepBuilder < Builder
62
+ end # class StepBuilder
63
+
64
+ end # class: GherkinBuilder
65
+
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,9 @@
1
+ module Coherence
2
+ module Engine
3
+ module AST
4
+ class Scenario
5
+
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,24 @@
1
+ require 'coherence/engine/ast/gherkin_builder.rb'
2
+ require 'gherkin/parser/parser'
3
+
4
+ module Coherence
5
+ module Engine
6
+ module DSL
7
+
8
+ def parse_gherkin(source, path='unknown')
9
+ builder = AST::GherkinBuilder.new(path)
10
+ parser = Gherkin::Parser::Parser.new(builder, true, 'root', false)
11
+
12
+ begin
13
+ parser.parse(source, path, 0)
14
+ builder.language = parser.i18n_language
15
+ builder.result
16
+ rescue Gherkin::Lexer::LexingError, Gherkin::Parser::ParseError => e
17
+ e.message.insert(0, "#{path}: ")
18
+ raise e
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ module Coherence
2
+ VERSION = '0.0.1'
3
+ end
data/spec/dsl_spec.rb ADDED
@@ -0,0 +1,19 @@
1
+ require 'coherence/engine'
2
+
3
+ module Coherence
4
+ module Engine
5
+ describe DSL do
6
+ include DSL
7
+
8
+ describe 'parsing gherkin' do
9
+ it 'will parse a spec file with a single scenario' do
10
+ feature = parse_gherkin %{ Feature: Name of Feature
11
+ Scenario: Name of Scenario
12
+ Given some context
13
+ }
14
+ expect(feature.name).to eq('Name of Feature')
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: coherence
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jeff Nyman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: gherkin
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 2.12.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 2.12.0
55
+ description: "\n Coherent Spec is a framework that supports the creation and execution\n
56
+ \ of test specifications that are written with the Gherkin structural\n language.\n
57
+ \ "
58
+ email:
59
+ - jeffnyman@gmail.com
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - .gitignore
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - coherence.gemspec
70
+ - lib/coherence.rb
71
+ - lib/coherence/engine.rb
72
+ - lib/coherence/engine/ast.rb
73
+ - lib/coherence/engine/ast/feature.rb
74
+ - lib/coherence/engine/ast/gherkin_builder.rb
75
+ - lib/coherence/engine/ast/scenario.rb
76
+ - lib/coherence/engine/dsl.rb
77
+ - lib/coherence/version.rb
78
+ - spec/dsl_spec.rb
79
+ homepage: https://github.com/jnyman/coherence
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n
84
+ \ Coherence 0.0.1 has been installed.\n\n(::) (::) (::) (::) (::) (::) (::) (::)
85
+ (::) (::) (::) (::)\n "
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: 1.9.3
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: 1.8.29
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.2.2
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Test Description Language Specification and Execution Engine
105
+ test_files:
106
+ - spec/dsl_spec.rb
107
+ has_rdoc: