csvconv 0.0.1
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 +7 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +47 -0
- data/Rakefile +54 -0
- data/bin/csvconv +48 -0
- data/csvconv.gemspec +29 -0
- data/lib/csvconv/converter.rb +27 -0
- data/lib/csvconv/formatter.rb +25 -0
- data/lib/csvconv/parser.rb +16 -0
- data/lib/csvconv/version.rb +4 -0
- data/lib/csvconv.rb +24 -0
- data/spec/csvconv/converter_spec.rb +40 -0
- data/spec/csvconv_spec.rb +91 -0
- data/spec/fixtures/books.csv +6 -0
- data/spec/fixtures/books.json +5 -0
- data/spec/fixtures/books.ltsv +5 -0
- data/spec/fixtures/books.tsv +6 -0
- data/spec/fixtures/books.yaml +16 -0
- data/spec/fixtures/books_noheader.csv +5 -0
- data/spec/spec_helper.rb +5 -0
- metadata +189 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4ea066c812fde8a60d68caade477d05bcc3d2b61
|
4
|
+
data.tar.gz: 077cbfde2a0c1bd141721ae2d90f11f8a37c40fc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 52740762d20e82221fa782d8777d672d412fe9b0bda2a8bbc4d2e35e1e3d74687dea89440738e793d37ee0d6331a190d57e3f8e0bf1795775b7ab63b9bbcb218
|
7
|
+
data.tar.gz: 6a3c908a1d2650d84878836bf2a55a3467575f9e3ef70f6180cd5efd9d215968169d23088a13f0a481562a60c917e64a0f1ef4f3dd34c9daa9a4cdff697bf3db
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 masa21kik
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# CSVConv
|
2
|
+
|
3
|
+
CSV converter to JSON, YAML, LTSV
|
4
|
+
|
5
|
+
[](https://travis-ci.org/masa21kik/csvconv)
|
6
|
+
[](https://coveralls.io/r/masa21kik/csvconv)
|
7
|
+
[](https://codeclimate.com/github/masa21kik/csvconv)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'csvconv'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install csvconv
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
$ csvconv [FORMAT] [INPUT] [OPTIONS]
|
26
|
+
|
27
|
+
$ csvconv --json file.csv -o file.json
|
28
|
+
$ csvconv --yaml file.csv -o file.yaml
|
29
|
+
$ csvconv --ltsv file.csv -o file.ltsv
|
30
|
+
|
31
|
+
Options:
|
32
|
+
--json Output in JSON format
|
33
|
+
--yaml Output in YAML format
|
34
|
+
--ltsv Output in LTSV format
|
35
|
+
-s, --separator SEP Set separator charactor (default is ',')
|
36
|
+
-o, --output FILE Write output to file
|
37
|
+
-H, --headers HEADERS List of headers separated with ','
|
38
|
+
-h, --help Show this message
|
39
|
+
-v, --version Show version
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'flay'
|
4
|
+
require 'flay_task'
|
5
|
+
require 'flog'
|
6
|
+
require 'reek/rake/task'
|
7
|
+
require 'rubocop/rake_task'
|
8
|
+
|
9
|
+
ruby_source = FileList['lib/**/*.rb', 'bin/*', 'spec/**/*.rb']
|
10
|
+
|
11
|
+
RSpec::Core::RakeTask.new(:spec)
|
12
|
+
|
13
|
+
task default: :spec
|
14
|
+
task quality: [:rubocop, :flay, :flog, :reek]
|
15
|
+
|
16
|
+
Reek::Rake::Task.new do |t|
|
17
|
+
t.fail_on_error = false
|
18
|
+
t.verbose = false
|
19
|
+
t.ruby_opts = ['-rubygems']
|
20
|
+
t.reek_opts = '--quiet'
|
21
|
+
t.source_files = ruby_source
|
22
|
+
end
|
23
|
+
|
24
|
+
FlayTask.new do |t|
|
25
|
+
t.dirs = ruby_source.map do |each|
|
26
|
+
each[/[^\/]+/]
|
27
|
+
end.uniq
|
28
|
+
t.threshold = 0
|
29
|
+
t.verbose = true
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'Analyze for code complexity'
|
33
|
+
task :flog do
|
34
|
+
flog = Flog.new(continue: true)
|
35
|
+
flog.flog(*ruby_source)
|
36
|
+
threshold = 28
|
37
|
+
|
38
|
+
bad_methods = flog.totals.select do |name, score|
|
39
|
+
!(/##{flog.no_method}$/ =~ name) && score > threshold
|
40
|
+
end
|
41
|
+
bad_methods.sort { |a, b| a[1] <=> b[1] }.reverse.each do |name, score|
|
42
|
+
printf "%8.1f: %s\n", score, name
|
43
|
+
end
|
44
|
+
unless bad_methods.empty?
|
45
|
+
$stderr.puts "#{bad_methods.size} methods have a complexity > #{threshold}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
Rubocop::RakeTask.new do |task|
|
50
|
+
task.patterns = %w(lib/**/*.rb
|
51
|
+
spec/**/*.rb
|
52
|
+
Rakefile
|
53
|
+
Gemfile)
|
54
|
+
end
|
data/bin/csvconv
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
if $PROGRAM_NAME == __FILE__
|
4
|
+
require 'csvconv'
|
5
|
+
require 'optparse'
|
6
|
+
|
7
|
+
options = {
|
8
|
+
sep: ',',
|
9
|
+
}
|
10
|
+
output = STDOUT
|
11
|
+
format = :json
|
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)
|
41
|
+
|
42
|
+
inputs = ARGV.empty? ? [STDIN] : ARGV.map { |f| File.open(f) }
|
43
|
+
inputs.each do |input|
|
44
|
+
output.puts CSVConv.send("csv2#{format.to_s}", input, options)
|
45
|
+
end
|
46
|
+
|
47
|
+
output.close
|
48
|
+
end
|
data/csvconv.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'csvconv/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'csvconv'
|
8
|
+
spec.version = CSVConv::VERSION
|
9
|
+
spec.authors = ['masa21kik']
|
10
|
+
spec.email = ['masa21kik@gmail.com']
|
11
|
+
spec.description = %q(CSV converter to JSON, YAML, LTSV)
|
12
|
+
spec.summary = %q(CSV converter to JSON, YAML, LTSV)
|
13
|
+
spec.homepage = 'https://github.com/masa21kik/csvconv'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($RS)
|
17
|
+
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
spec.add_development_dependency 'coveralls'
|
25
|
+
spec.add_development_dependency 'flay'
|
26
|
+
spec.add_development_dependency 'flog'
|
27
|
+
spec.add_development_dependency 'reek'
|
28
|
+
spec.add_development_dependency 'rubocop'
|
29
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module CSVConv
|
2
|
+
# Converter from CSV
|
3
|
+
class Converter
|
4
|
+
def initialize(format, options)
|
5
|
+
@format = format
|
6
|
+
@sep = options[:sep] || ','
|
7
|
+
@header = options[:header]
|
8
|
+
end
|
9
|
+
|
10
|
+
def convert(input)
|
11
|
+
@header ||= Parser.read_header(input, @sep)
|
12
|
+
hash_array = []
|
13
|
+
while (line = input.gets)
|
14
|
+
hash_array << Parser.parse_line(line, @header, @sep)
|
15
|
+
end
|
16
|
+
Formatter.send(@format, hash_array)
|
17
|
+
end
|
18
|
+
|
19
|
+
def convert_stream(input, output)
|
20
|
+
@header ||= Parser.read_header(input, @sep)
|
21
|
+
while (line = input.gets)
|
22
|
+
hash = Parser.parse_line(line, @header, @sep)
|
23
|
+
output.puts Formatter.send(@format, [hash])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module CSVConv
|
5
|
+
# Format Hash Array
|
6
|
+
module Formatter
|
7
|
+
def json(hash_array)
|
8
|
+
hash_array.map do |hash|
|
9
|
+
hash.to_json + "\n"
|
10
|
+
end.join
|
11
|
+
end
|
12
|
+
|
13
|
+
def yaml(hash_array)
|
14
|
+
hash_array.to_yaml
|
15
|
+
end
|
16
|
+
|
17
|
+
def ltsv(hash_array)
|
18
|
+
hash_array.map do |hash|
|
19
|
+
hash.map { |key, val| [key, val].join(':') }.join("\t") + "\n"
|
20
|
+
end.join
|
21
|
+
end
|
22
|
+
|
23
|
+
module_function :json, :yaml, :ltsv
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module CSVConv
|
4
|
+
# Parse CSV to Hash
|
5
|
+
module Parser
|
6
|
+
def read_header(input, sep)
|
7
|
+
CSV.parse_line(input.gets, col_sep: sep)
|
8
|
+
end
|
9
|
+
|
10
|
+
def parse_line(input, header, sep)
|
11
|
+
Hash[header.zip(CSV.parse_line(input, col_sep: sep))]
|
12
|
+
end
|
13
|
+
|
14
|
+
module_function :read_header, :parse_line
|
15
|
+
end
|
16
|
+
end
|
data/lib/csvconv.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'csvconv/version'
|
2
|
+
require 'csvconv/parser'
|
3
|
+
require 'csvconv/formatter'
|
4
|
+
require 'csvconv/converter'
|
5
|
+
|
6
|
+
# CSV Converter
|
7
|
+
module CSVConv
|
8
|
+
def csv2json(input, options)
|
9
|
+
cv = Converter.new(:json, options)
|
10
|
+
cv.convert(input)
|
11
|
+
end
|
12
|
+
|
13
|
+
def csv2yaml(input, options)
|
14
|
+
cv = Converter.new(:yaml, options)
|
15
|
+
cv.convert(input)
|
16
|
+
end
|
17
|
+
|
18
|
+
def csv2ltsv(input, options)
|
19
|
+
cv = Converter.new(:ltsv, options)
|
20
|
+
cv.convert(input)
|
21
|
+
end
|
22
|
+
|
23
|
+
module_function :csv2json, :csv2yaml, :csv2ltsv
|
24
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CSVConv::Converter do
|
4
|
+
shared_examples_for 'convert file format stream' do
|
5
|
+
before do
|
6
|
+
@input = File.open(input_path)
|
7
|
+
@output = StringIO.new
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'convert file format stream' do
|
11
|
+
cv = CSVConv::Converter.new(format, options)
|
12
|
+
cv.convert_stream(@input, @output)
|
13
|
+
actual = @output.string
|
14
|
+
expected = File.read(input_path.sub(/[^\.]+$/, format))
|
15
|
+
expect(actual).to eq expected
|
16
|
+
end
|
17
|
+
|
18
|
+
after do
|
19
|
+
@input.close
|
20
|
+
@output.close
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:fixture_dir) { File.expand_path('../../fixtures', __FILE__) }
|
25
|
+
|
26
|
+
context 'CSV with header (books.csv)' do
|
27
|
+
let(:input_path) { File.join(fixture_dir, 'books.csv') }
|
28
|
+
let(:options) { {} }
|
29
|
+
|
30
|
+
context 'json' do
|
31
|
+
let(:format) { 'json' }
|
32
|
+
it_behaves_like 'convert file format stream'
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'ltsv' do
|
36
|
+
let(:format) { 'ltsv' }
|
37
|
+
it_behaves_like 'convert file format stream'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CSVConv do
|
4
|
+
it 'should have a version number' do
|
5
|
+
CSVConv::VERSION.should_not be_nil
|
6
|
+
end
|
7
|
+
|
8
|
+
shared_examples_for 'convert file format' do
|
9
|
+
before do
|
10
|
+
@input = File.open(input_path)
|
11
|
+
end
|
12
|
+
|
13
|
+
def expect_file_path
|
14
|
+
dir = File.dirname(input_path)
|
15
|
+
base = File.basename(input_path, '.*').sub('_noheader', '')
|
16
|
+
File.join(dir, "#{base}.#{format}")
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'convert file format' do
|
20
|
+
actual = CSVConv.send("csv2#{format}", @input, options)
|
21
|
+
expected = File.read(expect_file_path)
|
22
|
+
expect(actual).to eq expected
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
@input.close
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
let(:fixture_dir) { File.expand_path('../fixtures', __FILE__) }
|
31
|
+
|
32
|
+
context 'CSV with header (books.csv)' do
|
33
|
+
let(:input_path) { File.join(fixture_dir, 'books.csv') }
|
34
|
+
let(:options) { {} }
|
35
|
+
|
36
|
+
describe '#csv2json' do
|
37
|
+
let(:format) { 'json' }
|
38
|
+
it_behaves_like 'convert file format'
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#csv2yaml' do
|
42
|
+
let(:format) { 'yaml' }
|
43
|
+
it_behaves_like 'convert file format'
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#csv2ltsv' do
|
47
|
+
let(:format) { 'ltsv' }
|
48
|
+
it_behaves_like 'convert file format'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'CSV without header (books.csv)' do
|
53
|
+
let(:input_path) { File.join(fixture_dir, 'books_noheader.csv') }
|
54
|
+
let(:options) { { header: %w(Title Author Price) } }
|
55
|
+
|
56
|
+
describe '#csv2json' do
|
57
|
+
let(:format) { 'json' }
|
58
|
+
it_behaves_like 'convert file format'
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#csv2yaml' do
|
62
|
+
let(:format) { 'yaml' }
|
63
|
+
it_behaves_like 'convert file format'
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#csv2ltsv' do
|
67
|
+
let(:format) { 'ltsv' }
|
68
|
+
it_behaves_like 'convert file format'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'TSV with header (books.tsv)' do
|
73
|
+
let(:input_path) { File.join(fixture_dir, 'books.tsv') }
|
74
|
+
let(:options) { { sep: "\t" } }
|
75
|
+
|
76
|
+
describe '#csv2json' do
|
77
|
+
let(:format) { 'json' }
|
78
|
+
it_behaves_like 'convert file format'
|
79
|
+
end
|
80
|
+
|
81
|
+
describe '#csv2yaml' do
|
82
|
+
let(:format) { 'yaml' }
|
83
|
+
it_behaves_like 'convert file format'
|
84
|
+
end
|
85
|
+
|
86
|
+
describe '#csv2ltsv' do
|
87
|
+
let(:format) { 'ltsv' }
|
88
|
+
it_behaves_like 'convert file format'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
Title,Author,Price
|
2
|
+
The Fault in Our Stars,John Green,12.99
|
3
|
+
City of Heavenly Fire (The Mortal Instruments),Cassandra Clare,24.99
|
4
|
+
"Oh, The Places You'll Go!",Dr. Seuss,17.99
|
5
|
+
Capital in the Twenty-First Century,Thomas Piketty,39.95
|
6
|
+
Skin Game (Dresden Files),Jim Butcher,27.95
|
@@ -0,0 +1,5 @@
|
|
1
|
+
{"Title":"The Fault in Our Stars","Author":"John Green","Price":"12.99"}
|
2
|
+
{"Title":"City of Heavenly Fire (The Mortal Instruments)","Author":"Cassandra Clare","Price":"24.99"}
|
3
|
+
{"Title":"Oh, The Places You'll Go!","Author":"Dr. Seuss","Price":"17.99"}
|
4
|
+
{"Title":"Capital in the Twenty-First Century","Author":"Thomas Piketty","Price":"39.95"}
|
5
|
+
{"Title":"Skin Game (Dresden Files)","Author":"Jim Butcher","Price":"27.95"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
Title:The Fault in Our Stars Author:John Green Price:12.99
|
2
|
+
Title:City of Heavenly Fire (The Mortal Instruments) Author:Cassandra Clare Price:24.99
|
3
|
+
Title:Oh, The Places You'll Go! Author:Dr. Seuss Price:17.99
|
4
|
+
Title:Capital in the Twenty-First Century Author:Thomas Piketty Price:39.95
|
5
|
+
Title:Skin Game (Dresden Files) Author:Jim Butcher Price:27.95
|
@@ -0,0 +1,6 @@
|
|
1
|
+
Title Author Price
|
2
|
+
The Fault in Our Stars John Green 12.99
|
3
|
+
City of Heavenly Fire (The Mortal Instruments) Cassandra Clare 24.99
|
4
|
+
Oh, The Places You'll Go! Dr. Seuss 17.99
|
5
|
+
Capital in the Twenty-First Century Thomas Piketty 39.95
|
6
|
+
Skin Game (Dresden Files) Jim Butcher 27.95
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
- Title: The Fault in Our Stars
|
3
|
+
Author: John Green
|
4
|
+
Price: '12.99'
|
5
|
+
- Title: City of Heavenly Fire (The Mortal Instruments)
|
6
|
+
Author: Cassandra Clare
|
7
|
+
Price: '24.99'
|
8
|
+
- Title: Oh, The Places You'll Go!
|
9
|
+
Author: Dr. Seuss
|
10
|
+
Price: '17.99'
|
11
|
+
- Title: Capital in the Twenty-First Century
|
12
|
+
Author: Thomas Piketty
|
13
|
+
Price: '39.95'
|
14
|
+
- Title: Skin Game (Dresden Files)
|
15
|
+
Author: Jim Butcher
|
16
|
+
Price: '27.95'
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,189 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: csvconv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- masa21kik
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: flay
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: flog
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: reek
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: CSV converter to JSON, YAML, LTSV
|
126
|
+
email:
|
127
|
+
- masa21kik@gmail.com
|
128
|
+
executables:
|
129
|
+
- csvconv
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- ".gitignore"
|
134
|
+
- ".rspec"
|
135
|
+
- ".travis.yml"
|
136
|
+
- Gemfile
|
137
|
+
- LICENSE.txt
|
138
|
+
- README.md
|
139
|
+
- Rakefile
|
140
|
+
- bin/csvconv
|
141
|
+
- csvconv.gemspec
|
142
|
+
- lib/csvconv.rb
|
143
|
+
- lib/csvconv/converter.rb
|
144
|
+
- lib/csvconv/formatter.rb
|
145
|
+
- lib/csvconv/parser.rb
|
146
|
+
- lib/csvconv/version.rb
|
147
|
+
- spec/csvconv/converter_spec.rb
|
148
|
+
- spec/csvconv_spec.rb
|
149
|
+
- spec/fixtures/books.csv
|
150
|
+
- spec/fixtures/books.json
|
151
|
+
- spec/fixtures/books.ltsv
|
152
|
+
- spec/fixtures/books.tsv
|
153
|
+
- spec/fixtures/books.yaml
|
154
|
+
- spec/fixtures/books_noheader.csv
|
155
|
+
- spec/spec_helper.rb
|
156
|
+
homepage: https://github.com/masa21kik/csvconv
|
157
|
+
licenses:
|
158
|
+
- MIT
|
159
|
+
metadata: {}
|
160
|
+
post_install_message:
|
161
|
+
rdoc_options: []
|
162
|
+
require_paths:
|
163
|
+
- lib
|
164
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
requirements: []
|
175
|
+
rubyforge_project:
|
176
|
+
rubygems_version: 2.2.0
|
177
|
+
signing_key:
|
178
|
+
specification_version: 4
|
179
|
+
summary: CSV converter to JSON, YAML, LTSV
|
180
|
+
test_files:
|
181
|
+
- spec/csvconv/converter_spec.rb
|
182
|
+
- spec/csvconv_spec.rb
|
183
|
+
- spec/fixtures/books.csv
|
184
|
+
- spec/fixtures/books.json
|
185
|
+
- spec/fixtures/books.ltsv
|
186
|
+
- spec/fixtures/books.tsv
|
187
|
+
- spec/fixtures/books.yaml
|
188
|
+
- spec/fixtures/books_noheader.csv
|
189
|
+
- spec/spec_helper.rb
|