csvconv 0.0.1 → 0.0.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: 4ea066c812fde8a60d68caade477d05bcc3d2b61
4
- data.tar.gz: 077cbfde2a0c1bd141721ae2d90f11f8a37c40fc
3
+ metadata.gz: d19f341db113dd315d692609accb2eed6b987353
4
+ data.tar.gz: 90b73b50d299b0a24fc0a62291a3278056ec0af4
5
5
  SHA512:
6
- metadata.gz: 52740762d20e82221fa782d8777d672d412fe9b0bda2a8bbc4d2e35e1e3d74687dea89440738e793d37ee0d6331a190d57e3f8e0bf1795775b7ab63b9bbcb218
7
- data.tar.gz: 6a3c908a1d2650d84878836bf2a55a3467575f9e3ef70f6180cd5efd9d215968169d23088a13f0a481562a60c917e64a0f1ef4f3dd34c9daa9a4cdff697bf3db
6
+ metadata.gz: 4e5b3a62c03e4b8c8de71a6e044f5822318b8c7e5ac9fe0c1e132f92de6f40cba513072999af38ea15308cd3f7fe037c8eb7970585f57deb3ee105458ea7ba6b
7
+ data.tar.gz: a5680141b546113f4b552e7d3b39264d5941421035ca5b72a6974554880fe785198c35d4f82f831c08ad0ce5184d68d58ac0fced6960b01406dc7698e296f3a5
@@ -1,3 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 1.9.3
3
4
  - 2.0.0
5
+ - 2.1.0
data/Rakefile CHANGED
@@ -46,7 +46,7 @@ task :flog do
46
46
  end
47
47
  end
48
48
 
49
- Rubocop::RakeTask.new do |task|
49
+ RuboCop::RakeTask.new do |task|
50
50
  task.patterns = %w(lib/**/*.rb
51
51
  spec/**/*.rb
52
52
  Rakefile
@@ -1,48 +1,46 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- if $PROGRAM_NAME == __FILE__
4
- require 'csvconv'
5
- require 'optparse'
3
+ require 'csvconv'
4
+ require 'optparse'
6
5
 
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)
6
+ options = {
7
+ sep: ',',
8
+ }
9
+ output = STDOUT
10
+ format = :json
41
11
 
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
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
- output.close
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
@@ -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
@@ -1,4 +1,4 @@
1
1
  # CSV converter
2
2
  module CSVConv
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe CSVConv do
4
4
  it 'should have a version number' do
5
- CSVConv::VERSION.should_not be_nil
5
+ expect(CSVConv::VERSION).not_to be_nil
6
6
  end
7
7
 
8
8
  shared_examples_for 'convert file format' do
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.1
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-05-31 00:00:00.000000000 Z
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