td 0.10.76 → 0.10.77

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ == 2013-05-06 version 0.10.77
2
+
3
+ * Fix 'invalid byte sequence in UTF-8' at job result writing to CSV
4
+ * Fix installed version check mechanizm of auto updater
5
+ * Remove using curses to detect terminal height for Windows unexpected behaviour
6
+ * Set User-Agent header
7
+
8
+
1
9
  == 2013-04-22 version 0.10.76
2
10
 
3
11
  * Add auto update feature for td-toolbelt
@@ -1,3 +1,4 @@
1
+ require 'td/version'
1
2
 
2
3
  module TreasureData
3
4
 
@@ -23,6 +24,7 @@ module Command
23
24
  unless apikey
24
25
  raise ConfigError, "Account is not configured."
25
26
  end
27
+ opts[:user_agent] = "TD: #{TreasureData::VERSION}"
26
28
  Client.new(apikey, opts)
27
29
  end
28
30
 
@@ -251,7 +251,7 @@ module Command
251
251
  require 'csv'
252
252
  CSV.open(output, "w") {|writer|
253
253
  job.result_each {|row|
254
- writer << row.map {|col| col.is_a?(String) ? col.to_s : Yajl.dump(col) }
254
+ writer << row.map {|col| dump_column(col) }
255
255
  }
256
256
  }
257
257
 
@@ -266,7 +266,7 @@ module Command
266
266
  else
267
267
  f.write "\t"
268
268
  end
269
- f.write col.is_a?(String) ? col.to_s : Yajl.dump(col)
269
+ f.write dump_column(col)
270
270
  }
271
271
  f.write "\n"
272
272
  }
@@ -283,18 +283,7 @@ module Command
283
283
  job.result_each {|row|
284
284
  # TODO limit number of rows to show
285
285
  rows << row.map {|v|
286
- if v.is_a?(String)
287
- s = v.to_s
288
- else
289
- s = Yajl.dump(v)
290
- end
291
- # Here does UTF-8 -> UTF-16LE -> UTF8 conversion:
292
- # a) to make sure the string doesn't include invalid byte sequence
293
- # b) to display multi-byte characters as it is
294
- # c) encoding from UTF-8 to UTF-8 doesn't check/replace invalid chars
295
- # d) UTF-16LE was slightly faster than UTF-16BE, UTF-32LE or UTF-32BE
296
- s = s.encode('UTF-16LE', 'UTF-8', :invalid=>:replace, :undef=>:replace).encode!('UTF-8') if s.respond_to?(:encode)
297
- s
286
+ dump_column(v)
298
287
  }
299
288
  }
300
289
 
@@ -306,6 +295,19 @@ module Command
306
295
  puts cmd_render_table(rows, opts)
307
296
  end
308
297
 
298
+ def dump_column(v)
299
+ require 'yajl'
300
+
301
+ s = v.is_a?(String) ? v.to_s : Yajl.dump(v)
302
+ # Here does UTF-8 -> UTF-16LE -> UTF8 conversion:
303
+ # a) to make sure the string doesn't include invalid byte sequence
304
+ # b) to display multi-byte characters as it is
305
+ # c) encoding from UTF-8 to UTF-8 doesn't check/replace invalid chars
306
+ # d) UTF-16LE was slightly faster than UTF-16BE, UTF-32LE or UTF-32BE
307
+ s = s.encode('UTF-16LE', 'UTF-8', :invalid=>:replace, :undef=>:replace).encode!('UTF-8') if s.respond_to?(:encode)
308
+ s
309
+ end
310
+
309
311
  def job_priority_name_of(id)
310
312
  PRIORITY_FORMAT_MAP[id] || 'NORMAL'
311
313
  end
@@ -175,7 +175,7 @@ module Command
175
175
  def table_tail(op)
176
176
  from = nil
177
177
  to = nil
178
- count = nil
178
+ count = 10
179
179
  pretty = nil
180
180
 
181
181
  op.on('-t', '--to TIME', 'end time of logs to get') {|s|
@@ -201,21 +201,6 @@ module Command
201
201
  pretty = b
202
202
  }
203
203
 
204
- if count == nil
205
- # smart count calculation
206
- begin
207
- require "curses"
208
- if Curses.stdscr.maxy - 1 <= 40
209
- count = 5
210
- else
211
- count = 10
212
- end
213
- Curses.close_screen
214
- rescue Exception
215
- count = 5
216
- end
217
- end
218
-
219
204
  db_name, table_name = op.cmd_parse
220
205
 
221
206
  client = get_client
data/lib/td/updater.rb CHANGED
@@ -29,7 +29,7 @@ module TreasureData
29
29
  end
30
30
 
31
31
  def self.installed_client_path
32
- File.expand_path("../../..", __FILE__)
32
+ File.expand_path("../../../../../..", __FILE__)
33
33
  end
34
34
 
35
35
  def self.updated_client_path
@@ -49,7 +49,7 @@ module TreasureData
49
49
  def self.get_client_version_file(path)
50
50
  td_gems = Dir[File.join(path, "vendor/gems/td-*")]
51
51
  td_gems.each { |td_gem|
52
- if td_gem =~ /#{"#{path}\/vendor\/gems\/td-\\d*.\\d*.\\d*"}/
52
+ if td_gem =~ /#{"#{Regexp.escape(path)}\/vendor\/gems\/td-\\d*.\\d*.\\d*"}/
53
53
  return File.join(td_gem, "/lib/td/version.rb")
54
54
  end
55
55
  }
data/lib/td/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module TreasureData
2
2
 
3
- VERSION = '0.10.76'
3
+ VERSION = '0.10.77'
4
4
 
5
5
  end
data/td.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
20
20
  gem.add_dependency "yajl-ruby", "~> 1.1.0"
21
21
  gem.add_dependency "hirb", ">= 0.4.5"
22
22
  gem.add_dependency "parallel", "~> 0.5.19"
23
- gem.add_dependency "td-client", "~> 0.8.48"
23
+ gem.add_dependency "td-client", "~> 0.8.49"
24
24
  gem.add_dependency "td-logger", "~> 0.3.16"
25
25
  gem.add_dependency "rubyzip", "~> 0.9.9"
26
26
  gem.add_development_dependency "rake", "~> 0.9"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.76
4
+ version: 0.10.77
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-23 00:00:00.000000000 Z
12
+ date: 2013-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: 0.8.48
85
+ version: 0.8.49
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: 0.8.48
93
+ version: 0.8.49
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: td-logger
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -262,7 +262,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
262
262
  version: '0'
263
263
  segments:
264
264
  - 0
265
- hash: -1565388258148285832
265
+ hash: 1119082453187569045
266
266
  required_rubygems_version: !ruby/object:Gem::Requirement
267
267
  none: false
268
268
  requirements:
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  version: '0'
272
272
  segments:
273
273
  - 0
274
- hash: -1565388258148285832
274
+ hash: 1119082453187569045
275
275
  requirements: []
276
276
  rubyforge_project:
277
277
  rubygems_version: 1.8.23