embulk 0.6.6 → 0.6.7

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: 06d9d42d47c71ddd9c290abc3fd90eae09756157
4
- data.tar.gz: 4a1104ff4fb9657b5a2305120d8ffe0f2992c9ff
3
+ metadata.gz: c812083e751a2593484a749af8ac7f0519cbe5f7
4
+ data.tar.gz: d7d74ec957f1cbb9951850199524a3e039be4640
5
5
  SHA512:
6
- metadata.gz: 9df10a5c5d6a0c77b38352f96d5f1cedbd658c0ac5a41e1720a3c8baa9f65685c742a34d0e6569d6bbb3d2c2e43423b48e3cc8d167dd4f8982568ea92f29d4eb
7
- data.tar.gz: 75887fa0b97bc9750cca1d4abdeb500d0f8e83fd0ede84f467e671c83754acf0e3abb1a82a18c106d9e1250587f5b286a1c598fadeb7249d0c4320df0279f47c
6
+ metadata.gz: 9f727dfbf18ab2dc4e768b7ea132413c30fc63330a6aa3c0d5ffc4285623c7f03eaa66c177ed9c4c57d1232f59e582583cb2255c73d8f0a4045831f126f040de
7
+ data.tar.gz: a0218b10b993ad8cb09afc3fc7f94454da50410979e70a74375d2c3d739077e20ae16b27e0fb30d369137cc8c29b6bddaace9955746f66fcb3ae8c72c7a39e82
data/build.gradle CHANGED
@@ -11,7 +11,7 @@ def release_projects = [project(":embulk-core"), project(":embulk-standards")]
11
11
 
12
12
  allprojects {
13
13
  group = 'org.embulk'
14
- version = '0.6.6'
14
+ version = '0.6.7'
15
15
 
16
16
  ext {
17
17
  jrubyVersion = '1.7.19'
@@ -40,7 +40,7 @@ allprojects {
40
40
  }
41
41
 
42
42
  dryRun = false
43
- publish = false // TODO automate uploading embulk.jar and make this true
43
+ publish = true
44
44
 
45
45
  pkg {
46
46
  userOrg = 'embulk'
@@ -15,15 +15,15 @@ configurations {
15
15
  // determine which dependencies have updates: $ gradle dependencyUpdates
16
16
  dependencies {
17
17
  compile 'com.google.guava:guava:18.0'
18
- compile 'com.google.inject:guice:3.0'
19
- compile 'com.google.inject.extensions:guice-multibindings:3.0'
18
+ compile 'com.google.inject:guice:4.0'
19
+ compile 'com.google.inject.extensions:guice-multibindings:4.0'
20
20
  compile 'javax.inject:javax.inject:1'
21
- compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.0'
22
- compile 'com.fasterxml.jackson.core:jackson-core:2.5.0'
23
- compile 'com.fasterxml.jackson.core:jackson-databind:2.5.0'
24
- compile 'com.fasterxml.jackson.datatype:jackson-datatype-guava:2.5.0'
25
- compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.5.0'
26
- compile 'com.fasterxml.jackson.module:jackson-module-guice:2.5.0'
21
+ compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.3'
22
+ compile 'com.fasterxml.jackson.core:jackson-core:2.5.3'
23
+ compile 'com.fasterxml.jackson.core:jackson-databind:2.5.3'
24
+ compile 'com.fasterxml.jackson.datatype:jackson-datatype-guava:2.5.3'
25
+ compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.5.3'
26
+ compile 'com.fasterxml.jackson.module:jackson-module-guice:2.5.3'
27
27
  compile 'log4j:log4j:1.2.17'
28
28
  compile 'org.slf4j:slf4j-api:1.7.10'
29
29
  compile 'org.slf4j:slf4j-log4j12:1.7.10'
@@ -4,6 +4,7 @@ Release Notes
4
4
  .. toctree::
5
5
  :maxdepth: 1
6
6
 
7
+ release/release-0.6.7
7
8
  release/release-0.6.6
8
9
  release/release-0.6.5
9
10
  release/release-0.6.4
@@ -0,0 +1,17 @@
1
+ Release 0.6.7
2
+ ==================================
3
+
4
+ Built-in plugins
5
+ ------------------
6
+
7
+ * ``guess-csv`` guesses "t" and "f" as a boolean value.
8
+
9
+ General Changes
10
+ ------------------
11
+
12
+ * Added ``selfupdate`` subcommand. This command updates embulk itself to the released latest version.
13
+ * Upgraded library dependency of Guice from 3.0 to 4.0.
14
+
15
+ Release Date
16
+ ------------------
17
+ 2015-05-06
@@ -30,7 +30,7 @@ public class CsvParserPlugin
30
30
  ImmutableSet.of(
31
31
  "true", "True", "TRUE",
32
32
  "yes", "Yes", "YES",
33
- "y", "Y",
33
+ "t", "T", "y", "Y",
34
34
  "on", "On", "ON",
35
35
  "1");
36
36
 
@@ -173,6 +173,13 @@ examples:
173
173
  ]
174
174
  args = 2..2
175
175
 
176
+ when :selfupdate
177
+ op.remove # remove --bundle
178
+ op.on('-f', "Skip corruption check", TrueClass) do |b|
179
+ options[:force] = true
180
+ end
181
+ args = 0..0
182
+
176
183
  when :gem
177
184
  require 'rubygems/gem_runner'
178
185
  Gem::GemRunner.new.run argv
@@ -297,6 +304,10 @@ examples:
297
304
  require 'embulk/command/embulk_new_plugin'
298
305
  Embulk.new_plugin(name, language, category)
299
306
 
307
+ when :selfupdate
308
+ require 'embulk/command/embulk_selfupdate'
309
+ Embulk.selfupdate(options)
310
+
300
311
  else
301
312
  require 'json'
302
313
 
@@ -327,8 +338,14 @@ examples:
327
338
  end
328
339
 
329
340
  def self.home(dir)
330
- home = File.expand_path('../../..', File.dirname(__FILE__))
331
- File.join(home, dir)
341
+ jar, resource = __FILE__.split("!")
342
+ if resource
343
+ home = resource.split("/")[0..-3].join("/")
344
+ "#{jar}!#{home}/#{dir}"
345
+ else
346
+ home = File.expand_path('../../..', File.dirname(__FILE__))
347
+ File.join(home, dir)
348
+ end
332
349
  end
333
350
 
334
351
  def self.default_gem_home
@@ -395,6 +412,7 @@ examples:
395
412
  STDERR.puts " # plugin path is #{ENV['GEM_HOME']}"
396
413
  STDERR.puts " new <category> <name> # generates new plugin template"
397
414
  STDERR.puts " example [path] # creates an example config file and csv file to try embulk."
415
+ STDERR.puts " selfupdate # upgrades embulk to the latest released version."
398
416
  STDERR.puts ""
399
417
  if message
400
418
  STDERR.puts "error: #{message}"
@@ -0,0 +1,84 @@
1
+ module Embulk
2
+ def self.selfupdate(options={})
3
+ require 'uri'
4
+
5
+ jar, resource = __FILE__.split("!", 2)
6
+ jar_path = URI.parse(jar).path rescue jar
7
+ unless resource && File.file?(jar_path)
8
+ STDERR.puts ""
9
+ STDERR.puts "Embulk is not installed by a single jar. Selfupdate is not supported."
10
+ STDERR.puts "If you used gem to install embulk, please run: "
11
+ STDERR.puts ""
12
+ STDERR.puts " $ gem install embulk"
13
+ STDERR.puts ""
14
+ raise SystemExit.new(1)
15
+ end
16
+
17
+ puts "Checking the latest version..."
18
+ latest_version = check_latest_version
19
+
20
+ if Gem::Version.new(latest_version) <= Gem::Version.new(Embulk::VERSION)
21
+ puts "Already up-to-date. #{latest_version} is the latest version."
22
+ return
23
+ end
24
+
25
+ puts "Found new version #{latest_version}."
26
+
27
+ unless File.writable?(jar_path)
28
+ STDERR.puts ""
29
+ STDERR.puts "Installation path #{jar_path} is not writable."
30
+ STDERR.puts "Dou you need to run with sudo?"
31
+ STDERR.puts ""
32
+ raise SystemExit.new(1)
33
+ end
34
+
35
+ url = "https://dl.bintray.com/embulk/maven/embulk-#{latest_version}.jar"
36
+ puts "Downloading #{url} ..."
37
+
38
+ require 'open-uri'
39
+ require 'tempfile'
40
+ Tempfile.open(["embulk-selfupdate", ".jar"]) do |tmp|
41
+ tmp.chmod(File.stat(jar_path).mode)
42
+ OpenURI.open_uri(url) do |f|
43
+ IO.copy_stream(f, tmp)
44
+ end
45
+ tmp.close(false)
46
+
47
+ # check corruption
48
+ unless options[:force]
49
+ begin
50
+ data = File.read("jar:#{java.io.File.new(tmp.path).toURI.toURL}!/embulk/version.rb")
51
+ m = Module.new
52
+ m.module_eval(data)
53
+ unless m::Embulk::VERSION == latest_version
54
+ raise "Embulk::VERSION does not match with #{latest_version}"
55
+ end
56
+ rescue => e
57
+ STDERR.puts "Corruption checking failed (#{e})."
58
+ STDERR.puts "This version might include incompatible changes."
59
+ STDERR.puts "Please add '-f' argument to selfupdate command to skip checking."
60
+ raise SystemExit.new(1, e.to_s)
61
+ end
62
+ end
63
+
64
+ File.rename(tmp.path, jar_path)
65
+ end
66
+
67
+ puts "Updated to #{latest_version}."
68
+ end
69
+
70
+ def self.check_latest_version
71
+ require 'net/https'
72
+ bintray = Net::HTTP.new('bintray.com', 443)
73
+ bintray.use_ssl = true
74
+ bintray.verify_mode = OpenSSL::SSL::VERIFY_NONE
75
+ bintray.start do
76
+ response = bintray.get('/embulk/maven/embulk/_latestVersion')
77
+ raise "Expected response code 302 Found but got #{response.code}" if response.code != "302"
78
+ location = response["Location"].to_s
79
+ m = /(\d+\.\d+[^\/]+)/.match(location)
80
+ raise "Cound not find version number in Location header '#{location}'" unless m
81
+ return m[1]
82
+ end
83
+ end
84
+ end
@@ -64,13 +64,17 @@ module Embulk::Guess
64
64
  end
65
65
  end
66
66
 
67
+ if str.empty?
68
+ return nil
69
+ end
70
+
67
71
  return "string"
68
72
  end
69
73
 
70
74
  def merge_types(types)
71
75
  t = types.inject(nil) {|r,t| merge_type(r,t) } || "string"
72
76
  if t.is_a?(TimestampTypeMatch)
73
- format = TimeFormatGuess.guess(types.map {|type| type.format })
77
+ format = TimeFormatGuess.guess(types.map {|type| type.is_a?(TimestampTypeMatch) ? type.format : nil }.compact)
74
78
  return TimestampTypeMatch.new(format)
75
79
  else
76
80
  return t
@@ -81,7 +85,7 @@ module Embulk::Guess
81
85
  TRUE_STRINGS = Hash[%w[
82
86
  true True TRUE
83
87
  yes Yes YES
84
- y Y
88
+ t T y Y
85
89
  on On ON
86
90
  1
87
91
  ].map {|k| [k, true] }]
@@ -90,7 +94,7 @@ module Embulk::Guess
90
94
  FALSE_STRINGS = Hash[%w[
91
95
  false False FALSE
92
96
  no No NO
93
- n N
97
+ f N n N
94
98
  off Off OFF
95
99
  0
96
100
  ].map {|k| [k, true] }]
@@ -1,3 +1,3 @@
1
1
  module Embulk
2
- VERSION = '0.6.6'
2
+ VERSION = '0.6.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-04 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -296,6 +296,7 @@ files:
296
296
  - embulk-docs/src/release/release-0.6.4.rst
297
297
  - embulk-docs/src/release/release-0.6.5.rst
298
298
  - embulk-docs/src/release/release-0.6.6.rst
299
+ - embulk-docs/src/release/release-0.6.7.rst
299
300
  - embulk-standards/build.gradle
300
301
  - embulk-standards/src/main/java/org/embulk/standards/CsvFormatterPlugin.java
301
302
  - embulk-standards/src/main/java/org/embulk/standards/CsvParserPlugin.java
@@ -324,6 +325,7 @@ files:
324
325
  - lib/embulk/command/embulk_generate_bin.rb
325
326
  - lib/embulk/command/embulk_new_plugin.rb
326
327
  - lib/embulk/command/embulk_run.rb
328
+ - lib/embulk/command/embulk_selfupdate.rb
327
329
  - lib/embulk/data/bundle/.bundle/config
328
330
  - lib/embulk/data/bundle/Gemfile
329
331
  - lib/embulk/data/bundle/Gemfile.lock
@@ -401,18 +403,18 @@ files:
401
403
  - classpath/bval-jsr303-0.5.jar
402
404
  - classpath/commons-beanutils-core-1.8.3.jar
403
405
  - classpath/commons-lang3-3.1.jar
404
- - classpath/embulk-core-0.6.6.jar
405
- - classpath/embulk-standards-0.6.6.jar
406
+ - classpath/embulk-core-0.6.7.jar
407
+ - classpath/embulk-standards-0.6.7.jar
406
408
  - classpath/guava-18.0.jar
407
- - classpath/guice-3.0.jar
408
- - classpath/guice-multibindings-3.0.jar
409
+ - classpath/guice-4.0.jar
410
+ - classpath/guice-multibindings-4.0.jar
409
411
  - classpath/icu4j-54.1.1.jar
410
- - classpath/jackson-annotations-2.5.0.jar
411
- - classpath/jackson-core-2.5.0.jar
412
- - classpath/jackson-databind-2.5.0.jar
413
- - classpath/jackson-datatype-guava-2.5.0.jar
414
- - classpath/jackson-datatype-joda-2.5.0.jar
415
- - classpath/jackson-module-guice-2.5.0.jar
412
+ - classpath/jackson-annotations-2.5.3.jar
413
+ - classpath/jackson-core-2.5.3.jar
414
+ - classpath/jackson-databind-2.5.3.jar
415
+ - classpath/jackson-datatype-guava-2.5.3.jar
416
+ - classpath/jackson-datatype-joda-2.5.3.jar
417
+ - classpath/jackson-module-guice-2.5.3.jar
416
418
  - classpath/javax.inject-1.jar
417
419
  - classpath/joda-time-2.7.jar
418
420
  - classpath/jruby-complete-1.7.19.jar