droonga-client 0.1.2 → 0.1.3

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: 8292fde2e0f476c6debeaabe0b41d37b8c66f731
4
- data.tar.gz: 31daa786ee3345ee8134670d17ce6faffd3a1b05
3
+ metadata.gz: d3c30f46700e4f30d650b9022fb6204826bfe5ea
4
+ data.tar.gz: 090d572047be3b5e5a343b5fab5fbf7c3499a8a2
5
5
  SHA512:
6
- metadata.gz: 115acca826fbca886c043b57de60b6dc9a416e026cfba439d9301416fb2ec676093f677e08a47f05a36e459ab1969a391240a1ae48317b8256804d39ef3afe1d
7
- data.tar.gz: 599402230f792b175d6e5208238bf8c094d75bec9a56aaa0d0c88f402680da7e4278929adfee4b35912de41745b04e40bc09786b3837b392625ba642c92972bd
6
+ metadata.gz: 719f8766430eafa483db4db130ff6f57d35e8a56949ff4667524e2d7226cb5383d8cae31038bae56c7adfedd50d160bab4f1ec4799955d592781467882e544a2
7
+ data.tar.gz: 09d56de88c4d4a4ae7bd6cff2d6b3874e7e0c4ea41020a3ccdfb127bc06780c69b8eb745584e162d7bd453634da35a80e7292b5645cd89aff7bc4c03932d798e
data/bin/droonga-request CHANGED
@@ -16,6 +16,7 @@
16
16
  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
17
 
18
18
  require "optparse"
19
+ require "yajl"
19
20
  require "json"
20
21
 
21
22
  require "droonga/client"
@@ -29,6 +30,7 @@ options = {
29
30
  :exit_on_response => true,
30
31
  :receiver_host => "localhost",
31
32
  :receiver_port => 0,
33
+ :report_request => false,
32
34
  :report_elapsed_time => true,
33
35
  }
34
36
 
@@ -84,6 +86,11 @@ parser.on("--receiver-port=PORT", Integer,
84
86
  end
85
87
  parser.separator("")
86
88
  parser.separator("Report:")
89
+ parser.on("--[no-]report-request",
90
+ "Reports request message.",
91
+ "(#{options[:report_request]})") do |report_request|
92
+ options[:report_request] = report_request
93
+ end
87
94
  parser.on("--[no-]report-elapsed-time",
88
95
  "Reports elapsed time.",
89
96
  "(#{options[:report_elapsed_time]})") do |report_elapsed_time|
@@ -91,23 +98,36 @@ parser.on("--[no-]report-elapsed-time",
91
98
  end
92
99
  *rest = parser.parse!(ARGV)
93
100
 
94
- if rest.size < 1
95
- puts("request JSON file is missing.")
96
- exit(false)
97
- end
98
-
99
101
  request_json_file = rest.first
100
102
 
101
103
  client = Droonga::Client.new(options)
102
- request_message = JSON.parse(File.read(request_json_file))
103
- start = Time.now
104
- request = client.request(request_message) do |response|
105
- puts("Elapsed time: #{Time.now - start}") if options[:report_elapsed_time]
106
- begin
107
- puts(JSON.pretty_generate(response))
108
- rescue
109
- p(response)
104
+ json_parser = Yajl::Parser.new
105
+ json_parser.on_parse_complete = lambda do |request_message|
106
+ if options[:report_request]
107
+ print("Request: ")
108
+ begin
109
+ puts(JSON.pretty_generate(request_message))
110
+ rescue
111
+ p(request_message)
112
+ end
113
+ end
114
+ start = Time.now
115
+ request = client.request(request_message) do |response|
116
+ puts("Elapsed time: #{Time.now - start}") if options[:report_elapsed_time]
117
+ begin
118
+ puts(JSON.pretty_generate(response))
119
+ rescue
120
+ p(response)
121
+ end
122
+ break if options[:exit_on_response]
123
+ end
124
+ request.wait
125
+ end
126
+
127
+ if request_json_file
128
+ File.open(request_json_file) do |input|
129
+ json_parser.parse(input)
110
130
  end
111
- break if options[:exit_on_response]
131
+ else
132
+ json_parser.parse($stdin)
112
133
  end
113
- request.wait
data/doc/text/news.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # News
2
2
 
3
+ ## 0.1.3: 2014-02-17
4
+
5
+ ### Improvements
6
+
7
+ * Supported multiple JSONs.
8
+ * Added --report-request option.
9
+
3
10
  ## 0.1.2: 2014-02-09
4
11
 
5
12
  ### Improvements
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Droonga
19
19
  class Client
20
- VERSION = "0.1.2"
20
+ VERSION = "0.1.3"
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droonga-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Droonga Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-09 00:00:00.000000000 Z
11
+ date: 2014-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
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: fluent-logger
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: :runtime
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: rack
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: :runtime
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: yajl-ruby
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: :runtime
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: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.3'
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: '1.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
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: packnga
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
  description: Droonga client for Ruby
@@ -116,8 +116,8 @@ executables:
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
- - .gitignore
120
- - .yardopts
119
+ - ".gitignore"
120
+ - ".yardopts"
121
121
  - Gemfile
122
122
  - LICENSE.txt
123
123
  - README.md
@@ -141,17 +141,17 @@ require_paths:
141
141
  - lib
142
142
  required_ruby_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - '>='
144
+ - - ">="
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - '>='
149
+ - - ">="
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
153
  rubyforge_project:
154
- rubygems_version: 2.0.14
154
+ rubygems_version: 2.2.0
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Droonga client for Ruby