each_sql 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
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
data/Gemfile CHANGED
@@ -1,14 +1,4 @@
1
- source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
5
- gem 'citrus', '~> 2.4.1'
6
- gem 'erubis', '~> 2.7.0'
7
- gem 'quote_unquote', '~> 0.1.1'
1
+ source 'https://rubygems.org'
8
2
 
9
- # Add dependencies to develop your gem here.
10
- # Include everything needed to run rake, tests, features, etc.
11
- group :development do
12
- gem "bundler", "~> 1.0.0"
13
- gem "jeweler", "~> 1.6.2"
14
- end
3
+ # Specify your gem's dependencies in each_sql.gemspec
4
+ gemspec
@@ -1,4 +1,6 @@
1
- Copyright (c) 2011 Junegunn Choi
1
+ Copyright (c) 2013 Junegunn Choi
2
+
3
+ MIT License
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -1,45 +1,7 @@
1
- # encoding: utf-8
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "each_sql"
18
- gem.homepage = "http://github.com/junegunn/each_sql"
19
- gem.license = "MIT"
20
- gem.summary = %Q{Enumerate each SQL statement in SQL scripts.}
21
- gem.description = %Q{Enumerate each SQL statement in SQL scripts.}
22
- gem.email = "junegunn.c@gmail.com"
23
- gem.authors = ["Junegunn Choi"]
24
- # dependencies defined in Gemfile
25
- end
26
- Jeweler::RubygemsDotOrgTasks.new
27
-
1
+ require "bundler/gem_tasks"
28
2
  require 'rake/testtask'
29
3
  Rake::TestTask.new(:test) do |test|
30
4
  test.libs << 'lib' << 'test'
31
5
  test.pattern = 'test/**/test_*.rb'
32
6
  test.verbose = true
33
7
  end
34
-
35
- task :default => :test
36
-
37
- require 'rake/rdoctask'
38
- Rake::RDocTask.new do |rdoc|
39
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
-
41
- rdoc.rdoc_dir = 'rdoc'
42
- rdoc.title = "each_sql #{version}"
43
- rdoc.rdoc_files.include('README*')
44
- rdoc.rdoc_files.include('lib/**/*.rb')
45
- end
@@ -1,55 +1,25 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
4
 
6
- Gem::Specification.new do |s|
7
- s.name = %q{each_sql}
8
- s.version = "0.2.3"
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "each_sql"
7
+ spec.version = "0.4.1"
8
+ spec.authors = ["Junegunn Choi"]
9
+ spec.email = ["junegunn.c@gmail.com"]
10
+ spec.description = %q{Enumerate each SQL statement in SQL scripts.}
11
+ spec.summary = %q{Enumerate each SQL statement in SQL scripts.}
12
+ spec.homepage = "https://github.com/junegunn/each_sql"
13
+ spec.license = "MIT"
9
14
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Junegunn Choi"]
12
- s.date = %q{2011-07-08}
13
- s.description = %q{Enumerate each SQL statement in SQL scripts.}
14
- s.email = %q{junegunn.c@gmail.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- "CHANGELOG.rdoc",
22
- "Gemfile",
23
- "Gemfile.lock",
24
- "LICENSE.txt",
25
- "README.rdoc",
26
- "Rakefile",
27
- "VERSION",
28
- "lib/each_sql.rb",
29
- "lib/each_sql/each_sql.rb",
30
- "test/helper.rb",
31
- "test/postgres.sql",
32
- "test/test_each_sql.rb"
33
- ]
34
- s.homepage = %q{http://github.com/junegunn/each_sql}
35
- s.licenses = ["MIT"]
36
- s.require_paths = ["lib"]
37
- s.rubygems_version = %q{1.7.2}
38
- s.summary = %q{Enumerate each SQL statement in SQL scripts.}
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
39
19
 
40
- if s.respond_to? :specification_version then
41
- s.specification_version = 3
42
-
43
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
45
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
46
- else
47
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
48
- s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
49
- end
50
- else
51
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
52
- s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
53
- end
20
+ spec.add_runtime_dependency 'citrus', '~> 2.4.1'
21
+ spec.add_runtime_dependency 'erubis', '~> 2.7.0'
22
+ spec.add_runtime_dependency 'quote_unquote', '~> 0.1.1'
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
54
25
  end
55
-
@@ -13,7 +13,7 @@ grammar EachSQL::Parser::Default<%= suffix %>
13
13
 
14
14
  rule begin_end_block
15
15
  begin_block
16
- (begin_end_block | sql_statement | empty)+
16
+ (begin_end_block | sql_statement | empty)+
17
17
  end_block
18
18
  delimiters
19
19
  end
@@ -36,12 +36,12 @@ grammar EachSQL::Parser::Default<%= suffix %>
36
36
 
37
37
  !(begin_block | end_block) chunk
38
38
 
39
- (chunk | empty)*
39
+ (chunk | empty)*
40
40
  delimiters
41
41
  end
42
42
 
43
43
  rule delimiters
44
- empty* delimiter
44
+ empty* delimiter
45
45
  (empty | delimiter)*
46
46
  end
47
47
 
@@ -70,7 +70,11 @@ grammar EachSQL::Parser::Default<%= suffix %>
70
70
  end
71
71
 
72
72
  rule c_comment
73
- '/*' (!'*/' .)* '*/'
73
+ '/*' (hint | !'*/' .)* '*/'
74
+ end
75
+
76
+ rule hint
77
+ '/*+' (!'*/' .)* '*/'
74
78
  end
75
79
 
76
80
  rule l_comment
@@ -112,7 +116,7 @@ grammar EachSQL::Parser::MySQL<%= suffix %>
112
116
 
113
117
  rule begin_end_block
114
118
  begin_block
115
- (begin_end_block | sql_statement | empty)+
119
+ (begin_end_block | sql_statement | empty)+
116
120
  end_block
117
121
  delimiters
118
122
  end
@@ -127,7 +131,7 @@ grammar EachSQL::Parser::MySQL<%= suffix %>
127
131
 
128
132
  !(begin_block | end_block) chunk
129
133
 
130
- (chunk | empty)*
134
+ (chunk | empty)*
131
135
  delimiters
132
136
  end
133
137
 
@@ -156,7 +160,7 @@ grammar EachSQL::Parser::PostgreSQL<%= suffix %>
156
160
 
157
161
  rule begin_end_block
158
162
  begin_block
159
- (begin_end_block | sql_statement | empty)+
163
+ (begin_end_block | sql_statement | empty)+
160
164
  end_block
161
165
  delimiters
162
166
  end
@@ -171,7 +175,7 @@ grammar EachSQL::Parser::PostgreSQL<%= suffix %>
171
175
 
172
176
  !(begin_block | end_block) chunk
173
177
 
174
- (chunk | empty)*
178
+ (chunk | empty)*
175
179
  delimiters
176
180
  end
177
181
 
@@ -201,7 +205,7 @@ grammar EachSQL::Parser::Oracle<%= suffix %>
201
205
 
202
206
  rule execution_block
203
207
  (
204
- creation |
208
+ creation |
205
209
  declare_begin_end_block |
206
210
  begin_end_block |
207
211
  sql_statement
@@ -209,7 +213,7 @@ grammar EachSQL::Parser::Oracle<%= suffix %>
209
213
  end
210
214
 
211
215
  rule declare_begin_end_block
212
- declare
216
+ declare
213
217
  sql_statement+
214
218
  begin_end_block
215
219
  end
@@ -219,7 +223,7 @@ grammar EachSQL::Parser::Oracle<%= suffix %>
219
223
 
220
224
  !('/' | create | declare | begin_block | end_block) chunk
221
225
 
222
- (chunk | empty)*
226
+ (chunk | empty)*
223
227
  delimiters
224
228
  end
225
229
 
@@ -1,17 +1,6 @@
1
1
  require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
2
+ require 'bundler/setup'
10
3
  require 'test/unit'
11
4
 
12
- $LOAD_PATH.unshift(File.dirname(__FILE__))
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
14
6
  require 'each_sql'
15
-
16
- class Test::Unit::TestCase
17
- end
@@ -27,17 +27,17 @@ class TestEachSql < Test::Unit::TestCase
27
27
  # Acceptance tests
28
28
  # ================
29
29
  def test_empty
30
- [nil, "", " \n" * 10].each do |input|
31
- EachSQL(input).each do |sql|
32
- assert false, 'Should not enumerate'
33
- end
30
+ [nil, "", " \n" * 10].each do |input|
31
+ EachSQL(input).each do |sql|
32
+ assert false, 'Should not enumerate'
33
+ end
34
34
 
35
35
  # Directly pass block
36
- EachSQL(input) do |sql|
37
- assert false, 'Should not enumerate'
38
- end
39
- assert true, 'No error expected'
40
- end
36
+ EachSQL(input) do |sql|
37
+ assert false, 'Should not enumerate'
38
+ end
39
+ assert true, 'No error expected'
40
+ end
41
41
  end
42
42
 
43
43
  def test_parser_cache
@@ -55,16 +55,10 @@ class TestEachSql < Test::Unit::TestCase
55
55
 
56
56
  end
57
57
 
58
- def test_sql
59
- common = YAML.load(
60
- File.read(
61
- File.join(
62
- File.dirname(__FILE__), "yml/common.yml")))
58
+ def test_sql
59
+ common = YAML.load_file(File.expand_path("../yml/common.yml", __FILE__))
63
60
  [:default, :mysql, :oracle, :postgres].each do |typ|
64
- data = YAML.load(
65
- File.read(
66
- File.join(
67
- File.dirname(__FILE__), "yml/#{typ}.yml")))
61
+ data = YAML.load_file(File.expand_path("../yml/#{typ}.yml", __FILE__))
68
62
 
69
63
  script = nil
70
64
  [common, data].each do |d|
@@ -91,5 +85,5 @@ class TestEachSql < Test::Unit::TestCase
91
85
  assert_equal EachSQL(script, typ).to_a,
92
86
  EachSQL(script, typ).each.each.take_while { true }.map { |e| e }
93
87
  end
94
- end
88
+ end
95
89
  end
@@ -2,9 +2,12 @@
2
2
  all: |
3
3
  select * from dual;
4
4
  DECLARE UDF1CUR CURSOR FOR SELECT UDF2();
5
- select
5
+ select
6
6
  begin , begin.* from begin;
7
7
  select b `begin` from dual;
8
+ /*
9
+ select /*+ hint */ 1 from dual;
10
+ */
8
11
  commit;
9
12
  rollback;
10
13
  select b "begin" from dual
@@ -13,9 +16,13 @@ each:
13
16
  - select * from dual
14
17
  - DECLARE UDF1CUR CURSOR FOR SELECT UDF2()
15
18
  - |
16
- select
19
+ select
17
20
  begin , begin.* from begin
18
21
  - select b `begin` from dual
19
- - commit
22
+ - |
23
+ /*
24
+ select /*+ hint */ 1 from dual;
25
+ */
26
+ commit
20
27
  - rollback
21
28
  - select b "begin" from dual
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: each_sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
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: 2013-05-15 00:00:00.000000000 Z
12
+ date: 2013-09-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: citrus
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 1.0.0
69
+ version: '1.3'
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,39 +74,36 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 1.0.0
77
+ version: '1.3'
78
78
  - !ruby/object:Gem::Dependency
79
- name: jeweler
79
+ name: rake
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ~>
83
+ - - ! '>='
84
84
  - !ruby/object:Gem::Version
85
- version: 1.6.2
85
+ version: '0'
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ~>
91
+ - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
- version: 1.6.2
93
+ version: '0'
94
94
  description: Enumerate each SQL statement in SQL scripts.
95
- email: junegunn.c@gmail.com
95
+ email:
96
+ - junegunn.c@gmail.com
96
97
  executables: []
97
98
  extensions: []
98
- extra_rdoc_files:
99
- - LICENSE.txt
100
- - README.markdown
99
+ extra_rdoc_files: []
101
100
  files:
102
- - .document
101
+ - .gitignore
103
102
  - CHANGELOG.markdown
104
103
  - Gemfile
105
- - Gemfile.lock
106
104
  - LICENSE.txt
107
105
  - README.markdown
108
106
  - Rakefile
109
- - VERSION
110
107
  - each_sql.gemspec
111
108
  - lib/each_sql.rb
112
109
  - lib/each_sql/each_sql.rb
@@ -120,7 +117,7 @@ files:
120
117
  - test/yml/mysql.yml
121
118
  - test/yml/oracle.yml
122
119
  - test/yml/postgres.yml
123
- homepage: http://github.com/junegunn/each_sql
120
+ homepage: https://github.com/junegunn/each_sql
124
121
  licenses:
125
122
  - MIT
126
123
  post_install_message:
@@ -135,17 +132,28 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
132
  version: '0'
136
133
  segments:
137
134
  - 0
138
- hash: 3224767987852485011
135
+ hash: 3688803514110298241
139
136
  required_rubygems_version: !ruby/object:Gem::Requirement
140
137
  none: false
141
138
  requirements:
142
139
  - - ! '>='
143
140
  - !ruby/object:Gem::Version
144
141
  version: '0'
142
+ segments:
143
+ - 0
144
+ hash: 3688803514110298241
145
145
  requirements: []
146
146
  rubyforge_project:
147
147
  rubygems_version: 1.8.25
148
148
  signing_key:
149
149
  specification_version: 3
150
150
  summary: Enumerate each SQL statement in SQL scripts.
151
- test_files: []
151
+ test_files:
152
+ - test/helper.rb
153
+ - test/postgres.sql
154
+ - test/test_each_sql.rb
155
+ - test/yml/common.yml
156
+ - test/yml/default.yml
157
+ - test/yml/mysql.yml
158
+ - test/yml/oracle.yml
159
+ - test/yml/postgres.yml
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
@@ -1,23 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- citrus (2.4.1)
5
- erubis (2.7.0)
6
- git (1.2.5)
7
- jeweler (1.6.4)
8
- bundler (~> 1.0)
9
- git (>= 1.2.5)
10
- rake
11
- quote_unquote (0.1.1)
12
- rake (0.9.2.2)
13
-
14
- PLATFORMS
15
- java
16
- ruby
17
-
18
- DEPENDENCIES
19
- bundler (~> 1.0.0)
20
- citrus (~> 2.4.1)
21
- erubis (~> 2.7.0)
22
- jeweler (~> 1.6.2)
23
- quote_unquote (~> 0.1.1)
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.4.0