veritas-sql-generator 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -3,8 +3,9 @@ script: "bundle exec rake spec"
3
3
  rvm:
4
4
  - 1.8.7
5
5
  - 1.9.2
6
- - rbx
7
- # - rbx-2.0
6
+ - 1.9.3
7
+ - ruby-head
8
8
  - ree
9
9
  - jruby
10
- - ruby-head
10
+ - rbx
11
+ - rbx-2.0
data/Gemfile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  source :rubygems
4
4
 
5
- gem 'veritas', '~> 0.0.5', :git => 'git://github.com/dkubb/veritas.git'
5
+ gem 'veritas', '~> 0.0.6', :git => 'git://github.com/dkubb/veritas.git'
6
6
 
7
7
  group :development do
8
8
  gem 'backports', '~> 2.3.0'
@@ -13,10 +13,9 @@ group :development do
13
13
  end
14
14
 
15
15
  group :guard do
16
- gem 'guard', '~> 0.5.1'
16
+ gem 'guard', '~> 0.7.0'
17
17
  gem 'guard-bundler', '~> 0.1.3'
18
- gem 'guard-ego', '~> 0.0.1'
19
- gem 'guard-rspec', '~> 0.4.0'
18
+ gem 'guard-rspec', '~> 0.4.5'
20
19
  end
21
20
 
22
21
  platform :jruby do
@@ -27,16 +26,19 @@ end
27
26
 
28
27
  platforms :mri_18 do
29
28
  group :metrics do
30
- gem 'flay', '~> 1.4.2'
31
- gem 'flog', '~> 2.5.1'
32
- gem 'heckle', '~> 1.4.3'
33
- gem 'json', '~> 1.5.3'
34
- gem 'metric_fu', '~> 2.1.1'
35
- gem 'mspec', '~> 1.5.17'
36
- gem 'rcov', '~> 0.9.9'
37
- gem 'reek', '~> 1.2.8', :git => 'git://github.com/dkubb/reek.git'
38
- gem 'roodi', '~> 2.1.0'
39
- gem 'ruby2ruby', '= 1.2.2'
40
- gem 'yardstick', '~> 0.4.0'
29
+ gem 'arrayfields', '~> 4.7.4'
30
+ gem 'fattr', '~> 2.2.0'
31
+ gem 'flay', '~> 1.4.2'
32
+ gem 'flog', '~> 2.5.3'
33
+ gem 'heckle', '~> 1.4.3'
34
+ gem 'json', '~> 1.6.1'
35
+ gem 'map', '~> 4.4.0'
36
+ gem 'metric_fu', '~> 2.1.1'
37
+ gem 'mspec', '~> 1.5.17'
38
+ gem 'rcov', '~> 0.9.9'
39
+ gem 'reek', '~> 1.2.8', :git => 'git://github.com/dkubb/reek.git'
40
+ gem 'roodi', '~> 2.1.0'
41
+ gem 'ruby2ruby', '= 1.2.2'
42
+ gem 'yardstick', '~> 0.4.0'
41
43
  end
42
44
  end
data/Guardfile CHANGED
@@ -1,9 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
- guard 'ego' do
4
- watch('Guardfile')
5
- end
6
-
7
3
  guard 'bundler' do
8
4
  watch('Gemfile')
9
5
  end
data/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # Veritas SQL Generator
2
+
3
+ Relational algebra SQL generator
4
+
5
+ [![Build Status](https://secure.travis-ci.org/dkubb/veritas-sql-generator.png)](http://travis-ci.org/dkubb/veritas-sql-generator)
6
+
7
+ ## Installation
8
+
9
+ With Rubygems:
10
+
11
+ ```bash
12
+ $ gem install veritas-sql-generator
13
+ $ irb -rubygems
14
+ >> require 'veritas-sql-generator'
15
+ => true
16
+ ```
17
+
18
+ With git and local working copy:
19
+
20
+ ```bash
21
+ $ git clone git://github.com/dkubb/veritas-sql-generator.git
22
+ $ cd veritas-sql-generator
23
+ $ rake install
24
+ $ irb -rubygems
25
+ >> require 'veritas-sql-generator'
26
+ => true
27
+ ```
28
+
29
+ NOTE: This gem works best with ruby 1.9, however if you are using ruby 1.8 you must also install [backports](https://rubygems.org/gems/backports), then require backports and backports/basic_object, eg:
30
+
31
+ ```bash
32
+ $ ruby -e 'puts RUBY_VERSION'
33
+ => 1.8.7
34
+ $ gem install backports
35
+ $ irb -rubygems
36
+ >> require 'backports'
37
+ => true
38
+ >> require 'backports/basic_object'
39
+ => true
40
+ >> require 'veritas-sql-generator' # assuming it was installed by one of the two methods above
41
+ => true
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ ```ruby
47
+ # visit every node in the relation AST
48
+ generator = Veritas::SQL::Generator::Relation.visit(relation)
49
+
50
+ # generate an SQL string
51
+ sql = generator.to_sql
52
+
53
+ # generate an SQL subquery string
54
+ subquery_sql = generator.to_subquery
55
+ ```
56
+
57
+ ## Description
58
+
59
+ The purpose of this gem is to produce valid SQL from a [veritas](https://github.com/dkubb/veritas) relation. A relation is a representation of a query constructed using relational algebra organized into an AST. Each node in the AST corresponds to an operation defined in the algebra.
60
+
61
+ The SQL produced has been verified and tested against [PostgreSQL](http://www.postgresql.org/) 9.0.4. Dialects for [MySQL](http://www.mysql.com/), [SQLite](http://www.sqlite.org/), [Oracle](http://www.oracle.com/) and [SQL Server](http://www.microsoft.com/sqlserver/) are planned.
62
+
63
+ ## Note on Patches/Pull Requests
64
+
65
+ * If you want your code merged into the mainline, please discuss the proposed changes with me before doing any work on it. This library is still in early development, and it may not always be clear the direction it is going. Some features may not be appropriate yet, may need to be deferred until later when the foundation for them is laid, or may be more applicable in a plugin.
66
+ * Fork the project.
67
+ * Make your feature addition or bug fix.
68
+ * Follow this [style guide](https://github.com/dkubb/styleguide).
69
+ * Add specs for it. This is important so I don't break it in a future version unintentionally. Tests must cover all branches within the code, and code must be fully covered.
70
+ * Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
71
+ * Run "rake ci". This must pass and not show any regressions in the
72
+ metrics for the code to be merged.
73
+ * Send me a pull request. Bonus points for topic branches.
74
+
75
+ ## Copyright
76
+
77
+ Copyright © 2010-2011 Dan Kubb. See LICENSE for details.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake'
5
5
  require File.expand_path('../lib/veritas/sql/generator/version', __FILE__)
6
6
 
7
7
  begin
8
- gem('jeweler', '~> 1.6.2') if respond_to?(:gem, true)
8
+ gem('jeweler', '~> 1.6.4') if respond_to?(:gem, true)
9
9
  require 'jeweler'
10
10
 
11
11
  Jeweler::Tasks.new do |gem|
@@ -23,5 +23,5 @@ begin
23
23
 
24
24
  FileList['tasks/**/*.rake'].each { |task| import task }
25
25
  rescue LoadError
26
- puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler -v 1.6.2'
26
+ puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler -v 1.6.4'
27
27
  end
@@ -99,10 +99,10 @@ module Veritas
99
99
  # @api private
100
100
  def visit_veritas_function_predicate_inclusion(inclusion)
101
101
  case inclusion.right
102
- when Range then range_inclusion_sql(inclusion)
103
- when EMPTY_ARRAY then FALSE
104
- else
105
- binary_infix_operation_sql(IN, inclusion)
102
+ when Range then range_inclusion_sql(inclusion)
103
+ when EMPTY_ARRAY then FALSE
104
+ else
105
+ binary_infix_operation_sql(IN, inclusion)
106
106
  end
107
107
  end
108
108
 
@@ -115,10 +115,10 @@ module Veritas
115
115
  # @api private
116
116
  def visit_veritas_function_predicate_exclusion(exclusion)
117
117
  case exclusion.right
118
- when Range then range_exclusion_sql(exclusion)
119
- when EMPTY_ARRAY then TRUE
120
- else
121
- binary_infix_operation_sql(NOT_IN, exclusion)
118
+ when Range then range_exclusion_sql(exclusion)
119
+ when EMPTY_ARRAY then TRUE
120
+ else
121
+ binary_infix_operation_sql(NOT_IN, exclusion)
122
122
  end
123
123
  end
124
124
 
@@ -256,7 +256,7 @@ module Veritas
256
256
  #
257
257
  # @api private
258
258
  def optional?(operand)
259
- operand.respond_to?(:required?) && !operand.required?
259
+ operand.respond_to?(:required?) && ! operand.required?
260
260
  end
261
261
 
262
262
  end # module Predicate
@@ -30,12 +30,12 @@ module Veritas
30
30
  # @api private
31
31
  def self.visit(relation)
32
32
  klass = case relation
33
- when Veritas::Relation::Operation::Set then self::Set
34
- when Veritas::Relation::Operation::Binary then self::Binary
35
- when Veritas::Relation::Operation::Unary then self::Unary
36
- when Veritas::Relation::Base then self::Base
37
- else
38
- raise InvalidRelationError, "#{relation.class} is not a visitable relation"
33
+ when Veritas::Relation::Operation::Set then self::Set
34
+ when Veritas::Relation::Operation::Binary then self::Binary
35
+ when Veritas::Relation::Operation::Unary then self::Unary
36
+ when Veritas::Relation::Base then self::Base
37
+ else
38
+ raise InvalidRelationError, "#{relation.class} is not a visitable relation"
39
39
  end
40
40
  klass.new.visit(relation)
41
41
  end
@@ -113,7 +113,7 @@ module Veritas
113
113
  #
114
114
  # @api public
115
115
  def visited?
116
- !@name.nil?
116
+ ! @name.nil?
117
117
  end
118
118
 
119
119
  private
@@ -3,7 +3,7 @@
3
3
  module Veritas
4
4
  module SQL
5
5
  module Generator
6
- VERSION = '0.0.5'
6
+ VERSION = '0.0.6'
7
7
  end # module Generator
8
8
  end # module SQL
9
9
  end # module Veritas
@@ -4,17 +4,17 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{veritas-sql-generator}
8
- s.version = "0.0.5"
7
+ s.name = "veritas-sql-generator"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Dan Kubb}]
12
- s.date = %q{2011-07-29}
13
- s.description = %q{Generate SQL from a veritas relation}
14
- s.email = %q{dan.kubb@gmail.com}
11
+ s.authors = ["Dan Kubb"]
12
+ s.date = "2011-10-04"
13
+ s.description = "Generate SQL from a veritas relation"
14
+ s.email = "dan.kubb@gmail.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc",
17
+ "README.md",
18
18
  "TODO"
19
19
  ]
20
20
  s.files = [
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  "Gemfile",
25
25
  "Guardfile",
26
26
  "LICENSE",
27
- "README.rdoc",
27
+ "README.md",
28
28
  "Rakefile",
29
29
  "TODO",
30
30
  "config/flay.yml",
@@ -155,23 +155,23 @@ Gem::Specification.new do |s|
155
155
  "tasks/yard.rake",
156
156
  "veritas-sql-generator.gemspec"
157
157
  ]
158
- s.homepage = %q{https://github.com/dkubb/veritas-sql-generator}
159
- s.require_paths = [%q{lib}]
160
- s.rubygems_version = %q{1.8.5}
161
- s.summary = %q{Relational algebra SQL generator}
158
+ s.homepage = "https://github.com/dkubb/veritas-sql-generator"
159
+ s.require_paths = ["lib"]
160
+ s.rubygems_version = "1.8.10"
161
+ s.summary = "Relational algebra SQL generator"
162
162
 
163
163
  if s.respond_to? :specification_version then
164
164
  s.specification_version = 3
165
165
 
166
166
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
167
- s.add_runtime_dependency(%q<veritas>, ["~> 0.0.5"])
167
+ s.add_runtime_dependency(%q<veritas>, ["~> 0.0.6"])
168
168
  s.add_development_dependency(%q<backports>, ["~> 2.3.0"])
169
169
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
170
170
  s.add_development_dependency(%q<rake>, ["~> 0.9.2"])
171
171
  s.add_development_dependency(%q<rspec>, ["~> 1.3.2"])
172
172
  s.add_development_dependency(%q<yard>, ["~> 0.7.2"])
173
173
  else
174
- s.add_dependency(%q<veritas>, ["~> 0.0.5"])
174
+ s.add_dependency(%q<veritas>, ["~> 0.0.6"])
175
175
  s.add_dependency(%q<backports>, ["~> 2.3.0"])
176
176
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
177
177
  s.add_dependency(%q<rake>, ["~> 0.9.2"])
@@ -179,7 +179,7 @@ Gem::Specification.new do |s|
179
179
  s.add_dependency(%q<yard>, ["~> 0.7.2"])
180
180
  end
181
181
  else
182
- s.add_dependency(%q<veritas>, ["~> 0.0.5"])
182
+ s.add_dependency(%q<veritas>, ["~> 0.0.6"])
183
183
  s.add_dependency(%q<backports>, ["~> 2.3.0"])
184
184
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
185
185
  s.add_dependency(%q<rake>, ["~> 0.9.2"])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: veritas-sql-generator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dan Kubb
@@ -15,26 +15,28 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-29 00:00:00 Z
18
+ date: 2011-10-04 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
21
+ type: :runtime
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
22
24
  none: false
23
25
  requirements:
24
26
  - - ~>
25
27
  - !ruby/object:Gem::Version
26
- hash: 21
28
+ hash: 19
27
29
  segments:
28
30
  - 0
29
31
  - 0
30
- - 5
31
- version: 0.0.5
32
- type: :runtime
33
- requirement: *id001
34
- prerelease: false
32
+ - 6
33
+ version: 0.0.6
34
+ version_requirements: *id001
35
35
  name: veritas
36
36
  - !ruby/object:Gem::Dependency
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
37
+ type: :development
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
38
40
  none: false
39
41
  requirements:
40
42
  - - ~>
@@ -45,12 +47,12 @@ dependencies:
45
47
  - 3
46
48
  - 0
47
49
  version: 2.3.0
48
- type: :development
49
- requirement: *id002
50
- prerelease: false
50
+ version_requirements: *id002
51
51
  name: backports
52
52
  - !ruby/object:Gem::Dependency
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
53
+ type: :development
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
54
56
  none: false
55
57
  requirements:
56
58
  - - ~>
@@ -61,12 +63,12 @@ dependencies:
61
63
  - 6
62
64
  - 4
63
65
  version: 1.6.4
64
- type: :development
65
- requirement: *id003
66
- prerelease: false
66
+ version_requirements: *id003
67
67
  name: jeweler
68
68
  - !ruby/object:Gem::Dependency
69
- version_requirements: &id004 !ruby/object:Gem::Requirement
69
+ type: :development
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
70
72
  none: false
71
73
  requirements:
72
74
  - - ~>
@@ -77,12 +79,12 @@ dependencies:
77
79
  - 9
78
80
  - 2
79
81
  version: 0.9.2
80
- type: :development
81
- requirement: *id004
82
- prerelease: false
82
+ version_requirements: *id004
83
83
  name: rake
84
84
  - !ruby/object:Gem::Dependency
85
- version_requirements: &id005 !ruby/object:Gem::Requirement
85
+ type: :development
86
+ prerelease: false
87
+ requirement: &id005 !ruby/object:Gem::Requirement
86
88
  none: false
87
89
  requirements:
88
90
  - - ~>
@@ -93,12 +95,12 @@ dependencies:
93
95
  - 3
94
96
  - 2
95
97
  version: 1.3.2
96
- type: :development
97
- requirement: *id005
98
- prerelease: false
98
+ version_requirements: *id005
99
99
  name: rspec
100
100
  - !ruby/object:Gem::Dependency
101
- version_requirements: &id006 !ruby/object:Gem::Requirement
101
+ type: :development
102
+ prerelease: false
103
+ requirement: &id006 !ruby/object:Gem::Requirement
102
104
  none: false
103
105
  requirements:
104
106
  - - ~>
@@ -109,9 +111,7 @@ dependencies:
109
111
  - 7
110
112
  - 2
111
113
  version: 0.7.2
112
- type: :development
113
- requirement: *id006
114
- prerelease: false
114
+ version_requirements: *id006
115
115
  name: yard
116
116
  description: Generate SQL from a veritas relation
117
117
  email: dan.kubb@gmail.com
@@ -121,7 +121,7 @@ extensions: []
121
121
 
122
122
  extra_rdoc_files:
123
123
  - LICENSE
124
- - README.rdoc
124
+ - README.md
125
125
  - TODO
126
126
  files:
127
127
  - .gemtest
@@ -130,7 +130,7 @@ files:
130
130
  - Gemfile
131
131
  - Guardfile
132
132
  - LICENSE
133
- - README.rdoc
133
+ - README.md
134
134
  - Rakefile
135
135
  - TODO
136
136
  - config/flay.yml
@@ -289,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
289
  requirements: []
290
290
 
291
291
  rubyforge_project:
292
- rubygems_version: 1.8.5
292
+ rubygems_version: 1.8.10
293
293
  signing_key:
294
294
  specification_version: 3
295
295
  summary: Relational algebra SQL generator
data/README.rdoc DELETED
@@ -1,46 +0,0 @@
1
- = Veritas SQL Generator
2
-
3
- Relational algebra SQL generator
4
-
5
- http://travis-ci.org/dkubb/veritas-sql-generator.png
6
-
7
- == Usage
8
-
9
- # visit every node in the relation AST
10
- generator = Veritas::SQL::Generator::Relation.visit(relation)
11
-
12
- # generate an SQL string
13
- sql = generator.to_sql
14
-
15
- # generate an SQL subquery string
16
- subquery_sql = generator.to_subquery
17
-
18
- == Description
19
-
20
- The purpose of this gem is to produce valid SQL from a veritas[https://github.com/dkubb/veritas] relation. A relation is a representation of a query constructed using relational algebra organized into an AST. Each node in the AST corresponds to an operation defined in the algebra.
21
-
22
- The SQL produced has been verified and tested against PostgreSQL 9.0.4. Dialects for MySQL, SQLite3, Oracle and SQL Server are planned.
23
-
24
- == Note on Patches/Pull Requests
25
-
26
- * If you want your code merged into the mainline, please discuss
27
- the proposed changes with me before doing any work on it. This
28
- library is still in early development, and it may not always be
29
- clear the direction it is going. Some features may not be appropriate
30
- yet, may need to be deferred until later when the foundation for
31
- them is laid, or may be more applicable in a plugin.
32
- * Fork the project.
33
- * Make your feature addition or bug fix.
34
- * Follow this {style guide}[https://github.com/dkubb/styleguide].
35
- * Add specs for it. This is important so I don't break it in a
36
- future version unintentionally. Tests must cover all branches
37
- within the code, and code must be fully covered.
38
- * Commit, do not mess with Rakefile, version, or history.
39
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
40
- * Run "rake ci". This must pass and not show any regressions in the
41
- metrics for the code to be merged.
42
- * Send me a pull request. Bonus points for topic branches.
43
-
44
- == Copyright
45
-
46
- Copyright (c) 2010-2011 Dan Kubb. See LICENSE for details.