csvconv 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 +4 -4
- data/.travis.yml +2 -0
- data/Rakefile +1 -1
- data/bin/csvconv +40 -42
- data/csvconv.gemspec +1 -1
- data/lib/csvconv/version.rb +1 -1
- data/spec/csvconv_spec.rb +1 -1
- 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: d19f341db113dd315d692609accb2eed6b987353
|
4
|
+
data.tar.gz: 90b73b50d299b0a24fc0a62291a3278056ec0af4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e5b3a62c03e4b8c8de71a6e044f5822318b8c7e5ac9fe0c1e132f92de6f40cba513072999af38ea15308cd3f7fe037c8eb7970585f57deb3ee105458ea7ba6b
|
7
|
+
data.tar.gz: a5680141b546113f4b552e7d3b39264d5941421035ca5b72a6974554880fe785198c35d4f82f831c08ad0ce5184d68d58ac0fced6960b01406dc7698e296f3a5
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
data/bin/csvconv
CHANGED
@@ -1,48 +1,46 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
require 'optparse'
|
3
|
+
require 'csvconv'
|
4
|
+
require 'optparse'
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
opt = OptionParser.new
|
14
|
-
opt.on('--json', 'Output in JSON format') do
|
15
|
-
format = :json
|
16
|
-
end
|
17
|
-
opt.on('--yaml', 'Output in YAML format') do
|
18
|
-
format = :yaml
|
19
|
-
end
|
20
|
-
opt.on('--ltsv', 'Output in LTSV format') do
|
21
|
-
format = :ltsv
|
22
|
-
end
|
23
|
-
opt.on('-s', '--separator SEP',
|
24
|
-
'Set separator charactor (default is \',\')') do |v|
|
25
|
-
options[:sep] = v
|
26
|
-
end
|
27
|
-
opt.on('-o', '--output FILE', 'Write output to file') do |v|
|
28
|
-
output = File.open(v, 'w')
|
29
|
-
end
|
30
|
-
opt.on('-H', '--headers HEADERS',
|
31
|
-
'List of headers separated with \',\'') do |v|
|
32
|
-
options[:header] = v.split(',')
|
33
|
-
end
|
34
|
-
opt.on('-h', '--help', 'Show this message') do
|
35
|
-
abort(opt.help)
|
36
|
-
end
|
37
|
-
opt.on('-v', '--version', 'Show version') do
|
38
|
-
puts CSVConv::VERSION
|
39
|
-
end
|
40
|
-
opt.parse!(ARGV)
|
6
|
+
options = {
|
7
|
+
sep: ',',
|
8
|
+
}
|
9
|
+
output = STDOUT
|
10
|
+
format = :json
|
41
11
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
12
|
+
opt = OptionParser.new
|
13
|
+
opt.on('--json', 'Output in JSON format') do
|
14
|
+
format = :json
|
15
|
+
end
|
16
|
+
opt.on('--yaml', 'Output in YAML format') do
|
17
|
+
format = :yaml
|
18
|
+
end
|
19
|
+
opt.on('--ltsv', 'Output in LTSV format') do
|
20
|
+
format = :ltsv
|
21
|
+
end
|
22
|
+
opt.on('-s', '--separator SEP',
|
23
|
+
'Set separator charactor (default is \',\')') do |v|
|
24
|
+
options[:sep] = v
|
25
|
+
end
|
26
|
+
opt.on('-o', '--output FILE', 'Write output to file') do |v|
|
27
|
+
output = File.open(v, 'w')
|
28
|
+
end
|
29
|
+
opt.on('-H', '--headers HEADERS',
|
30
|
+
'List of headers separated with \',\'') do |v|
|
31
|
+
options[:header] = v.split(',')
|
32
|
+
end
|
33
|
+
opt.on('-h', '--help', 'Show this message') do
|
34
|
+
abort(opt.help)
|
35
|
+
end
|
36
|
+
opt.on('-v', '--version', 'Show version') do
|
37
|
+
puts CSVConv::VERSION
|
38
|
+
end
|
39
|
+
opt.parse!(ARGV)
|
46
40
|
|
47
|
-
|
41
|
+
inputs = ARGV.empty? ? [STDIN] : ARGV.map { |f| File.open(f) }
|
42
|
+
inputs.each do |input|
|
43
|
+
output.puts CSVConv.send("csv2#{format.to_s}", input, options)
|
48
44
|
end
|
45
|
+
|
46
|
+
output.close
|
data/csvconv.gemspec
CHANGED
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency 'flay'
|
26
26
|
spec.add_development_dependency 'flog'
|
27
27
|
spec.add_development_dependency 'reek'
|
28
|
-
spec.add_development_dependency 'rubocop'
|
28
|
+
spec.add_development_dependency 'rubocop', '~> 0.23'
|
29
29
|
end
|
data/lib/csvconv/version.rb
CHANGED
data/spec/csvconv_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csvconv
|
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
|
- masa21kik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: rubocop
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
117
|
+
version: '0.23'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
124
|
+
version: '0.23'
|
125
125
|
description: CSV converter to JSON, YAML, LTSV
|
126
126
|
email:
|
127
127
|
- masa21kik@gmail.com
|