grnline 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44d56d43a90369f18d1aa19fdc07bf421dcecf5e
4
- data.tar.gz: 5bbe730053f6f9f9e7f078c092db8f18ccda8329
3
+ metadata.gz: af8d8305f3af4244da380c43377f2f5cbcf5ea0a
4
+ data.tar.gz: 5c0473f0bc9042293eb3a3fb26229e0d6afb8dc2
5
5
  SHA512:
6
- metadata.gz: 0c52903b18b55ae289e9230148741617add595ce573f552e7290c7694fd7a4198a4d66c39b60574e3c7df535d694995aa6fb3ee6d0c393a8f2911ff642ae4407
7
- data.tar.gz: cf0c35b7c52faadc58414278d4fd5fd93934e075dbdd3b556ae8de1887517ff47c88ebe91bbad34c0fcb8ac93dbade18ba81ca76c2dc9d2f7c7b9f993155885e
6
+ metadata.gz: aaacb3af8ae2e539aa9ee37fbcdbb38bc65307bf979c3157ffe617542ccab65b941bbb14d0e94cea41255c029e74792db57de1dc1e536bc254ef782275120cda
7
+ data.tar.gz: e51156887c819280f87227c69247fd41c5e58af9d52990a3ca3c3eab6235e39e95958d5ffef34c093ec806af7e857dfe25fb5916b863d3644c1ee4eaefca1a37
data/README.md CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  ## Description
6
6
 
7
- GrnLine is the wrapper for the interactive mode of [groonga](http://groonga.org/).
7
+ GrnLine is the wrapper for the interactive mode of [Groonga](http://groonga.org/).
8
8
 
9
- GrnLine is created by Ruby.
9
+ Grnline is created by Ruby.
10
10
  This uses [grnwrap](https://github.com/michisu/grnwrap) as a
11
11
  reference. grnwrap is created by Python.
12
12
 
@@ -18,17 +18,22 @@ $ gem install grnline
18
18
 
19
19
  ## Usage
20
20
 
21
- You can use the options of groonga as ones for grnline. For example,
22
- you execute groonga with a new database:
21
+ You can use the options of Groonga as ones for Grnline. For example,
22
+ you execute Groonga with a new database:
23
23
 
24
- $ grnline -n <groonga-db>
24
+ $ grnline -n <Groonga-db>
25
25
 
26
- Then, grnline has the own options. Please see ```grnline -- -h```.
27
- When you want to know groonga's options, please type ```grnline -h```.
26
+ Then, Grnline has the own options. Please see ```grnline -- -h```.
27
+ When you want to know Groonga's options, please type ```grnline -h```.
28
+
29
+ ## Depedencies
30
+
31
+ * Ruby >= 1.9.3
32
+ * Groonga
28
33
 
29
34
  ## Author
30
35
 
31
- Haruka Yoshihara (yshr04hrk at gmail.com)
36
+ Haruka Yoshihara (h.yoshihara@everyleaf.com)
32
37
 
33
38
  ## Contributing
34
39
 
@@ -1,5 +1,55 @@
1
1
  # News
2
2
 
3
+ ## <a id="0-0-4">0.0.4</a>: 2014-03-28
4
+
5
+ ### Implements
6
+
7
+ * Showed lazy pretty print JSON responses.
8
+ Using lazy pretty print, short arrays are shown as the line, and values in hashes are align verticaly.
9
+
10
+ e.g.) a response of status command.
11
+ Before:
12
+
13
+ ```
14
+ [
15
+ [
16
+ 0,
17
+ 1369743525.62977,
18
+ 9.20295715332031e-05
19
+ ],
20
+ {
21
+ "alloc_count":129,
22
+ "starttime":1369743522,
23
+ "uptime":3,
24
+ "version":"3.0.1",
25
+ "n_queries":0,
26
+ "cache_hit_rate":0.0,
27
+ "command_version":1,
28
+ "default_command_version":1,
29
+ "max_command_version":2
30
+ }
31
+ ]
32
+ ```
33
+
34
+ After:
35
+
36
+ ```
37
+ [
38
+ [0, 1369743525.62977, 9.20295715332031e-05],
39
+ {
40
+ "alloc_count" :129,
41
+ "starttime" :1369743522,
42
+ "uptime" :3,
43
+ "version" :"3.0.1",
44
+ "n_queries" :0,
45
+ "cache_hit_rate" :0.0,
46
+ "command_version" :1,
47
+ "default_command_version":1,
48
+ "max_command_version" :2
49
+ }
50
+ ]
51
+ ```
52
+
3
53
  ## <a id="0-0-3">0.0.3</a>: 2013-11-23
4
54
 
5
55
  ### Improvements
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  end
38
38
  spec.require_paths = ["lib"]
39
39
 
40
- spec.add_runtime_dependency("json")
40
+ spec.add_runtime_dependency("lazy-pp-json")
41
41
  spec.add_development_dependency("packnga")
42
42
  spec.add_development_dependency("bundler")
43
43
  spec.add_development_dependency("rake")
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module GrnLine
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  require "readline"
4
- require "json"
4
+ require "lazy-pp-json"
5
5
  require "open3"
6
6
  require "grnline/options-parser"
7
7
  require "grnline/history"
@@ -135,7 +135,7 @@ module GrnLine
135
135
  response = raw_response
136
136
  if @options.use_pretty_print
137
137
  begin
138
- response = JSON.pretty_generate(JSON.parse(response))
138
+ response = Lazy::PP::JSON.new(response)
139
139
  rescue
140
140
  end
141
141
  end
@@ -144,13 +144,20 @@ module GrnLine
144
144
  end
145
145
 
146
146
  def output(object)
147
+ output = nil
147
148
  if @options.output.instance_of?(String)
148
- File.open(@options.output, "w") do |file|
149
- file.puts(object)
150
- end
149
+ output = File.open(@options.output, "w")
151
150
  else
152
- @options.output.puts(object)
151
+ output = @options.output
153
152
  end
153
+
154
+ if object.instance_of?(Lazy::PP::JSON)
155
+ PP.pp(object, output)
156
+ else
157
+ output.puts(object)
158
+ end
159
+
160
+ output.close if output.instance_of?(File)
154
161
  end
155
162
 
156
163
  def execute(command)
@@ -111,21 +111,17 @@ class TestWrapper < Test::Unit::TestCase
111
111
  def pretty_response
112
112
  <<-RESPONSE
113
113
  [
114
- [
115
- 0,
116
- 1369743525.62977,
117
- 9.20295715332031e-05
118
- ],
114
+ [0, 1369743525.62977, 9.20295715332031e-05],
119
115
  {
120
- "alloc_count": 129,
121
- "starttime": 1369743522,
122
- "uptime": 3,
123
- "version": "3.0.1",
124
- "n_queries": 0,
125
- "cache_hit_rate": 0.0,
126
- "command_version": 1,
127
- "default_command_version": 1,
128
- "max_command_version": 2
116
+ "alloc_count" :129,
117
+ "starttime" :1369743522,
118
+ "uptime" :3,
119
+ "version" :"3.0.1",
120
+ "n_queries" :0,
121
+ "cache_hit_rate" :0.0,
122
+ "command_version" :1,
123
+ "default_command_version":1,
124
+ "max_command_version" :2
129
125
  }
130
126
  ]
131
127
  RESPONSE
metadata CHANGED
@@ -1,129 +1,129 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grnline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Haruka Yoshihara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-23 00:00:00.000000000 Z
11
+ date: 2014-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: json
14
+ name: lazy-pp-json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: packnga
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: test-unit
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: test-unit-rr
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: test-unit-notify
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: redcarpet
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: |
126
- GrnLine is created by Ruby.
126
+ Grnline is created by Ruby.
127
127
  This uses [grnwrap](https://github.com/michisu/grnwrap) as a
128
128
  reference. grnwrap is created by Python.
129
129
  email:
@@ -133,24 +133,24 @@ executables:
133
133
  extensions: []
134
134
  extra_rdoc_files: []
135
135
  files:
136
- - README.md
136
+ - Gemfile
137
137
  - LICENSE.txt
138
- - TODO
138
+ - README.md
139
139
  - Rakefile
140
- - Gemfile
140
+ - TODO
141
+ - bin/grnline
142
+ - doc/text/news.md
141
143
  - grnline.gemspec
144
+ - lib/grnline.rb
142
145
  - lib/grnline/history.rb
143
146
  - lib/grnline/options-parser.rb
144
147
  - lib/grnline/version.rb
145
148
  - lib/grnline/wrapper.rb
146
- - lib/grnline.rb
147
- - doc/text/news.md
148
149
  - test/bin/fake-groonga.rb
149
150
  - test/run-test.rb
150
151
  - test/test-history.rb
151
152
  - test/test-options-parser.rb
152
153
  - test/test-wrapper.rb
153
- - bin/grnline
154
154
  homepage:
155
155
  licenses:
156
156
  - MIT
@@ -161,20 +161,20 @@ require_paths:
161
161
  - lib
162
162
  required_ruby_version: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '>='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  requirements:
169
- - - '>='
169
+ - - ">="
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
172
  requirements: []
173
173
  rubyforge_project:
174
- rubygems_version: 2.0.3
174
+ rubygems_version: 2.2.0
175
175
  signing_key:
176
176
  specification_version: 4
177
- summary: GrnLine is the wrapper for the interactive mode of [groonga](http://groonga.org/).
177
+ summary: GrnLine is the wrapper for the interactive mode of [Groonga](http://groonga.org/).
178
178
  test_files:
179
179
  - test/bin/fake-groonga.rb
180
180
  - test/run-test.rb