cvg 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/CHANGELOG +9 -0
- data/bin/cvg +16 -10
- data/features/basic.feature +15 -0
- data/lib/cvg/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2U0OTc4YjRkMDc1NzBlZGM1OGM3MTU1OTVkYmMyMGEwN2I1ZWM4OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGM3NmFmZmM0YmExY2MyZjI3MmNmMTBkNjljYzU3MWI5ZTc5NDdkOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzZjYzUyMmM3ZWEyNDRiYThkOTk3M2YyOTFiNGI5OTJlOGQ0YWRhNjdhYzBk
|
10
|
+
NWIxNThhZmJiN2YzYTE0OTgzNjhiODc3MTk0NmJkZDhmOWU4ZTBmM2MzYzU2
|
11
|
+
ZDJhZmEzYmVmZDZhZDY4MTAyNGE3MjFhZWUxNGIzYjQxOWNiMGI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Zjk0NTRmNTI5YTA1MTFlMGZkZTY3OTVlY2FjYjU3OWQzZTQzNGM3Mjg3YWMy
|
14
|
+
NmVkNGQzMjM2OTA2ZDc3MWVmODBkYTBiZGQyZTU5MTZiMjg0MTIzNjhmNWE2
|
15
|
+
ZDJjYjM0ZmU3YWVkZGUyOTAzMWQ2N2JlNjNlMTYxNWNiY2JlOTg=
|
data/CHANGELOG
ADDED
data/bin/cvg
CHANGED
@@ -178,11 +178,11 @@ class Cvg
|
|
178
178
|
end
|
179
179
|
|
180
180
|
def perform
|
181
|
-
|
181
|
+
write_headers
|
182
182
|
|
183
183
|
each_input_row do |row|
|
184
184
|
if tests.all? { |t| t.pass?(row) }
|
185
|
-
|
185
|
+
write_row row
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
@@ -223,12 +223,12 @@ class Cvg
|
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
|
-
def
|
227
|
-
output_f.puts row.values_at(*
|
226
|
+
def write_row(row)
|
227
|
+
output_f.puts row.values_at(*fields).to_csv
|
228
228
|
end
|
229
229
|
|
230
|
-
def
|
231
|
-
output_f.puts
|
230
|
+
def write_headers
|
231
|
+
output_f.puts fields.to_csv
|
232
232
|
end
|
233
233
|
|
234
234
|
def output_f
|
@@ -239,10 +239,16 @@ class Cvg
|
|
239
239
|
output_f.close
|
240
240
|
end
|
241
241
|
|
242
|
-
def
|
243
|
-
@
|
244
|
-
|
245
|
-
|
242
|
+
def fields
|
243
|
+
@fields ||= begin
|
244
|
+
if user = options.detect { |k, v| k == 'output-fields' }
|
245
|
+
CSV.parse_line user[1]
|
246
|
+
else
|
247
|
+
input_paths.map do |path|
|
248
|
+
CSV.parse_line(File.open(path) { |f| f.gets })
|
249
|
+
end.flatten.uniq
|
250
|
+
end
|
251
|
+
end
|
246
252
|
end
|
247
253
|
|
248
254
|
|
data/features/basic.feature
CHANGED
@@ -267,3 +267,18 @@ Feature: Basic functionality
|
|
267
267
|
yes,y,
|
268
268
|
yes,x,2
|
269
269
|
"""
|
270
|
+
|
271
|
+
Scenario: Output certain fields
|
272
|
+
Given an input csv
|
273
|
+
"""
|
274
|
+
a,b,c
|
275
|
+
aa,bb,cc
|
276
|
+
aaa,bbb,ccc
|
277
|
+
"""
|
278
|
+
When you pass arguments --output-fields b,a
|
279
|
+
Then you get output
|
280
|
+
"""
|
281
|
+
b,a
|
282
|
+
bb,aa
|
283
|
+
bbb,aaa
|
284
|
+
"""
|
data/lib/cvg/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cvg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seamus Abshere
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- .gitignore
|
121
121
|
- .rspec
|
122
122
|
- .travis.yml
|
123
|
+
- CHANGELOG
|
123
124
|
- Gemfile
|
124
125
|
- LICENSE.txt
|
125
126
|
- README.md
|