jrubysql 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/jrubysql.gemspec +6 -6
- data/lib/jrubysql/controller.rb +9 -0
- data/lib/jrubysql/doc/help.txt.erb +1 -0
- data/lib/jrubysql/input/console.rb +2 -0
- data/lib/jrubysql/messages.yml +3 -0
- data/lib/jrubysql/output/cterm.rb +3 -3
- data/lib/jrubysql/output/term.rb +26 -3
- data/lib/jrubysql/version.rb +1 -1
- data/test/bin_helper.rb +1 -1
- metadata +190 -247
data/jrubysql.gemspec
CHANGED
@@ -24,11 +24,11 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_development_dependency "guard"
|
25
25
|
s.add_development_dependency "guard-test"
|
26
26
|
|
27
|
-
s.add_runtime_dependency "jdbc-helper", '~> 0.
|
28
|
-
s.add_runtime_dependency "insensitive_hash", '~> 0.3.
|
29
|
-
s.add_runtime_dependency "tabularize", '~> 0.2.
|
30
|
-
s.add_runtime_dependency "each_sql", '~> 0.
|
31
|
-
s.add_runtime_dependency "highline", '~> 1.6.
|
32
|
-
s.add_runtime_dependency "ansi", '~> 1.4.
|
27
|
+
s.add_runtime_dependency "jdbc-helper", '~> 0.8.0'
|
28
|
+
s.add_runtime_dependency "insensitive_hash", '~> 0.3.3'
|
29
|
+
s.add_runtime_dependency "tabularize", '~> 0.2.9'
|
30
|
+
s.add_runtime_dependency "each_sql", '~> 0.4.0'
|
31
|
+
s.add_runtime_dependency "highline", '~> 1.6.19'
|
32
|
+
s.add_runtime_dependency "ansi", '~> 1.4.3'
|
33
33
|
s.add_runtime_dependency "erubis", '~> 2.7.0'
|
34
34
|
end
|
data/lib/jrubysql/controller.rb
CHANGED
@@ -160,6 +160,15 @@ private
|
|
160
160
|
else
|
161
161
|
@output.error m(:invalid_autocommit, params)
|
162
162
|
end
|
163
|
+
when :display
|
164
|
+
params = params.downcase
|
165
|
+
if %w[table pairs].include? params
|
166
|
+
if @output.respond_to?(:display_mode=)
|
167
|
+
@output.display_mode = params.to_sym
|
168
|
+
end
|
169
|
+
else
|
170
|
+
@output.error m(:invalid_display)
|
171
|
+
end
|
163
172
|
else
|
164
173
|
# TODO
|
165
174
|
@output.error m(:unknown_command)
|
data/lib/jrubysql/messages.yml
CHANGED
@@ -18,7 +18,7 @@ class CTerm < Term
|
|
18
18
|
File.join(
|
19
19
|
File.dirname(__FILE__), "color_scheme/default.yml"))).merge(colors || {})
|
20
20
|
|
21
|
-
@ccode = @colors.inject(Hash.new('')) { |h, pair|
|
21
|
+
@ccode = @colors.inject(Hash.new('')) { |h, pair|
|
22
22
|
k, v = pair
|
23
23
|
h[k.to_sym] = v.strip.split(/\s+/).map { |code| ANSI::Code.send(code) rescue '' }.join
|
24
24
|
h
|
@@ -31,7 +31,7 @@ class CTerm < Term
|
|
31
31
|
|
32
32
|
def cursor empty
|
33
33
|
if empty
|
34
|
-
wrap('jrubysql', @ccode[:prompt1]) +
|
34
|
+
wrap('jrubysql', @ccode[:prompt1]) +
|
35
35
|
wrap('> ', @ccode[:prompt2])
|
36
36
|
else
|
37
37
|
wrap(' -', @ccode[:prompt3]) +
|
@@ -100,7 +100,7 @@ private
|
|
100
100
|
def wrap text, color
|
101
101
|
color + text + (color.empty? ? '' : reset)
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
end#CTerm
|
105
105
|
end#Output
|
106
106
|
end#JRubySQL
|
data/lib/jrubysql/output/term.rb
CHANGED
@@ -27,6 +27,7 @@ class Term
|
|
27
27
|
[ terminal.getTerminalWidth, terminal.getTerminalHeight ]
|
28
28
|
end
|
29
29
|
}
|
30
|
+
self.display_mode = :table
|
30
31
|
trap 'INT' do
|
31
32
|
Thread.main.raise Interrupt
|
32
33
|
end
|
@@ -76,7 +77,7 @@ class Term
|
|
76
77
|
|
77
78
|
if ret[:set?]
|
78
79
|
begin
|
79
|
-
cnt =
|
80
|
+
cnt = send(@printer, ret[:result])
|
80
81
|
result m(:rows_returned, cnt, cnt > 1 ? 's' : '', elapsed)
|
81
82
|
rescue Interrupt
|
82
83
|
warn m(:interrupted)
|
@@ -90,13 +91,35 @@ class Term
|
|
90
91
|
puts
|
91
92
|
end
|
92
93
|
|
94
|
+
def display_mode= mode
|
95
|
+
@printer = "print_#{mode}".to_sym
|
96
|
+
end
|
97
|
+
|
93
98
|
private
|
99
|
+
def print_pairs ret
|
100
|
+
cnt = 0
|
101
|
+
ret.each do |row|
|
102
|
+
labels = row.labels.map { |e| e + ': ' }
|
103
|
+
max_label_len = labels.map(&:length).max
|
104
|
+
pairs = labels.zip row.to_a
|
105
|
+
pairs.each_with_index do |pair, idx|
|
106
|
+
print (idx == 0) ? '- ' : ' '
|
107
|
+
l, v = pair
|
108
|
+
print l.ljust(max_label_len, ' ')
|
109
|
+
puts v.to_s
|
110
|
+
end
|
111
|
+
puts
|
112
|
+
cnt += 1
|
113
|
+
end
|
114
|
+
cnt
|
115
|
+
end
|
116
|
+
|
94
117
|
def print_table ret, tabularize_opts = {}
|
95
118
|
cnt = 0
|
96
119
|
term_size = @get_terminal_size.call
|
97
|
-
lines = [(term_size
|
120
|
+
lines = [(term_size[1] rescue JRubySQL::Constants::MAX_SCREEN_ROWS) - 5,
|
98
121
|
JRubySQL::Constants::MIN_SCREEN_ROWS].max
|
99
|
-
cols = (term_size
|
122
|
+
cols = (term_size[0] rescue nil)
|
100
123
|
ret.each_slice(lines) do |slice|
|
101
124
|
cnt += slice.length
|
102
125
|
|
data/lib/jrubysql/version.rb
CHANGED
data/test/bin_helper.rb
CHANGED
metadata
CHANGED
@@ -1,264 +1,207 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: jrubysql
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 0.1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.8
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
- Junegunn Choi
|
9
|
-
autorequire:
|
7
|
+
authors:
|
8
|
+
- Junegunn Choi
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
- !ruby/object:Gem::
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
- !ruby/object:Gem::
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
- - ~>
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: 0.3.1
|
139
|
-
none: false
|
140
|
-
requirement: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- - ~>
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: 0.3.1
|
145
|
-
none: false
|
146
|
-
prerelease: false
|
147
|
-
type: :runtime
|
148
|
-
- !ruby/object:Gem::Dependency
|
149
|
-
name: highline
|
150
|
-
version_requirements: !ruby/object:Gem::Requirement
|
151
|
-
requirements:
|
152
|
-
- - ~>
|
153
|
-
- !ruby/object:Gem::Version
|
154
|
-
version: 1.6.11
|
155
|
-
none: false
|
156
|
-
requirement: !ruby/object:Gem::Requirement
|
157
|
-
requirements:
|
158
|
-
- - ~>
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
version: 1.6.11
|
161
|
-
none: false
|
162
|
-
prerelease: false
|
163
|
-
type: :runtime
|
164
|
-
- !ruby/object:Gem::Dependency
|
165
|
-
name: ansi
|
166
|
-
version_requirements: !ruby/object:Gem::Requirement
|
167
|
-
requirements:
|
168
|
-
- - ~>
|
169
|
-
- !ruby/object:Gem::Version
|
170
|
-
version: 1.4.2
|
171
|
-
none: false
|
172
|
-
requirement: !ruby/object:Gem::Requirement
|
173
|
-
requirements:
|
174
|
-
- - ~>
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
version: 1.4.2
|
177
|
-
none: false
|
178
|
-
prerelease: false
|
179
|
-
type: :runtime
|
180
|
-
- !ruby/object:Gem::Dependency
|
181
|
-
name: erubis
|
182
|
-
version_requirements: !ruby/object:Gem::Requirement
|
183
|
-
requirements:
|
184
|
-
- - ~>
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
version: 2.7.0
|
187
|
-
none: false
|
188
|
-
requirement: !ruby/object:Gem::Requirement
|
189
|
-
requirements:
|
190
|
-
- - ~>
|
191
|
-
- !ruby/object:Gem::Version
|
192
|
-
version: 2.7.0
|
193
|
-
none: false
|
194
|
-
prerelease: false
|
195
|
-
type: :runtime
|
12
|
+
|
13
|
+
date: 2013-09-12 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: test-unit
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :development
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: mocha
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.11.0
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: guard
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: guard-test
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
|
+
version_requirements: *id004
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: jdbc-helper
|
61
|
+
prerelease: false
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.8.0
|
68
|
+
type: :runtime
|
69
|
+
version_requirements: *id005
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: insensitive_hash
|
72
|
+
prerelease: false
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 0.3.3
|
79
|
+
type: :runtime
|
80
|
+
version_requirements: *id006
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: tabularize
|
83
|
+
prerelease: false
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.2.9
|
90
|
+
type: :runtime
|
91
|
+
version_requirements: *id007
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: each_sql
|
94
|
+
prerelease: false
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ~>
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 0.4.0
|
101
|
+
type: :runtime
|
102
|
+
version_requirements: *id008
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: highline
|
105
|
+
prerelease: false
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ~>
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 1.6.19
|
112
|
+
type: :runtime
|
113
|
+
version_requirements: *id009
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: ansi
|
116
|
+
prerelease: false
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ~>
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 1.4.3
|
123
|
+
type: :runtime
|
124
|
+
version_requirements: *id010
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: erubis
|
127
|
+
prerelease: false
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ~>
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 2.7.0
|
134
|
+
type: :runtime
|
135
|
+
version_requirements: *id011
|
196
136
|
description: SQL client for any JDBC-compliant database. Written in JRuby.
|
197
|
-
email:
|
198
|
-
- junegunn.c@gmail.com
|
199
|
-
executables:
|
200
|
-
- jrubysql
|
137
|
+
email:
|
138
|
+
- junegunn.c@gmail.com
|
139
|
+
executables:
|
140
|
+
- jrubysql
|
201
141
|
extensions: []
|
142
|
+
|
202
143
|
extra_rdoc_files: []
|
203
|
-
|
204
|
-
|
205
|
-
-
|
206
|
-
-
|
207
|
-
-
|
208
|
-
-
|
209
|
-
-
|
210
|
-
-
|
211
|
-
-
|
212
|
-
- jrubysql
|
213
|
-
-
|
214
|
-
- lib/jrubysql
|
215
|
-
- lib/jrubysql/
|
216
|
-
- lib/jrubysql/
|
217
|
-
- lib/jrubysql/
|
218
|
-
- lib/jrubysql/
|
219
|
-
- lib/jrubysql/input/
|
220
|
-
- lib/jrubysql/input/
|
221
|
-
- lib/jrubysql/
|
222
|
-
- lib/jrubysql/messages.
|
223
|
-
- lib/jrubysql/
|
224
|
-
- lib/jrubysql/
|
225
|
-
- lib/jrubysql/output/
|
226
|
-
- lib/jrubysql/output/
|
227
|
-
- lib/jrubysql/output/
|
228
|
-
- lib/jrubysql/
|
229
|
-
- lib/jrubysql/
|
230
|
-
-
|
231
|
-
- test/
|
232
|
-
- test/
|
233
|
-
- test/
|
144
|
+
|
145
|
+
files:
|
146
|
+
- .gitignore
|
147
|
+
- CHANGELOG.md
|
148
|
+
- Gemfile
|
149
|
+
- Guardfile
|
150
|
+
- LICENSE.txt
|
151
|
+
- README.md
|
152
|
+
- Rakefile
|
153
|
+
- bin/jrubysql
|
154
|
+
- jrubysql.gemspec
|
155
|
+
- lib/jrubysql.rb
|
156
|
+
- lib/jrubysql/config.rb
|
157
|
+
- lib/jrubysql/constants.rb
|
158
|
+
- lib/jrubysql/controller.rb
|
159
|
+
- lib/jrubysql/doc/help.txt.erb
|
160
|
+
- lib/jrubysql/input/console.rb
|
161
|
+
- lib/jrubysql/input/input.rb
|
162
|
+
- lib/jrubysql/input/script.rb
|
163
|
+
- lib/jrubysql/messages.rb
|
164
|
+
- lib/jrubysql/messages.yml
|
165
|
+
- lib/jrubysql/option_parser.rb
|
166
|
+
- lib/jrubysql/output/color_scheme/default.yml
|
167
|
+
- lib/jrubysql/output/csv.rb
|
168
|
+
- lib/jrubysql/output/cterm.rb
|
169
|
+
- lib/jrubysql/output/term.rb
|
170
|
+
- lib/jrubysql/rdbms.rb
|
171
|
+
- lib/jrubysql/version.rb
|
172
|
+
- test/bin_helper.rb
|
173
|
+
- test/helper.rb
|
174
|
+
- test/test_jrubysql.rb
|
175
|
+
- test/test_option_parser.rb
|
234
176
|
homepage: https://github.com/junegunn/jrubysql
|
235
177
|
licenses: []
|
236
|
-
|
178
|
+
|
179
|
+
post_install_message:
|
237
180
|
rdoc_options: []
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
- - ! '>='
|
243
|
-
- !ruby/object:Gem::Version
|
244
|
-
version: !binary |-
|
245
|
-
MA==
|
181
|
+
|
182
|
+
require_paths:
|
183
|
+
- lib
|
184
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
246
185
|
none: false
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
MA==
|
186
|
+
requirements:
|
187
|
+
- - ">="
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: "0"
|
190
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
191
|
none: false
|
192
|
+
requirements:
|
193
|
+
- - ">="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: "0"
|
254
196
|
requirements: []
|
197
|
+
|
255
198
|
rubyforge_project: jrubysql
|
256
199
|
rubygems_version: 1.8.24
|
257
|
-
signing_key:
|
200
|
+
signing_key:
|
258
201
|
specification_version: 3
|
259
202
|
summary: SQL client for any JDBC-compliant database.
|
260
|
-
test_files:
|
261
|
-
- test/bin_helper.rb
|
262
|
-
- test/helper.rb
|
263
|
-
- test/test_jrubysql.rb
|
264
|
-
- test/test_option_parser.rb
|
203
|
+
test_files:
|
204
|
+
- test/bin_helper.rb
|
205
|
+
- test/helper.rb
|
206
|
+
- test/test_jrubysql.rb
|
207
|
+
- test/test_option_parser.rb
|