twowaysql 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ *.gem
2
+ .ditz-config
3
+ .bundle
4
+ Gemfile.lock
5
+ lib/twowaysql/parser.output
6
+ pkg/*
7
+ coverage/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in twowaysql.gemspec
4
+ gemspec
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == release_0_5 / 2012-01-20
2
+ * use Bundler to build this gem
3
+ * fix old specs / features
4
+
1
5
  == release_0_4_1 / 2008-11-02
2
6
  * apply latest newgem structure
3
7
 
data/License.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2004-2008 the Seasar Foundation and the Others.
1
+ Copyright 2008-2012 Takuto Wada
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -8,6 +8,6 @@ You may obtain a copy of the License at
8
8
 
9
9
  Unless required by applicable law or agreed to in writing, software
10
10
  distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
12
- either express or implied. See the License for the specific language
13
- governing permissions and limitations under the License.
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.rdoc CHANGED
@@ -447,7 +447,7 @@ Default is false. When true, parser preserves original actual comments. When fal
447
447
 
448
448
  == LICENSE:
449
449
 
450
- Copyright 2004-2008 the Seasar Foundation and the Others.
450
+ Copyright 2008-2012 Takuto Wada
451
451
 
452
452
  Licensed under the Apache License, Version 2.0 (the "License");
453
453
  you may not use this file except in compliance with the License.
@@ -457,6 +457,6 @@ You may obtain a copy of the License at
457
457
 
458
458
  Unless required by applicable law or agreed to in writing, software
459
459
  distributed under the License is distributed on an "AS IS" BASIS,
460
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
461
- either express or implied. See the License for the specific language
462
- governing permissions and limitations under the License.
460
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
461
+ See the License for the specific language governing permissions and
462
+ limitations under the License.
data/Rakefile ADDED
@@ -0,0 +1,31 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ namespace :racc do
4
+ @grammar = "lib/twowaysql/parser"
5
+ @generate_parser = "racc -o #{@grammar}.rb #{@grammar}.y"
6
+ @debug_parser = "racc -v -o #{@grammar}.rb -g #{@grammar}.y"
7
+ @revert_generated = "git checkout #{@grammar}.rb"
8
+
9
+ desc 'Regenerate parser'
10
+ task :gen do
11
+ `#{@generate_parser}`
12
+ end
13
+
14
+ desc 'Debug parser'
15
+ task :debug do
16
+ `#{@debug_parser}`
17
+
18
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
19
+ require 'twowaysql'
20
+ template = TwoWaySQL::Template.parse($stdin, :debug => true)
21
+ template.merge({})
22
+
23
+ `#{@revert_generated}`
24
+ end
25
+
26
+ desc 'Update tab file'
27
+ task :tab do
28
+ `#{@debug_parser}`
29
+ `#{@revert_generated}`
30
+ end
31
+ end
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ rest: --format pretty
@@ -0,0 +1,3 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
2
+ require 'rspec'
3
+ require 'twowaysql'
@@ -0,0 +1,15 @@
1
+ Feature: Simple usage
2
+ TwoWaySQL simple feature description
3
+
4
+ Scenario Outline: merge context with template
5
+ Given template is <template>
6
+ And modify context <context>
7
+ When template merged with context
8
+ Then merged sql should be <sql>
9
+ And bound variables should be <bound_variables>
10
+
11
+ Examples:
12
+ | template | context | sql | bound_variables |
13
+ | SELECT * FROM emp | | SELECT * FROM emp | [] |
14
+ | SELECT * FROM emp WHERE job = /*ctx[:job]*/'CLERK' | ctx[:job] = 'MANAGER' | SELECT * FROM emp WHERE job = ? | ['MANAGER'] |
15
+ | SELECT * FROM emp WHERE age < /*ctx[:age]*/30 | ctx[:age] = 25 | SELECT * FROM emp WHERE age < ? | [25] |
@@ -0,0 +1,29 @@
1
+ require File.dirname(__FILE__) + '/../../feature_helper.rb'
2
+
3
+ Before do
4
+ @ctx = {}
5
+ end
6
+
7
+ After do
8
+ end
9
+
10
+ Given /template is (.*)/ do |text|
11
+ @template = TwoWaySQL::Template.parse(text)
12
+ end
13
+
14
+ Given /modify context (.*)/ do |exp|
15
+ ctx = @ctx
16
+ eval(exp)
17
+ end
18
+
19
+ When /template merged with context/ do
20
+ @result = @template.merge(@ctx)
21
+ end
22
+
23
+ Then /merged sql should be (.*)/ do |text|
24
+ @result.sql.should == text
25
+ end
26
+
27
+ Then /bound variables should be (.*)/ do |exp|
28
+ @result.bound_variables.should == eval(exp)
29
+ end
@@ -0,0 +1,30 @@
1
+ --- !ditz.rubyforge.org,2008-03-06/issue
2
+ title: use Cucumber to describe features
3
+ desc: use Cucumber to describe features
4
+ type: :task
5
+ component: twowaysql
6
+ release: release_0_4_2
7
+ reporter: takuto <takuto.wada@gmail.com>
8
+ status: :closed
9
+ disposition: :fixed
10
+ creation_time: 2008-11-01 09:49:10.745475 Z
11
+ references: []
12
+
13
+ id: 0c8cb2854109cb31df8a09b4bb7272fa5af52848
14
+ log_events:
15
+ - - 2008-11-01 09:49:12.136663 Z
16
+ - takuto <takuto.wada@gmail.com>
17
+ - created
18
+ - ""
19
+ - - 2008-11-03 04:51:12.548699 Z
20
+ - takuto <takuto.wada@gmail.com>
21
+ - changed status from unstarted to in_progress
22
+ - ""
23
+ - - 2008-11-03 06:44:22.905684 Z
24
+ - takuto <takuto.wada@gmail.com>
25
+ - closed with disposition fixed
26
+ - cucumberize spike finished. Migration from rspec should be a new task.
27
+ - - 2008-11-03 06:45:58.082688 Z
28
+ - takuto <takuto.wada@gmail.com>
29
+ - assigned to release release_0_4_2 from unassigned
30
+ - ""
data/issues/project.yaml CHANGED
@@ -70,3 +70,12 @@ releases:
70
70
  - takuto <takuto.wada@gmail.com>
71
71
  - released
72
72
  - ""
73
+ - !ditz.rubyforge.org,2008-03-06/release
74
+ name: release_0_4_2
75
+ status: :unreleased
76
+ release_time:
77
+ log_events:
78
+ - - 2008-11-03 06:45:18.083136 Z
79
+ - takuto <takuto.wada@gmail.com>
80
+ - created
81
+ - release_0_4_2 for cucumberization
data/lib/twowaysql.rb CHANGED
@@ -1,10 +1,7 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
-
1
+ require "twowaysql/version"
4
2
  require 'twowaysql/node'
5
3
  require 'twowaysql/parser'
6
4
  require 'twowaysql/template'
7
5
 
8
6
  module TwoWaySQL
9
- VERSION = '0.4.1'
10
7
  end
@@ -1,17 +1,14 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by racc 1.4.5
4
- # from racc grammer file "lib/twowaysql/parser.y".
3
+ # This file is automatically generated by Racc 1.4.7
4
+ # from Racc grammer file "".
5
5
  #
6
6
 
7
- require 'racc/parser'
8
-
9
-
7
+ require 'racc/parser.rb'
10
8
  module TwoWaySQL
11
-
12
9
  class Parser < Racc::Parser
13
10
 
14
- module_eval <<'..end lib/twowaysql/parser.y modeval..id64138765db', 'lib/twowaysql/parser.y', 134
11
+ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 134)
15
12
 
16
13
  require 'strscan'
17
14
 
@@ -143,393 +140,417 @@ def line_no(pos)
143
140
  scanned.each_line { lines += 1 }
144
141
  lines
145
142
  end
146
- ..end lib/twowaysql/parser.y modeval..id64138765db
147
-
148
- ##### racc 1.4.5 generates ###
149
-
150
- racc_reduce_table = [
151
- 0, 0, :racc_error,
152
- 1, 20, :_reduce_1,
153
- 0, 21, :_reduce_2,
154
- 2, 21, :_reduce_3,
155
- 1, 22, :_reduce_none,
156
- 1, 22, :_reduce_none,
157
- 1, 22, :_reduce_none,
158
- 3, 25, :_reduce_7,
159
- 4, 24, :_reduce_8,
160
- 2, 27, :_reduce_9,
161
- 0, 27, :_reduce_10,
162
- 1, 26, :_reduce_none,
163
- 1, 26, :_reduce_none,
164
- 1, 26, :_reduce_none,
165
- 2, 28, :_reduce_14,
166
- 2, 29, :_reduce_15,
167
- 1, 23, :_reduce_16,
168
- 1, 23, :_reduce_17,
169
- 1, 23, :_reduce_18,
170
- 1, 23, :_reduce_19,
171
- 1, 23, :_reduce_20,
172
- 1, 23, :_reduce_21,
173
- 1, 23, :_reduce_22,
174
- 1, 23, :_reduce_23,
175
- 1, 23, :_reduce_24,
176
- 1, 23, :_reduce_25,
177
- 1, 23, :_reduce_none,
178
- 1, 23, :_reduce_none,
179
- 2, 30, :_reduce_28,
180
- 3, 30, :_reduce_29,
181
- 2, 30, :_reduce_30,
182
- 3, 30, :_reduce_31,
183
- 1, 30, :_reduce_32,
184
- 2, 31, :_reduce_33,
185
- 3, 31, :_reduce_34 ]
186
-
187
- racc_reduce_n = 35
188
-
189
- racc_shift_n = 48
143
+ ...end parser.y/module_eval...
144
+ ##### State transition tables begin ###
190
145
 
191
146
  racc_action_table = [
192
- 9, 36, 14, 37, 17, 19, 21, 23, 24, 4,
193
- 6, 8, 11, 13, 15, 16, 18, 9, 39, 14,
194
- 45, 17, 19, 21, 23, 24, 4, 6, 8, 11,
195
- 13, 15, 16, 18, 9, 47, 14, 25, 17, 19,
196
- 21, 23, 24, 4, 6, 8, 11, 13, 15, 16,
197
- 18, 9, 38, 14, 3, 17, 19, 21, 23, 24,
198
- 4, 6, 8, 11, 13, 15, 16, 18, 9, nil,
199
- 14, nil, 17, 19, 21, 23, 24, 4, 6, 8,
200
- 11, 13, 15, 16, 18, 33, 34, 35, 28, 30,
201
- 28, 30, 43, 44 ]
147
+ 8, 36, 9, 37, 12, 13, 10, 11, 14, 15,
148
+ 16, 17, 18, 19, 22, 23, 24, 8, 45, 9,
149
+ 46, 12, 13, 10, 11, 14, 15, 16, 17, 18,
150
+ 19, 22, 23, 24, 8, 40, 9, 25, 12, 13,
151
+ 10, 11, 14, 15, 16, 17, 18, 19, 22, 23,
152
+ 24, 8, 38, 9, 3, 12, 13, 10, 11, 14,
153
+ 15, 16, 17, 18, 19, 22, 23, 24, 8, nil,
154
+ 9, nil, 12, 13, 10, 11, 14, 15, 16, 17,
155
+ 18, 19, 22, 23, 24, 35, 33, 34, 31, 32,
156
+ 31, 32, 44, 43 ]
202
157
 
203
158
  racc_action_check = [
204
- 42, 18, 42, 18, 42, 42, 42, 42, 42, 42,
205
- 42, 42, 42, 42, 42, 42, 42, 2, 27, 2,
206
- 37, 2, 2, 2, 2, 2, 2, 2, 2, 2,
207
- 2, 2, 2, 2, 41, 40, 41, 3, 41, 41,
159
+ 42, 24, 42, 24, 42, 42, 42, 42, 42, 42,
160
+ 42, 42, 42, 42, 42, 42, 42, 2, 37, 2,
161
+ 39, 2, 2, 2, 2, 2, 2, 2, 2, 2,
162
+ 2, 2, 2, 2, 41, 28, 41, 3, 41, 41,
208
163
  41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
209
164
  41, 26, 26, 26, 1, 26, 26, 26, 26, 26,
210
- 26, 26, 26, 26, 26, 26, 26, 26, 32, nil,
211
- 32, nil, 32, 32, 32, 32, 32, 32, 32, 32,
212
- 32, 32, 32, 32, 32, 15, 15, 15, 39, 39,
213
- 14, 14, 35, 35 ]
165
+ 26, 26, 26, 26, 26, 26, 26, 26, 27, nil,
166
+ 27, nil, 27, 27, 27, 27, 27, 27, 27, 27,
167
+ 27, 27, 27, 27, 27, 22, 22, 22, 9, 9,
168
+ 40, 40, 34, 34 ]
214
169
 
215
170
  racc_action_pointer = [
216
- nil, 54, 15, 37, nil, nil, nil, nil, nil, nil,
217
- nil, nil, nil, nil, 84, 77, nil, nil, -7, nil,
218
- nil, nil, nil, nil, nil, nil, 49, 13, nil, nil,
219
- nil, nil, 66, nil, nil, 84, nil, 12, nil, 82,
220
- 32, 32, -2, nil, nil, nil, nil, nil ]
171
+ nil, 54, 15, 37, nil, nil, nil, nil, nil, 82,
172
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
173
+ nil, nil, 77, nil, -7, nil, 49, 66, 30, nil,
174
+ nil, nil, nil, nil, 84, nil, nil, 10, nil, 17,
175
+ 84, 32, -2, nil, nil, nil, nil, nil ]
221
176
 
222
177
  racc_action_default = [
223
- -2, -35, -1, -35, -21, -3, -22, -4, -23, -2,
224
- -5, -24, -6, -25, -2, -35, -32, -18, -35, -19,
225
- -26, -16, -27, -17, -20, 48, -35, -10, -2, -11,
226
- -2, -12, -13, -30, -28, -35, -33, -35, -7, -2,
227
- -35, -14, -15, -31, -29, -34, -9, -8 ]
178
+ -2, -35, -1, -35, -3, -4, -5, -6, -2, -2,
179
+ -16, -17, -18, -19, -20, -21, -22, -23, -24, -25,
180
+ -26, -27, -35, -32, -35, 48, -35, -13, -10, -11,
181
+ -12, -2, -2, -28, -35, -30, -33, -35, -7, -35,
182
+ -2, -14, -15, -29, -31, -34, -8, -9 ]
228
183
 
229
184
  racc_goto_table = [
230
- 2, 27, 1, 40, nil, nil, nil, nil, nil, 26,
185
+ 2, 1, 28, 39, nil, nil, nil, nil, 26, nil,
186
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
231
187
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
232
- nil, nil, nil, nil, nil, nil, 46, nil, 41, nil,
233
- 42 ]
188
+ nil, 41, 42, 47 ]
234
189
 
235
190
  racc_goto_check = [
236
- 2, 7, 1, 8, nil, nil, nil, nil, nil, 2,
191
+ 2, 1, 7, 8, nil, nil, nil, nil, 2, nil,
192
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
237
193
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
238
- nil, nil, nil, nil, nil, nil, 7, nil, 2, nil,
239
- 2 ]
194
+ nil, 2, 2, 7 ]
240
195
 
241
196
  racc_goto_pointer = [
242
- nil, 2, 0, nil, nil, nil, nil, -13, -24, nil,
197
+ nil, 1, 0, nil, nil, nil, nil, -7, -25, nil,
243
198
  nil, nil, nil ]
244
199
 
245
200
  racc_goto_default = [
246
- nil, nil, 32, 5, 7, 10, 12, nil, nil, 29,
247
- 31, 20, 22 ]
201
+ nil, nil, 27, 4, 5, 6, 7, nil, nil, 29,
202
+ 30, 20, 21 ]
248
203
 
249
- racc_token_table = {
250
- false => 0,
251
- Object.new => 1,
252
- :BEGIN => 2,
253
- :END => 3,
254
- :IF => 4,
255
- :ELSE => 5,
256
- :AND => 6,
257
- :OR => 7,
258
- :IDENT => 8,
259
- :STRING_LITERAL => 9,
260
- :SPACES => 10,
261
- :COMMA => 11,
262
- :LPAREN => 12,
263
- :RPAREN => 13,
264
- :QUESTION => 14,
265
- :ACTUAL_COMMENT => 15,
266
- :BIND_VARIABLE => 16,
267
- :PAREN_BIND_VARIABLE => 17,
268
- :EMBED_VARIABLE => 18 }
204
+ racc_reduce_table = [
205
+ 0, 0, :racc_error,
206
+ 1, 20, :_reduce_1,
207
+ 0, 21, :_reduce_2,
208
+ 2, 21, :_reduce_3,
209
+ 1, 22, :_reduce_none,
210
+ 1, 22, :_reduce_none,
211
+ 1, 22, :_reduce_none,
212
+ 3, 25, :_reduce_7,
213
+ 4, 24, :_reduce_8,
214
+ 2, 27, :_reduce_9,
215
+ 0, 27, :_reduce_10,
216
+ 1, 26, :_reduce_none,
217
+ 1, 26, :_reduce_none,
218
+ 1, 26, :_reduce_none,
219
+ 2, 28, :_reduce_14,
220
+ 2, 29, :_reduce_15,
221
+ 1, 23, :_reduce_16,
222
+ 1, 23, :_reduce_17,
223
+ 1, 23, :_reduce_18,
224
+ 1, 23, :_reduce_19,
225
+ 1, 23, :_reduce_20,
226
+ 1, 23, :_reduce_21,
227
+ 1, 23, :_reduce_22,
228
+ 1, 23, :_reduce_23,
229
+ 1, 23, :_reduce_24,
230
+ 1, 23, :_reduce_25,
231
+ 1, 23, :_reduce_none,
232
+ 1, 23, :_reduce_none,
233
+ 2, 30, :_reduce_28,
234
+ 3, 30, :_reduce_29,
235
+ 2, 30, :_reduce_30,
236
+ 3, 30, :_reduce_31,
237
+ 1, 30, :_reduce_32,
238
+ 2, 31, :_reduce_33,
239
+ 3, 31, :_reduce_34 ]
269
240
 
270
- racc_use_result_var = true
241
+ racc_reduce_n = 35
242
+
243
+ racc_shift_n = 48
244
+
245
+ racc_token_table = {
246
+ false => 0,
247
+ :error => 1,
248
+ :BEGIN => 2,
249
+ :END => 3,
250
+ :IF => 4,
251
+ :ELSE => 5,
252
+ :AND => 6,
253
+ :OR => 7,
254
+ :IDENT => 8,
255
+ :STRING_LITERAL => 9,
256
+ :SPACES => 10,
257
+ :COMMA => 11,
258
+ :LPAREN => 12,
259
+ :RPAREN => 13,
260
+ :QUESTION => 14,
261
+ :ACTUAL_COMMENT => 15,
262
+ :BIND_VARIABLE => 16,
263
+ :PAREN_BIND_VARIABLE => 17,
264
+ :EMBED_VARIABLE => 18 }
271
265
 
272
266
  racc_nt_base = 19
273
267
 
268
+ racc_use_result_var = true
269
+
274
270
  Racc_arg = [
275
- racc_action_table,
276
- racc_action_check,
277
- racc_action_default,
278
- racc_action_pointer,
279
- racc_goto_table,
280
- racc_goto_check,
281
- racc_goto_default,
282
- racc_goto_pointer,
283
- racc_nt_base,
284
- racc_reduce_table,
285
- racc_token_table,
286
- racc_shift_n,
287
- racc_reduce_n,
288
- racc_use_result_var ]
271
+ racc_action_table,
272
+ racc_action_check,
273
+ racc_action_default,
274
+ racc_action_pointer,
275
+ racc_goto_table,
276
+ racc_goto_check,
277
+ racc_goto_default,
278
+ racc_goto_pointer,
279
+ racc_nt_base,
280
+ racc_reduce_table,
281
+ racc_token_table,
282
+ racc_shift_n,
283
+ racc_reduce_n,
284
+ racc_use_result_var ]
289
285
 
290
286
  Racc_token_to_s_table = [
291
- '$end',
292
- 'error',
293
- 'BEGIN',
294
- 'END',
295
- 'IF',
296
- 'ELSE',
297
- 'AND',
298
- 'OR',
299
- 'IDENT',
300
- 'STRING_LITERAL',
301
- 'SPACES',
302
- 'COMMA',
303
- 'LPAREN',
304
- 'RPAREN',
305
- 'QUESTION',
306
- 'ACTUAL_COMMENT',
307
- 'BIND_VARIABLE',
308
- 'PAREN_BIND_VARIABLE',
309
- 'EMBED_VARIABLE',
310
- '$start',
311
- 'sql',
312
- 'stmt_list',
313
- 'stmt',
314
- 'primary',
315
- 'if_stmt',
316
- 'begin_stmt',
317
- 'sub_stmt',
318
- 'else_stmt',
319
- 'and_stmt',
320
- 'or_stmt',
321
- 'bind_var',
322
- 'embed_var']
287
+ "$end",
288
+ "error",
289
+ "BEGIN",
290
+ "END",
291
+ "IF",
292
+ "ELSE",
293
+ "AND",
294
+ "OR",
295
+ "IDENT",
296
+ "STRING_LITERAL",
297
+ "SPACES",
298
+ "COMMA",
299
+ "LPAREN",
300
+ "RPAREN",
301
+ "QUESTION",
302
+ "ACTUAL_COMMENT",
303
+ "BIND_VARIABLE",
304
+ "PAREN_BIND_VARIABLE",
305
+ "EMBED_VARIABLE",
306
+ "$start",
307
+ "sql",
308
+ "stmt_list",
309
+ "stmt",
310
+ "primary",
311
+ "if_stmt",
312
+ "begin_stmt",
313
+ "sub_stmt",
314
+ "else_stmt",
315
+ "and_stmt",
316
+ "or_stmt",
317
+ "bind_var",
318
+ "embed_var" ]
323
319
 
324
320
  Racc_debug_parser = false
325
321
 
326
- ##### racc system variables end #####
322
+ ##### State transition tables end #####
327
323
 
328
- # reduce 0 omitted
324
+ # reduce 0 omitted
329
325
 
330
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 8
331
- def _reduce_1( val, _values, result )
332
- result = RootNode.new( val[0] )
333
- result
326
+ module_eval(<<'.,.,', 'parser.y', 6)
327
+ def _reduce_1(val, _values, result)
328
+ result = RootNode.new( val[0] )
329
+
330
+ result
334
331
  end
335
332
  .,.,
336
333
 
337
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 13
338
- def _reduce_2( val, _values, result )
339
- result = []
340
- result
334
+ module_eval(<<'.,.,', 'parser.y', 11)
335
+ def _reduce_2(val, _values, result)
336
+ result = []
337
+
338
+ result
341
339
  end
342
340
  .,.,
343
341
 
344
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 17
345
- def _reduce_3( val, _values, result )
346
- result.push val[1]
347
- result
342
+ module_eval(<<'.,.,', 'parser.y', 15)
343
+ def _reduce_3(val, _values, result)
344
+ result.push val[1]
345
+
346
+ result
348
347
  end
349
348
  .,.,
350
349
 
351
- # reduce 4 omitted
350
+ # reduce 4 omitted
352
351
 
353
- # reduce 5 omitted
352
+ # reduce 5 omitted
354
353
 
355
- # reduce 6 omitted
354
+ # reduce 6 omitted
356
355
 
357
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 26
358
- def _reduce_7( val, _values, result )
359
- result = BeginNode.new( val[1] )
360
- result
356
+ module_eval(<<'.,.,', 'parser.y', 24)
357
+ def _reduce_7(val, _values, result)
358
+ result = BeginNode.new( val[1] )
359
+
360
+ result
361
361
  end
362
362
  .,.,
363
363
 
364
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 31
365
- def _reduce_8( val, _values, result )
366
- result = IfNode.new( val[0][1], val[1], val[2] )
367
- result
364
+ module_eval(<<'.,.,', 'parser.y', 29)
365
+ def _reduce_8(val, _values, result)
366
+ result = IfNode.new( val[0][1], val[1], val[2] )
367
+
368
+ result
368
369
  end
369
370
  .,.,
370
371
 
371
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 36
372
- def _reduce_9( val, _values, result )
373
- result = val[1]
374
- result
372
+ module_eval(<<'.,.,', 'parser.y', 34)
373
+ def _reduce_9(val, _values, result)
374
+ result = val[1]
375
+
376
+ result
375
377
  end
376
378
  .,.,
377
379
 
378
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 40
379
- def _reduce_10( val, _values, result )
380
- result = nil
381
- result
380
+ module_eval(<<'.,.,', 'parser.y', 38)
381
+ def _reduce_10(val, _values, result)
382
+ result = nil
383
+
384
+ result
382
385
  end
383
386
  .,.,
384
387
 
385
- # reduce 11 omitted
388
+ # reduce 11 omitted
386
389
 
387
- # reduce 12 omitted
390
+ # reduce 12 omitted
388
391
 
389
- # reduce 13 omitted
392
+ # reduce 13 omitted
390
393
 
391
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 49
392
- def _reduce_14( val, _values, result )
393
- result = SubStatementNode.new( val[0][1], val[1] )
394
- result
394
+ module_eval(<<'.,.,', 'parser.y', 47)
395
+ def _reduce_14(val, _values, result)
396
+ result = SubStatementNode.new( val[0][1], val[1] )
397
+
398
+ result
395
399
  end
396
400
  .,.,
397
401
 
398
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 54
399
- def _reduce_15( val, _values, result )
400
- result = SubStatementNode.new( val[0][1], val[1] )
401
- result
402
+ module_eval(<<'.,.,', 'parser.y', 52)
403
+ def _reduce_15(val, _values, result)
404
+ result = SubStatementNode.new( val[0][1], val[1] )
405
+
406
+ result
402
407
  end
403
408
  .,.,
404
409
 
405
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 59
406
- def _reduce_16( val, _values, result )
407
- result = LiteralNode.new( val[0][1] )
408
- result
410
+ module_eval(<<'.,.,', 'parser.y', 57)
411
+ def _reduce_16(val, _values, result)
412
+ result = LiteralNode.new( val[0][1] )
413
+
414
+ result
409
415
  end
410
416
  .,.,
411
417
 
412
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 63
413
- def _reduce_17( val, _values, result )
414
- result = LiteralNode.new( val[0][1] )
415
- result
418
+ module_eval(<<'.,.,', 'parser.y', 61)
419
+ def _reduce_17(val, _values, result)
420
+ result = LiteralNode.new( val[0][1] )
421
+
422
+ result
416
423
  end
417
424
  .,.,
418
425
 
419
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 67
420
- def _reduce_18( val, _values, result )
421
- result = LiteralNode.new( val[0][1] )
422
- result
426
+ module_eval(<<'.,.,', 'parser.y', 65)
427
+ def _reduce_18(val, _values, result)
428
+ result = LiteralNode.new( val[0][1] )
429
+
430
+ result
423
431
  end
424
432
  .,.,
425
433
 
426
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 71
427
- def _reduce_19( val, _values, result )
428
- result = LiteralNode.new( val[0][1] )
429
- result
434
+ module_eval(<<'.,.,', 'parser.y', 69)
435
+ def _reduce_19(val, _values, result)
436
+ result = LiteralNode.new( val[0][1] )
437
+
438
+ result
430
439
  end
431
440
  .,.,
432
441
 
433
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 75
434
- def _reduce_20( val, _values, result )
435
- result = WhiteSpaceNode.new( val[0][1], @preserve_space )
436
- result
442
+ module_eval(<<'.,.,', 'parser.y', 73)
443
+ def _reduce_20(val, _values, result)
444
+ result = WhiteSpaceNode.new( val[0][1], @preserve_space )
445
+
446
+ result
437
447
  end
438
448
  .,.,
439
449
 
440
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 79
441
- def _reduce_21( val, _values, result )
442
- result = LiteralNode.new( val[0][1] )
443
- result
450
+ module_eval(<<'.,.,', 'parser.y', 77)
451
+ def _reduce_21(val, _values, result)
452
+ result = LiteralNode.new( val[0][1] )
453
+
454
+ result
444
455
  end
445
456
  .,.,
446
457
 
447
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 83
448
- def _reduce_22( val, _values, result )
449
- result = LiteralNode.new( val[0][1] )
450
- result
458
+ module_eval(<<'.,.,', 'parser.y', 81)
459
+ def _reduce_22(val, _values, result)
460
+ result = LiteralNode.new( val[0][1] )
461
+
462
+ result
451
463
  end
452
464
  .,.,
453
465
 
454
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 87
455
- def _reduce_23( val, _values, result )
456
- result = LiteralNode.new( val[0][1] )
457
- result
466
+ module_eval(<<'.,.,', 'parser.y', 85)
467
+ def _reduce_23(val, _values, result)
468
+ result = LiteralNode.new( val[0][1] )
469
+
470
+ result
458
471
  end
459
472
  .,.,
460
473
 
461
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 92
462
- def _reduce_24( val, _values, result )
463
- @num_questions += 1
474
+ module_eval(<<'.,.,', 'parser.y', 89)
475
+ def _reduce_24(val, _values, result)
476
+ @num_questions += 1
464
477
  result = QuestionNode.new( @num_questions )
465
- result
478
+
479
+ result
466
480
  end
467
481
  .,.,
468
482
 
469
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 96
470
- def _reduce_25( val, _values, result )
471
- result = ActualCommentNode.new( val[0][1] , val[0][2] )
472
- result
483
+ module_eval(<<'.,.,', 'parser.y', 94)
484
+ def _reduce_25(val, _values, result)
485
+ result = ActualCommentNode.new( val[0][1] , val[0][2] )
486
+
487
+ result
473
488
  end
474
489
  .,.,
475
490
 
476
- # reduce 26 omitted
491
+ # reduce 26 omitted
477
492
 
478
- # reduce 27 omitted
493
+ # reduce 27 omitted
479
494
 
480
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 103
481
- def _reduce_28( val, _values, result )
482
- result = BindVariableNode.new( val[0][1] )
483
- result
495
+ module_eval(<<'.,.,', 'parser.y', 101)
496
+ def _reduce_28(val, _values, result)
497
+ result = BindVariableNode.new( val[0][1] )
498
+
499
+ result
484
500
  end
485
501
  .,.,
486
502
 
487
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 107
488
- def _reduce_29( val, _values, result )
489
- result = BindVariableNode.new( val[0][1] )
490
- result
503
+ module_eval(<<'.,.,', 'parser.y', 105)
504
+ def _reduce_29(val, _values, result)
505
+ result = BindVariableNode.new( val[0][1] )
506
+
507
+ result
491
508
  end
492
509
  .,.,
493
510
 
494
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 111
495
- def _reduce_30( val, _values, result )
496
- result = BindVariableNode.new( val[0][1] )
497
- result
511
+ module_eval(<<'.,.,', 'parser.y', 109)
512
+ def _reduce_30(val, _values, result)
513
+ result = BindVariableNode.new( val[0][1] )
514
+
515
+ result
498
516
  end
499
517
  .,.,
500
518
 
501
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 115
502
- def _reduce_31( val, _values, result )
503
- result = BindVariableNode.new( val[0][1] )
504
- result
519
+ module_eval(<<'.,.,', 'parser.y', 113)
520
+ def _reduce_31(val, _values, result)
521
+ result = BindVariableNode.new( val[0][1] )
522
+
523
+ result
505
524
  end
506
525
  .,.,
507
526
 
508
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 119
509
- def _reduce_32( val, _values, result )
510
- result = ParenBindVariableNode.new( val[0][1] )
511
- result
527
+ module_eval(<<'.,.,', 'parser.y', 117)
528
+ def _reduce_32(val, _values, result)
529
+ result = ParenBindVariableNode.new( val[0][1] )
530
+
531
+ result
512
532
  end
513
533
  .,.,
514
534
 
515
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 124
516
- def _reduce_33( val, _values, result )
517
- result = EmbedVariableNode.new( val[0][1] )
518
- result
535
+ module_eval(<<'.,.,', 'parser.y', 122)
536
+ def _reduce_33(val, _values, result)
537
+ result = EmbedVariableNode.new( val[0][1] )
538
+
539
+ result
519
540
  end
520
541
  .,.,
521
542
 
522
- module_eval <<'.,.,', 'lib/twowaysql/parser.y', 128
523
- def _reduce_34( val, _values, result )
524
- result = EmbedVariableNode.new( val[0][1] )
525
- result
543
+ module_eval(<<'.,.,', 'parser.y', 126)
544
+ def _reduce_34(val, _values, result)
545
+ result = EmbedVariableNode.new( val[0][1] )
546
+
547
+ result
526
548
  end
527
549
  .,.,
528
550
 
529
- def _reduce_none( val, _values, result )
530
- result
531
- end
551
+ def _reduce_none(val, _values, result)
552
+ val[0]
553
+ end
532
554
 
533
555
  end # class Parser
534
-
535
- end # module TwoWaySQL
556
+ end # module TwoWaySQL
@@ -0,0 +1,3 @@
1
+ module TwoWaySQL
2
+ VERSION = "0.5.0"
3
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,3 @@
1
- begin
2
- require 'spec'
3
- rescue LoadError
4
- require 'rubygems'
5
- gem 'rspec'
6
- require 'spec'
7
- end
8
-
9
1
  $:.unshift(File.dirname(__FILE__) + '/../lib')
2
+ require 'rspec'
10
3
  require 'twowaysql'
11
-
data/twowaysql.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "twowaysql/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "twowaysql"
7
+ s.version = TwoWaySQL::VERSION
8
+ s.authors = ["Takuto Wada"]
9
+ s.email = ["takuto.wada@gmail.com"]
10
+ s.homepage = "https://github.com/twada/twowaysql"
11
+ s.summary = %q{Template Engine for SQL}
12
+ s.description = %q{Template Engine for SQL}
13
+
14
+ s.rubyforge_project = "twowaysql"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ s.add_development_dependency "racc"
23
+ s.add_development_dependency "rspec"
24
+ s.add_development_dependency "cucumber"
25
+ # s.add_runtime_dependency "rest-client"
26
+ end
metadata CHANGED
@@ -1,55 +1,68 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: twowaysql
3
- version: !ruby/object:Gem::Version
4
- version: 0.4.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - Takuto Wada
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2008-11-03 00:00:00 +09:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: newgem
12
+ date: 2012-01-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: racc
16
+ requirement: &70290123701160 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
17
22
  type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.0.5
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: hoe
23
+ prerelease: false
24
+ version_requirements: *70290123701160
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70290123700720 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
27
33
  type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.8.0
34
- version:
34
+ prerelease: false
35
+ version_requirements: *70290123700720
36
+ - !ruby/object:Gem::Dependency
37
+ name: cucumber
38
+ requirement: &70290123700260 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70290123700260
35
47
  description: Template Engine for SQL
36
- email:
48
+ email:
37
49
  - takuto.wada@gmail.com
38
50
  executables: []
39
-
40
51
  extensions: []
41
-
42
- extra_rdoc_files:
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - Gemfile
43
56
  - History.txt
44
57
  - License.txt
45
- - Manifest.txt
46
- - README.rdoc
47
- files:
48
- - History.txt
49
- - License.txt
50
- - Manifest.txt
51
58
  - README.rdoc
59
+ - Rakefile
60
+ - cucumber.yml
61
+ - features/feature_helper.rb
62
+ - features/simple/simple.feature
63
+ - features/simple/steps/stories_steps.rb
52
64
  - issues/issue-001c53236380a42cd8c5a9099bbcc6ec613919c2.yaml
65
+ - issues/issue-0c8cb2854109cb31df8a09b4bb7272fa5af52848.yaml
53
66
  - issues/issue-1cee7e821865a216674832b0186bd92792680571.yaml
54
67
  - issues/issue-25efcfc383f3b0f6c0e2730ae7c2975bb2b3de26.yaml
55
68
  - issues/issue-279105dd0d9f03514d318f5eab5e99c4c2d47fda.yaml
@@ -76,37 +89,49 @@ files:
76
89
  - lib/twowaysql/parser.rb
77
90
  - lib/twowaysql/parser.y
78
91
  - lib/twowaysql/template.rb
92
+ - lib/twowaysql/version.rb
79
93
  - spec/large_sql_spec.rb
80
94
  - spec/learning_regex_spec.rb
81
95
  - spec/spec.opts
82
96
  - spec/spec_helper.rb
83
97
  - spec/twowaysql_spec.rb
84
- has_rdoc: true
85
- homepage: http://twowaysql.rubyforge.org
98
+ - twowaysql.gemspec
99
+ homepage: https://github.com/twada/twowaysql
100
+ licenses: []
86
101
  post_install_message:
87
- rdoc_options:
88
- - --main
89
- - README.rdoc
90
- require_paths:
102
+ rdoc_options: []
103
+ require_paths:
91
104
  - lib
92
- required_ruby_version: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: "0"
97
- version:
98
- required_rubygems_version: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: "0"
103
- version:
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ segments:
112
+ - 0
113
+ hash: 164586672608732535
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ segments:
121
+ - 0
122
+ hash: 164586672608732535
104
123
  requirements: []
105
-
106
124
  rubyforge_project: twowaysql
107
- rubygems_version: 1.2.0
125
+ rubygems_version: 1.8.10
108
126
  signing_key:
109
- specification_version: 2
127
+ specification_version: 3
110
128
  summary: Template Engine for SQL
111
- test_files: []
112
-
129
+ test_files:
130
+ - features/feature_helper.rb
131
+ - features/simple/simple.feature
132
+ - features/simple/steps/stories_steps.rb
133
+ - spec/large_sql_spec.rb
134
+ - spec/learning_regex_spec.rb
135
+ - spec/spec.opts
136
+ - spec/spec_helper.rb
137
+ - spec/twowaysql_spec.rb
data/Manifest.txt DELETED
@@ -1,36 +0,0 @@
1
- History.txt
2
- License.txt
3
- Manifest.txt
4
- README.rdoc
5
- issues/issue-001c53236380a42cd8c5a9099bbcc6ec613919c2.yaml
6
- issues/issue-1cee7e821865a216674832b0186bd92792680571.yaml
7
- issues/issue-25efcfc383f3b0f6c0e2730ae7c2975bb2b3de26.yaml
8
- issues/issue-279105dd0d9f03514d318f5eab5e99c4c2d47fda.yaml
9
- issues/issue-28cde89ed3eb306957edc90595b1d16bf43daf42.yaml
10
- issues/issue-2a172da16d3a59adc8448f2e36ec48b36951e02d.yaml
11
- issues/issue-39023ea09e17e2d64bcef03aa59cdfe38b78ad5b.yaml
12
- issues/issue-4bc308d55ae91f266e656162a4147d356de1166c.yaml
13
- issues/issue-5c973ef5bb074eacca0c6c84f7d27c4267773ea8.yaml
14
- issues/issue-664986b219202ff1948cab717b56e7540f493561.yaml
15
- issues/issue-6daccddf089d11d42bf016897da98f70cf5ab46c.yaml
16
- issues/issue-897995fa10377eabdf597e8e7692f17087c76923.yaml
17
- issues/issue-901f65630639507c8b05b466790e9f22256c6450.yaml
18
- issues/issue-a185b4247f64c1104bc49ebf823b57b5de3d06f8.yaml
19
- issues/issue-bd38c1cdc965d73dd629a81db2de1bcdcf4b10b8.yaml
20
- issues/issue-dca4b19aa13de59838b33e03252bf824670a2d12.yaml
21
- issues/issue-ec698dd75fb717a23045852de2fb367cff119b2e.yaml
22
- issues/issue-f1bd40de5458397d9b142ea3e197e5264e0dcdbf.yaml
23
- issues/issue-f2b773020b54f839c03d899b38b5113c8fd991df.yaml
24
- issues/issue-f39b907d01d7fa93df8c7a9de2e1b5e27727ee0a.yaml
25
- issues/issue-f64d73ed4f9854f1ded77e6496dbf59cfb3770a7.yaml
26
- issues/project.yaml
27
- lib/twowaysql.rb
28
- lib/twowaysql/node.rb
29
- lib/twowaysql/parser.rb
30
- lib/twowaysql/parser.y
31
- lib/twowaysql/template.rb
32
- spec/large_sql_spec.rb
33
- spec/learning_regex_spec.rb
34
- spec/spec.opts
35
- spec/spec_helper.rb
36
- spec/twowaysql_spec.rb