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 +4 -4
- data/.travis.yml +4 -7
- data/.travis.yml.erb +0 -3
- data/CHANGELOG.md +4 -0
- data/embulk-parser-query_string.gemspec +1 -1
- data/gemfiles/{embulk-0.7-latest → embulk-0.8.0-latest} +1 -1
- data/gemfiles/{embulk-0.7.2 → embulk-0.8.7} +1 -1
- data/gemfiles/{embulk-0.7.3 → embulk-0.8.8} +1 -1
- data/gemfiles/{embulk-0.7.4 → embulk-0.8.9} +1 -1
- data/gemfiles/embulk-latest +1 -1
- data/lib/embulk/parser/query_string.rb +15 -1
- data/test/embulk/parser/test_query_string.rb +24 -3
- data/test/test_embulk_run.rb +2 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89e246c7c50472ef725a7278a5afd7787aaed4a5
|
4
|
+
data.tar.gz: 4af80a29bbad7216f5ffdbfa969fe15e88cabd37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c94cf93a907374917e053237a5e80f44eafa44404544605b2a97ceb228327d690d5f5ef7f9fb5557e466edc6e29024e7277fa116ca05231c979b18d18564add
|
7
|
+
data.tar.gz: 4202bae68d5d311012d160fca0270223541ed092ce3c067630ff90a9778211ebe69a2e749c3cbfe7012d2f4d6470bff81b1f9a8962142b0cda96a2d7bc21aaec
|
data/.travis.yml
CHANGED
@@ -11,14 +11,11 @@ addons:
|
|
11
11
|
code_climate:
|
12
12
|
repo_token:
|
13
13
|
secure: "cSTIvR+haBzyXfAQGGxCjdnLM/iEWFJuVJFqQi0cqr78yZuhJ4A06tJhLIVd7uU+ZRa+JCT/kpD7zZbVc5BC2kmVJybLOXx+bR1SFgT1W2QVQJL7yU6pzPzpT4hr1VQFd8OIKgko8v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wHrMfblObOOj58C7gUfdbTCByxng0u1axxvixL8zJwgHvFND3/4yoXoCCgm0DXBPbi6B5xpt8QmN6K4E5sMGrppTI7VwJqkcwkVD0EEeCedRNiWLTaxlKpLYxYnoXwEnpm9o2WXWa+PjkWeawsnJvV5IAt6oJhaK22VqJN86Macuu+nCdeF1/0TZU="
|
17
14
|
|
18
15
|
gemfile:
|
19
|
-
- gemfiles/embulk-0.
|
20
|
-
- gemfiles/embulk-0.7
|
21
|
-
- gemfiles/embulk-0.
|
22
|
-
- gemfiles/embulk-0.
|
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
|
|
data/.travis.yml.erb
CHANGED
@@ -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| -%>
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
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."
|
data/gemfiles/embulk-latest
CHANGED
@@ -102,7 +102,7 @@ module Embulk
|
|
102
102
|
name = column.name
|
103
103
|
value = record[name]
|
104
104
|
|
105
|
-
next nil
|
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
|
|
data/test/test_embulk_run.rb
CHANGED
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.
|
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:
|
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.
|
166
|
-
- gemfiles/embulk-0.7
|
167
|
-
- gemfiles/embulk-0.
|
168
|
-
- gemfiles/embulk-0.
|
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
|