sql-maker 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +6 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -0
- data/README.md +49 -0
- data/doc/README.md +8 -0
- data/doc/sql/maker.md +314 -0
- data/doc/sql/maker/condition.md +186 -0
- data/doc/sql/maker/error.md +11 -0
- data/doc/sql/maker/helper.md +48 -0
- data/doc/sql/maker/quoting.md +11 -0
- data/doc/sql/maker/select.md +204 -0
- data/doc/sql/maker/select_set.md +100 -0
- data/doc/sql/maker/util.md +7 -0
- data/doc/sql/query_maker.md +242 -0
- data/lib/sql/maker.rb +0 -335
- data/lib/sql/maker/condition.rb +0 -201
- data/lib/sql/maker/quoting.rb +1 -0
- data/lib/sql/maker/select.rb +1 -212
- data/lib/sql/maker/select_set.rb +0 -116
- data/lib/sql/query_maker.rb +2 -221
- data/scripts/pod2md.rb +41 -0
- data/spec/maker/condition/{make_term_spec.rb → cheatsheat_spec.rb} +3 -3
- data/spec/maker/select/pod_select_spec.rb +3 -3
- data/spec/query_maker/cheatsheet_spec.rb +2 -2
- data/sql-maker.gemspec +1 -1
- metadata +16 -4
data/scripts/pod2md.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
def pod2md(paths)
|
5
|
+
paths.each do |path|
|
6
|
+
code, md = '', ''
|
7
|
+
File.open(path, 'r') do |fp|
|
8
|
+
while line = fp.gets
|
9
|
+
break if line.chomp == "__END__"
|
10
|
+
code << line
|
11
|
+
end
|
12
|
+
while line = fp.gets
|
13
|
+
line.gsub!(/^=encoding.*/, '')
|
14
|
+
line.gsub!(/^=head1/, '#')
|
15
|
+
line.gsub!(/^=head2/, '##')
|
16
|
+
line.gsub!(/^=item/, '###')
|
17
|
+
line.gsub!(/^=over.*/, '')
|
18
|
+
line.gsub!(/^=cut.*/, '')
|
19
|
+
line.gsub!(/^=back.*/, '')
|
20
|
+
line.gsub!(/C<< (.+) >>/, '\1')
|
21
|
+
line.gsub!(/L<([^>]+)>/, '\1')
|
22
|
+
line.gsub!(/B<([^>]+)>/, '\1')
|
23
|
+
line.gsub!(/C<([^>]+)>/, '\1')
|
24
|
+
md << line
|
25
|
+
end
|
26
|
+
end
|
27
|
+
File.open(path, 'w') do |fp|
|
28
|
+
fp.puts code.strip
|
29
|
+
end
|
30
|
+
docpath = path.gsub('lib', 'doc').gsub(/.rb$/, '.md')
|
31
|
+
FileUtils.mkdir_p File.dirname(docpath)
|
32
|
+
File.open(docpath, 'w') do |fp|
|
33
|
+
fp.puts md.strip
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
paths = %w[lib/sql/maker.rb lib/sql/query_maker.rb]
|
39
|
+
paths += Dir.glob('lib/sql/maker/*.rb').to_a
|
40
|
+
pod2md(paths)
|
41
|
+
|
@@ -22,12 +22,12 @@ def test(input, expected_term, expected_bind)
|
|
22
22
|
end
|
23
23
|
|
24
24
|
begin
|
25
|
-
file = File.open("#{ROOT}/
|
25
|
+
file = File.open("#{ROOT}/doc/sql/maker/condition.md")
|
26
26
|
while line = file.gets
|
27
|
-
break if line =~
|
27
|
+
break if line =~ /CONDITION CHEAT SHEET/
|
28
28
|
end
|
29
29
|
while line = file.gets
|
30
|
-
next if line =~
|
30
|
+
next if line =~ /^ *#/
|
31
31
|
src = $1 if line =~ /IN:\s*(.+)\s*$/
|
32
32
|
query = eval($1, binding) if line =~ /OUT QUERY:(.+)/
|
33
33
|
if line =~ /OUT BIND:(.+)/
|
@@ -2,7 +2,7 @@ require_relative '../../spec_helper'
|
|
2
2
|
require 'sql/maker/select'
|
3
3
|
|
4
4
|
begin
|
5
|
-
fname = "#{ROOT}/
|
5
|
+
fname = "#{ROOT}/doc/sql/maker/select.md"
|
6
6
|
file = File.open(fname)
|
7
7
|
lineno = 0
|
8
8
|
while line = file.gets
|
@@ -14,7 +14,7 @@ begin
|
|
14
14
|
it do
|
15
15
|
while line = file.gets
|
16
16
|
lineno += 1
|
17
|
-
next if line =~
|
17
|
+
next if line =~ /^ *#/
|
18
18
|
if line =~ /^[ ]{4,}.*# => (.+)/
|
19
19
|
# puts "----------------------"
|
20
20
|
# puts code
|
@@ -23,7 +23,7 @@ begin
|
|
23
23
|
got.gsub!(/\n/, ' ')
|
24
24
|
got.gsub!(/ +$/, '')
|
25
25
|
expect(got).to be == expected
|
26
|
-
elsif
|
26
|
+
elsif line =~ /^[ ]{4,}(.+)/
|
27
27
|
code += "#{$1}\n"
|
28
28
|
else
|
29
29
|
code = '' # clear
|
@@ -17,9 +17,9 @@ def test(src, expected_term, expected_bind)
|
|
17
17
|
end
|
18
18
|
|
19
19
|
begin
|
20
|
-
file = File.open("#{ROOT}/
|
20
|
+
file = File.open("#{ROOT}/doc/sql/query_maker.md")
|
21
21
|
while line = file.gets
|
22
|
-
break if line =~
|
22
|
+
break if line =~ /CHEAT SHEET/
|
23
23
|
end
|
24
24
|
while line = file.gets
|
25
25
|
src = $1 if line =~ /IN:\s*(.+)\s*$/
|
data/sql-maker.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "sql-maker"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.3"
|
8
8
|
spec.authors = ["Naotoshi Seo"]
|
9
9
|
spec.email = ["sonots@gmail.com"]
|
10
10
|
spec.summary = %q{SQL Builder for Ruby}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sql-maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,11 +88,22 @@ extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
90
|
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
91
92
|
- CHANGELOG.md
|
92
93
|
- Gemfile
|
93
94
|
- LICENSE.txt
|
94
95
|
- README.md
|
95
96
|
- Rakefile
|
97
|
+
- doc/README.md
|
98
|
+
- doc/sql/maker.md
|
99
|
+
- doc/sql/maker/condition.md
|
100
|
+
- doc/sql/maker/error.md
|
101
|
+
- doc/sql/maker/helper.md
|
102
|
+
- doc/sql/maker/quoting.md
|
103
|
+
- doc/sql/maker/select.md
|
104
|
+
- doc/sql/maker/select_set.md
|
105
|
+
- doc/sql/maker/util.md
|
106
|
+
- doc/sql/query_maker.md
|
96
107
|
- lib/sql-maker.rb
|
97
108
|
- lib/sql/maker.rb
|
98
109
|
- lib/sql/maker/condition.rb
|
@@ -105,11 +116,12 @@ files:
|
|
105
116
|
- lib/sql/maker/util.rb
|
106
117
|
- lib/sql/query_maker.rb
|
107
118
|
- scripts/perl2ruby.rb
|
119
|
+
- scripts/pod2md.rb
|
108
120
|
- spec/maker/bind_param_spec.rb
|
109
121
|
- spec/maker/condition/add_raw_spec.rb
|
122
|
+
- spec/maker/condition/cheatsheat_spec.rb
|
110
123
|
- spec/maker/condition/compose_empty_spec.rb
|
111
124
|
- spec/maker/condition/empty_values_spec.rb
|
112
|
-
- spec/maker/condition/make_term_spec.rb
|
113
125
|
- spec/maker/condition/where_spec.rb
|
114
126
|
- spec/maker/delete_spec.rb
|
115
127
|
- spec/maker/insert_empty_spec.rb
|
@@ -159,9 +171,9 @@ summary: SQL Builder for Ruby
|
|
159
171
|
test_files:
|
160
172
|
- spec/maker/bind_param_spec.rb
|
161
173
|
- spec/maker/condition/add_raw_spec.rb
|
174
|
+
- spec/maker/condition/cheatsheat_spec.rb
|
162
175
|
- spec/maker/condition/compose_empty_spec.rb
|
163
176
|
- spec/maker/condition/empty_values_spec.rb
|
164
|
-
- spec/maker/condition/make_term_spec.rb
|
165
177
|
- spec/maker/condition/where_spec.rb
|
166
178
|
- spec/maker/delete_spec.rb
|
167
179
|
- spec/maker/insert_empty_spec.rb
|