embulk-parser-query_string 0.3.1 → 0.3.2

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: 7bf28a70ddd9f3ec7210201a7f027c05fe675ef7
4
- data.tar.gz: 2d4fe6c85982222f3fb9eef01cc99efda5f0bba4
3
+ metadata.gz: 89e246c7c50472ef725a7278a5afd7787aaed4a5
4
+ data.tar.gz: 4af80a29bbad7216f5ffdbfa969fe15e88cabd37
5
5
  SHA512:
6
- metadata.gz: 8aee02b66458e5ff1eb71de855030a0e56162cb1c1ed1ad0953498ce27c4782d9c3297bacf513fbb7f704447778453bde3e767fb9dc537a3a8ec1d31c0c60f2f
7
- data.tar.gz: 83cabae95cba6fa468c7e8fcd97ce1bcdb831d7859b66161c7c6d8379b2bfdc61e178eaa7d0a84337409a87f436bce31f3ff5f9e6f9a83bc15e991876350c800
6
+ metadata.gz: 7c94cf93a907374917e053237a5e80f44eafa44404544605b2a97ceb228327d690d5f5ef7f9fb5557e466edc6e29024e7277fa116ca05231c979b18d18564add
7
+ data.tar.gz: 4202bae68d5d311012d160fca0270223541ed092ce3c067630ff90a9778211ebe69a2e749c3cbfe7012d2f4d6470bff81b1f9a8962142b0cda96a2d7bc21aaec
@@ -11,14 +11,11 @@ addons:
11
11
  code_climate:
12
12
  repo_token:
13
13
  secure: "cSTIvR+haBzyXfAQGGxCjdnLM/iEWFJuVJFqQi0cqr78yZuhJ4A06tJhLIVd7uU+ZRa+JCT/kpD7zZbVc5BC2kmVJybLOXx+bR1SFgT1W2QVQJL7yU6pzPzpT4hr1VQFd8OIKgko8vTBGykXL804F0e/xHKv+FHGMh6TI2CfXqG8cpZpa4oCtnt48V3VUpszNpNuufvfTFJADpI9NvuyosbA3btcH7pY/vbjLTOAd0cSTjZ6Qufy9jV2KwSRyMHXs1m1paErKHrxL7aPxy+rBWqCVeyrU9Tx/Kw/DgJLP9dIPjFvcDHdaUKpcZAcaU87VYFPhcPW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files/embulk-0.7-latest
20
- - gemfiles/embulk-0.7.2
21
- - gemfiles/embulk-0.7.3
22
- - gemfiles/embulk-0.7.4
16
+ - gemfiles/embulk-0.8.0-latest
17
+ - gemfiles/embulk-0.8.7
18
+ - gemfiles/embulk-0.8.8
19
+ - gemfiles/embulk-0.8.9
23
20
  - gemfiles/embulk-latest
24
21
 
@@ -11,9 +11,6 @@ addons:
11
11
  code_climate:
12
12
  repo_token:
13
13
  secure: "cSTIvR+haBzyXfAQGGxCjdnLM/iEWFJuVJFqQi0cqr78yZuhJ4A06tJhLIVd7uU+ZRa+JCT/kpD7zZbVc5BC2kmVJybLOXx+bR1SFgT1W2QVQJL7yU6pzPzpT4hr1VQFd8OIKgko8vTBGykXL804F0e/xHKv+FHGMh6TI2CfXqG8cpZpa4oCtnt48V3VUpszNpNuufvfTFJADpI9NvuyosbA3btcH7pY/vbjLTOAd0cSTjZ6Qufy9jV2KwSRyMHXs1m1paErKHrxL7aPxy+rBWqCVeyrU9Tx/Kw/DgJLP9dIPjFvcDHdaUKpcZAcaU87VYFPhcPW7bDIQoeaI7lfrPiBgQTgfZxeiL9vJ2oRUP9NhkhCF18ljhoqI9uTonuyv49zgyAXrLlJQu0cEdC4tW/qsEsB0b56MyctUm8Iq0gWIZO8uI961p/VzkjV6d3/n+QFTUIKnGqf7sRWfxqXFOP6SmlyZtbST4uzUDNw7MWuRRzqmEagQtnzjzmYXCrFpAwn2BG3tPkjrypmlBBjBKsPww/nkeTn25449UvYUwOKRPY3P0amXPdemubiy4jLCWTHUSxhszTrp85Jx6492z50qDo6wU6bw8MaMdrZbxChyNT6ulgbiBaQm/c1bUPNUyrT8ixyxc+/F+SFuILhIvclHjcAEAiRNAyV5LXhb+U="
14
- notifications:
15
- slack:
16
- secure: "QRZ6zQxcRdN2XylIz+b46TbYIv7x5Ko7Y0Mi0aGbf7Wg1xfnS4X2FZKp8gF+RH1qjT6CYsQFUpPBhPVCMx0fP0ik5/gBrdngrj0htludvQ5CTK2oVegM1VC5NSn+gi8bt2F20Ode9fxU5OS1HDzNR9sjPz3W7miMUNDZoYPy77Om/CvmVkBbGyMkWnfwhEvwnL8JpBNpklDvrUUKznNsAcSbKQBMBAglFMds/OaHXCkK142zMbSlHMctch1VDAKhX9/6M3v8v6ZRheX68+VVCz3nTrTF0/lnYh3ig9ey3DNlgkZUqK2gmypnhTE6tpeibHdyVa8qOMNzyAgltu1qIhFHN390WMk9gZXEcvWG3m++PMAIKKtd4varbH1vdCeHOGUV7GRgarcfSMvJ54I9xc5GkUnAhjRKj8xDzYzhkXwApD8eqWb2RgGXUm6G4cKj0MeQ4WBqHr9FOW/4EJcZoztFi0YlP7KE+6xptBJU479KSsv31BwHrMfblObOOj58C7gUfdbTCByxng0u1axxvixL8zJwgHvFND3/4yoXoCCgm0DXBPbi6B5xpt8QmN6K4E5sMGrppTI7VwJqkcwkVD0EEeCedRNiWLTaxlKpLYxYnoXwEnpm9o2WXWa+PjkWeawsnJvV5IAt6oJhaK22VqJN86Macuu+nCdeF1/0TZU="
17
14
 
18
15
  gemfile:
19
16
  <% versions.each do |file| -%>
@@ -1,3 +1,7 @@
1
+ ## 0.3.2 - 2016-07-04
2
+
3
+ * [enhancement] String "false" as false [#37](https://github.com/treasure-data/embulk-parser-query_string/pull/37)
4
+
1
5
  ## 0.3.1 - 2015-10-20
2
6
 
3
7
  * [enhancement] Raise ConfigError if type cast failed [#34](https://github.com/treasure-data/embulk-parser-query_string/pull/34)
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-parser-query_string"
4
- spec.version = "0.3.1"
4
+ spec.version = "0.3.2"
5
5
  spec.authors = ["yoshihara", "uu59"]
6
6
  spec.summary = "Query String parser plugin for Embulk"
7
7
  spec.description = "Parses Query String files read by other file input plugins."
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org/'
2
2
  gemspec :path => '../'
3
3
 
4
- gem "embulk", "~> 0.7"
4
+ gem "embulk", "~> 0.8.0"
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org/'
2
2
  gemspec :path => '../'
3
3
 
4
- gem "embulk", "0.7.2"
4
+ gem "embulk", "0.8.7"
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org/'
2
2
  gemspec :path => '../'
3
3
 
4
- gem "embulk", "0.7.3"
4
+ gem "embulk", "0.8.8"
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org/'
2
2
  gemspec :path => '../'
3
3
 
4
- gem "embulk", "0.7.4"
4
+ gem "embulk", "0.8.9"
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org/'
2
2
  gemspec :path => '../'
3
3
 
4
- gem "embulk", "> 0.7.2"
4
+ gem "embulk", "> 0.8.7"
@@ -102,7 +102,7 @@ module Embulk
102
102
  name = column.name
103
103
  value = record[name]
104
104
 
105
- next nil unless value
105
+ next nil if value.nil? || value.empty?
106
106
 
107
107
  begin
108
108
  case column.type
@@ -110,6 +110,8 @@ module Embulk
110
110
  value.strip.empty? ? nil : Integer(value)
111
111
  when :timestamp
112
112
  value.strip.empty? ? nil : Time.parse(value)
113
+ when :boolean
114
+ truthy_value?(value)
113
115
  else
114
116
  value.to_s
115
117
  end
@@ -120,6 +122,18 @@ module Embulk
120
122
 
121
123
  page_builder.add(values)
122
124
  end
125
+
126
+ def truthy_value?(str)
127
+ # Same as Embulk csv parser
128
+ # https://github.com/embulk/embulk/blob/v0.8.9/embulk-standards/src/main/java/org/embulk/standards/CsvParserPlugin.java#L35-L41
129
+ %w(
130
+ true True TRUE
131
+ yes Yes YES
132
+ t T y Y
133
+ on On ON
134
+ 1
135
+ ).include?(str)
136
+ end
123
137
  end
124
138
  end
125
139
  end
@@ -77,7 +77,7 @@ module Embulk
77
77
 
78
78
  class TestProcessLine < self
79
79
  def test_all_keys_exist_in_schema
80
- mock(page_builder).add(["FOO", 1, Time.parse("2015-07-08T16:25:46")])
80
+ mock(page_builder).add(["FOO", 1, Time.parse("2015-07-08T16:25:46"), nil])
81
81
  plugin.send(:process_line, line)
82
82
  end
83
83
 
@@ -86,12 +86,12 @@ module Embulk
86
86
  nonexist_schema = schema << nonexist_column
87
87
 
88
88
  plugin = QueryString.new(DataSource[task], nonexist_schema, page_builder)
89
- mock(page_builder).add(["FOO", 1, Time.parse("2015-07-08T16:25:46"), nil])
89
+ mock(page_builder).add(["FOO", 1, Time.parse("2015-07-08T16:25:46"), nil, nil])
90
90
  plugin.send(:process_line, line)
91
91
  end
92
92
 
93
93
  def test_long_value_for_key_nonexist
94
- mock(page_builder).add(["FOO", nil, Time.parse("2015-07-08T16:25:46")])
94
+ mock(page_builder).add(["FOO", nil, Time.parse("2015-07-08T16:25:46"), nil])
95
95
  plugin.send(:process_line, value_nonexist_line)
96
96
  end
97
97
 
@@ -105,6 +105,26 @@ module Embulk
105
105
  end
106
106
  end
107
107
 
108
+ data do
109
+ [
110
+ ["true" , ["true" , true]] ,
111
+ ["false" , ["false" , false]] ,
112
+ ["t" , ["t" , true]] ,
113
+ ["f" , ["f" , false]] ,
114
+ ["yes" , ["yes" , true]] ,
115
+ ["no" , ["no" , false]] ,
116
+ ["on" , ["on" , true]] ,
117
+ ["off" , ["off" , false]] ,
118
+ ["foo" , ["foo" , false]] ,
119
+ ["empty" , ["" , nil]] ,
120
+ ]
121
+ end
122
+ def test_boolean_as_false(data)
123
+ value, expected = data
124
+ mock(page_builder).add([anything, anything, anything, expected])
125
+ plugin.send(:process_line, "qux=#{value}")
126
+ end
127
+
108
128
  private
109
129
 
110
130
  def line
@@ -155,6 +175,7 @@ module Embulk
155
175
  {"name" => "foo", "type" => :string},
156
176
  {"name" => "bar", "type" => :long},
157
177
  {"name" => "baz", "type" => :timestamp},
178
+ {"name" => "qux", "type" => :boolean},
158
179
  ]
159
180
  end
160
181
 
@@ -60,6 +60,8 @@ module Embulk
60
60
  end
61
61
 
62
62
  def test_embulk_guess
63
+ pend "latest Embulk generates other formed yaml"
64
+
63
65
  seed_path = "#{@dir}/seed.yml"
64
66
  File.open(seed_path, "w") do |f|
65
67
  f.write seed_content
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-parser-query_string
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshihara
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-20 00:00:00.000000000 Z
12
+ date: 2016-07-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -162,10 +162,10 @@ files:
162
162
  - README.md
163
163
  - Rakefile
164
164
  - embulk-parser-query_string.gemspec
165
- - gemfiles/embulk-0.7-latest
166
- - gemfiles/embulk-0.7.2
167
- - gemfiles/embulk-0.7.3
168
- - gemfiles/embulk-0.7.4
165
+ - gemfiles/embulk-0.8.0-latest
166
+ - gemfiles/embulk-0.8.7
167
+ - gemfiles/embulk-0.8.8
168
+ - gemfiles/embulk-0.8.9
169
169
  - gemfiles/embulk-latest
170
170
  - gemfiles/template.erb
171
171
  - lib/embulk/guess/query_string.rb