cql 0.0.2 → 0.1.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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-07 00:00:00.000000000 Z
12
+ date: 2012-08-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gherkin
@@ -80,36 +80,7 @@ email: jdfolino@gmail.com
80
80
  executables: []
81
81
  extensions: []
82
82
  extra_rdoc_files: []
83
- files:
84
- - Gemfile
85
- - README.md
86
- - cql.gemspec
87
- - fixtures/.gitkeep
88
- - fixtures/features/scen_outlines/basic/test_with_scenarios.feature
89
- - fixtures/features/scen_outlines/multiple_examples/test_with_scenarios.feature
90
- - fixtures/features/scenario/simple/simple.feature
91
- - fixtures/features/scenario/simple/test.feature
92
- - fixtures/features/scenario/simple/test2.feature
93
- - fixtures/features/scenario/simple/test_full.feature
94
- - fixtures/features/scenario/simple2/test_full.feature
95
- - fixtures/features/scenario/table/simple.feature
96
- - fixtures/features/scenario/tagged_features/simple.feature
97
- - fixtures/features/scenario/tagged_features/test.feature
98
- - fixtures/features/scenario/tagged_features/test2.feature
99
- - fixtures/features/scenario/tagged_features/test_full.feature
100
- - fixtures/features/scenario/tags/simple.feature
101
- - fixtures/features/scenario/tags2/simple.feature
102
- - fixtures/features/scenario/tags2/simple2.feature
103
- - lib/dsl.rb
104
- - lib/map_reduce.rb
105
- - lib/repo.rb
106
- - projectFilesBackup/.idea/workspace.xml
107
- - spec/filter_dsl_spec.rb
108
- - spec/map_reduce_spec.rb
109
- - spec/select_feature_dsl_spec.rb
110
- - spec/select_scen_outline_dsl_spec.rb
111
- - spec/select_scenario_dsl_spec.rb
112
- - spec/unit_spec.rb
83
+ files: []
113
84
  homepage:
114
85
  licenses: []
115
86
  post_install_message: ! '
@@ -142,8 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
113
  version: '0'
143
114
  requirements: []
144
115
  rubyforge_project:
145
- rubygems_version: 1.8.24
116
+ rubygems_version: 1.8.21
146
117
  signing_key:
147
118
  specification_version: 3
148
- summary: cucumber-0.0.2
119
+ summary: cucumber-0.1.0
149
120
  test_files: []
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source "http://rubygems.org"
2
- gem 'cucumber'
3
- gem 'rspec'
data/README.md DELETED
@@ -1,4 +0,0 @@
1
- gql
2
- ===
3
-
4
- Gherkin Query Language
@@ -1,36 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
- require "cucumber/platform"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = 'cql'
7
- s.version = "0.0.2"
8
- s.authors = ["Jarrod Folino"]
9
- s.description = 'Cucumber Query Language'
10
- s.summary = "cucumber-#{s.version}"
11
- s.email = 'jdfolino@gmail.com'
12
-
13
- s.platform = Gem::Platform::RUBY
14
- s.post_install_message = %{
15
- (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
16
-
17
- Thank you for installing cql (Cucumber Query Language)
18
-
19
- (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
20
-
21
- }
22
-
23
- s.add_runtime_dependency 'gherkin', '~> 2.8.0'
24
- s.add_runtime_dependency 'json', '>= 1.4.6'
25
-
26
- s.add_development_dependency 'rake', '>= 0.9.2'
27
- s.add_development_dependency 'rspec', '~> 2.7.0'
28
-
29
-
30
- s.rubygems_version = ">= 1.6.1"
31
- s.files = `git ls-files`.split("\n").reject {|path| path =~ /\.gitignore$/ }
32
- s.test_files = `git ls-files -- {spec}/*`.split("\n")
33
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
34
- s.rdoc_options = ["--charset=UTF-8"]
35
- s.require_path = "lib"
36
- end
File without changes
@@ -1,15 +0,0 @@
1
- Feature: Test Feature
2
-
3
- Scenario Outline: An Outline
4
- Given something happend
5
- Then I expect something else
6
- Examples:
7
- | var_a | var_b |
8
- | 1 | a |
9
- | 2 | b |
10
- | 3 | c |
11
- | 4 | d |
12
-
13
- Scenario: A Scenario
14
- Given something happend
15
- Then I expect something else
@@ -1,19 +0,0 @@
1
- Feature: Test Feature
2
-
3
- Scenario Outline: An Outline
4
- Given something happend
5
- Then I expect something else
6
- Examples: One
7
- | var_a | var_b |
8
- | 1 | a |
9
- | 2 | b |
10
-
11
- Examples: Two
12
- | var_a | var_b |
13
- | 1 | a |
14
- | 2 | b |
15
-
16
-
17
- Scenario: A Scenario
18
- Given something happend
19
- Then I expect something else
@@ -1,8 +0,0 @@
1
- Feature: Simple
2
-
3
- Scenario: Has a table
4
- Given Something
5
- |a|a|
6
- |s|a|
7
- |s|s|
8
- Then something else
@@ -1,9 +0,0 @@
1
- Feature: Test Feature
2
-
3
- Scenario: Testing the slurping 1
4
- Given something happend
5
- Then I expect something else
6
-
7
- Scenario: Testing the slurping not to be found
8
- Given something happend
9
- Then I expect something else
@@ -1,5 +0,0 @@
1
- Feature: Test2 Feature
2
-
3
- Scenario: Testing the slurping 2
4
- Given something happend
5
- Then I expect something else
@@ -1,22 +0,0 @@
1
- @top-tag
2
- Feature: Test3 Feature
3
-
4
- @one
5
- Scenario: Testing the slurping 3
6
- Given something happend
7
- Then I expect something else
8
-
9
- @two
10
- Scenario: Testing again
11
- Given something happend
12
- Then I expect something else
13
-
14
- @one
15
- Scenario: Testing yet again
16
- Given something happend
17
- Then I expect something else
18
-
19
- @one @two
20
- Scenario: Testing yet again part 2
21
- Given something happend
22
- Then I expect something else
@@ -1,23 +0,0 @@
1
- @top-tag
2
- Feature: Test3 Feature
3
- The cat in the hat
4
-
5
- @one
6
- Scenario: Testing the slurping
7
- Given something happend
8
- Then I expect something else
9
-
10
- @two
11
- Scenario: Testing again
12
- Given something happend
13
- Then I expect something else
14
-
15
- @one
16
- Scenario: Testing yet again
17
- Given something happend
18
- Then I expect something else
19
-
20
- @one @two
21
- Scenario: Testing yet again part 2
22
- Given something happend
23
- Then I expect something else
@@ -1,8 +0,0 @@
1
- Feature: Simple
2
-
3
- Scenario: Has a table
4
- Given Something
5
- |a|a|
6
- |s|a|
7
- |s|s|
8
- Then something else
@@ -1,8 +0,0 @@
1
- Feature: Simple
2
-
3
- Scenario: Has a table
4
- Given Something
5
- |a|a|
6
- |s|a|
7
- |s|s|
8
- Then something else
@@ -1,10 +0,0 @@
1
- @one
2
- Feature: Test Feature
3
-
4
- Scenario: Testing the slurping
5
- Given something happend
6
- Then I expect something else
7
-
8
- Scenario: Testing the slurping not to be found
9
- Given something happend
10
- Then I expect something else
@@ -1,6 +0,0 @@
1
- @two
2
- Feature: Test2 Feature
3
-
4
- Scenario: Testing the slurping
5
- Given something happend
6
- Then I expect something else
@@ -1,22 +0,0 @@
1
- @one @two
2
- Feature: Test3 Feature
3
-
4
- @one
5
- Scenario: Testing the slurping
6
- Given something happend
7
- Then I expect something else
8
-
9
- @two
10
- Scenario: Testing again
11
- Given something happend
12
- Then I expect something else
13
-
14
- @one
15
- Scenario: Testing yet again
16
- Given something happend
17
- Then I expect something else
18
-
19
- @one @two
20
- Scenario: Testing yet again part 2
21
- Given something happend
22
- Then I expect something else
@@ -1,24 +0,0 @@
1
- Feature: Simple
2
-
3
- @two
4
- Scenario: Has a table
5
- Given Something
6
- | a | a |
7
- | s | a |
8
- | s | s |
9
- Then something else
10
-
11
- @one
12
- Scenario: Next
13
- Given anything
14
-
15
- @two
16
- Scenario: Blah
17
- Given lalala
18
-
19
- @one
20
- Scenario: Another
21
- Given a car
22
-
23
- Scenario: Yet Another
24
- Given a car
@@ -1,24 +0,0 @@
1
- Feature: Simple
2
-
3
- @two
4
- Scenario: Has a table
5
- Given Something
6
- | a | a |
7
- | s | a |
8
- | s | s |
9
- Then something else
10
-
11
- @one
12
- Scenario: Next
13
- Given anything
14
-
15
- Scenario: Another
16
- Given a car
17
-
18
- @two
19
- Scenario: Blah
20
- Given lalala
21
-
22
- @one
23
- Scenario: Another
24
- Given a car
@@ -1,24 +0,0 @@
1
- Feature: Simple 2
2
-
3
- @two @four
4
- Scenario: Has a table hmmm
5
- Given Something
6
- | a | a |
7
- | s | a |
8
- | s | s |
9
- Then something else
10
-
11
- @one @five
12
- Scenario: Next
13
- Given anything
14
-
15
- Scenario: Another
16
- Given a car
17
-
18
- @two
19
- Scenario: Blah blah
20
- Given lalala
21
-
22
- @one
23
- Scenario: Another
24
- Given a car
data/lib/dsl.rb DELETED
@@ -1,56 +0,0 @@
1
- require File.dirname(__FILE__) + "/map_reduce"
2
- module CQL
3
- DSL_KEYWORDS = %w(features scenario_outlines scenarios all step_lines examples)
4
- module Dsl
5
- (CQL::QUERY_VALUES + CQL::DSL_KEYWORDS).each do |method_name|
6
- define_method(method_name) { |*args|
7
- return method_name if args.size == 0
8
- {method_name=>args}
9
- }
10
- end
11
-
12
- alias :everything :all
13
- alias :complete :all
14
-
15
- def select *what
16
- @what = what
17
- end
18
-
19
- def from where
20
- @from = where
21
- @data
22
- end
23
-
24
- def tags *tags
25
- return "tags" if tags.size == 0
26
- {'tags'=>tags}
27
- end
28
-
29
- def with filter
30
- if filter.has_key? 'tags'
31
- @data = CQL::MapReduce.filter_features(@data, 'tags'=>filter['tags'])
32
- elsif filter.has_key? 'name'
33
- @data = CQL::MapReduce.filter_features(@data, 'feature'=>filter['name'])
34
- end
35
- @data
36
- end
37
-
38
- class Query
39
- include Dsl
40
- attr_reader :data, :what
41
-
42
- def initialize features, &block
43
- @data = features
44
- @data = self.instance_eval(&block)
45
-
46
- @data= CQL::MapReduce.filter_sso(@data, 'what'=>@from[0, @from.size-1]) if @from != "features"
47
- result = Array.new(@data.size)
48
- result = result.map { |e| {} }
49
- @what.each do |w|
50
- CQL::MapReduce.send(w, @data).each_with_index { |e, i| result[i][w]=e }
51
- end
52
- @data = result.size == 1 ? result.first : result
53
- end
54
- end
55
- end
56
- end
@@ -1,64 +0,0 @@
1
- require File.dirname(__FILE__) + "/dsl"
2
- module CQL
3
-
4
- QUERY_VALUES = %w(name uri line description type steps id tags examples)
5
-
6
- class MapReduce
7
-
8
- CQL::QUERY_VALUES.each do |property|
9
- define_singleton_method(property) do |input|
10
- input = [input] if input.class != Array
11
- input.map { |a| a[property] }
12
- end
13
- end
14
-
15
- %w(all everything complete).each do |method_name|
16
- define_singleton_method(method_name){|input|input}
17
- end
18
-
19
- def self.step_lines input
20
- input = [input] if input.class != Array
21
- steps(input).map do |scen|
22
- scen.map { |line| line['keyword'] + line['name'] }
23
- end
24
- end
25
-
26
- def self.filter_features input, args
27
- if args.has_key?('feature') && args['feature'][0].class == String
28
- input = input.find_all { |feature| feature['name'] == args['feature'][0] }
29
- elsif args.has_key?('feature') && args['feature'][0].class == Regexp
30
- input = input.find_all { |feature| feature['name'] =~ args['feature'][0] }
31
- end
32
- input = input.find_all { |feature| has_tags feature['tags'], args['tags'] } if args.has_key? 'tags'
33
- input
34
- end
35
-
36
- def self.filter_sso input, args
37
- results = []
38
- input = filter_features(input, 'feature'=>args['feature']) if args.has_key?('feature')
39
- input.each do |feature|
40
- feature['elements'].each do |element|
41
- results.push element if element['type'] == args['what']
42
- end
43
- end
44
- results
45
- end
46
-
47
- def self.tag_set input
48
- tags = Set.new
49
- input.each do |feature|
50
- feature['elements'].each do |element|
51
- break if element['tags'] == nil
52
- element['tags'].each { |tag| tags.add tag['name'] }
53
- end
54
- end
55
- tags.to_a
56
- end
57
-
58
- def self.has_tags given, search
59
- return false if given == nil
60
- search.count { |tag_for_search| given.map { |t| t["name"] }.include?(tag_for_search) }==search.size
61
- end
62
-
63
- end
64
- end