tocsv 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1c9b4d5a5ea10576d4d7957c0018f7a4e6b7392fb6111712fb42624dfc7b1bbe
4
+ data.tar.gz: aecdaec7d4d52ca92b657df57a92c85db4582b0e686784436d9a40afe716414c
5
+ SHA512:
6
+ metadata.gz: dd3a6af253ccb51bb89a33295e6b03da915c4a7ba08aeb802f0bda06dfd2110ed44483c37036d83017ac75e69714a84cdaddf63a83904bde06ad892036f0520d
7
+ data.tar.gz: 92af77cb29940a6189dcae0d668dc7cc696db1e048f497d14b3e9fa5d20f5001611e66f99423783222d4c136d1000e40bc3421448f696fadd4486b835bde7b07
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ *.swp
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.3
7
+ before_install: gem install bundler -v 1.17.1
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in tocsv.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,49 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ tocsv (0.1.0)
5
+ roo (~> 2.0)
6
+ roo-xls (~> 1.2.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.3)
12
+ mini_portile2 (2.3.0)
13
+ nokogiri (1.8.5)
14
+ mini_portile2 (~> 2.3.0)
15
+ roo (2.7.1)
16
+ nokogiri (~> 1)
17
+ rubyzip (~> 1.1, < 2.0.0)
18
+ roo-xls (1.2.0)
19
+ nokogiri
20
+ roo (>= 2.0.0, < 3)
21
+ spreadsheet (> 0.9.0)
22
+ rspec (3.8.0)
23
+ rspec-core (~> 3.8.0)
24
+ rspec-expectations (~> 3.8.0)
25
+ rspec-mocks (~> 3.8.0)
26
+ rspec-core (3.8.0)
27
+ rspec-support (~> 3.8.0)
28
+ rspec-expectations (3.8.2)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.8.0)
31
+ rspec-mocks (3.8.0)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.8.0)
34
+ rspec-support (3.8.0)
35
+ ruby-ole (1.2.12.1)
36
+ rubyzip (1.2.2)
37
+ spreadsheet (1.1.8)
38
+ ruby-ole (>= 1.0)
39
+
40
+ PLATFORMS
41
+ ruby
42
+
43
+ DEPENDENCIES
44
+ bundler (~> 1.17)
45
+ rspec (~> 3.0)
46
+ tocsv!
47
+
48
+ BUNDLED WITH
49
+ 1.17.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 jiangzhi.xie
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # To CSV
2
+
3
+ A tool to convert spreadsheet to csv format
4
+
5
+ ## Support formats
6
+
7
+ * xlsx: Excel 2007 - 2013
8
+ * xlsm: Excel 2007 - 2013
9
+ * xls: Excel 97,
10
+ * ods: LibreOffice / OpenOffice.org
11
+ * xml: Excel 2002 2003 XML
12
+
13
+ **More see roo-rb/roo**
14
+
15
+
16
+ ## Installation
17
+
18
+ ```
19
+ $ gem install tocsv
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ Convert first sheet
25
+
26
+ ```
27
+ $ tocsv mydata.xls > mydata.csv
28
+ ```
29
+
30
+ Specifiy a sheet index
31
+
32
+ ```
33
+ $ tocsv mydata.xls:1 > mydata_sheet1.csv
34
+ ```
35
+
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/xiejiangzhi/tocsv.
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/exe/tocsv ADDED
@@ -0,0 +1,19 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'csv'
4
+ require 'roo'
5
+ require 'roo-xls'
6
+
7
+ path, sheet = ARGV.first.split(':')
8
+
9
+ unless File.exists?(path)
10
+ puts "Not found file"
11
+ puts "Usage: tocsv /path/to/your/file.xlsx > data.csv"
12
+ exit
13
+ end
14
+
15
+ xlsx = Roo::Spreadsheet.open(path)
16
+ str = CSV.generate do |csv|
17
+ xlsx.sheet(sheet.to_i).to_a.each { |row| csv << row }
18
+ end
19
+ puts str
@@ -0,0 +1,3 @@
1
+ module Tocsv
2
+ VERSION = "0.1.0"
3
+ end
data/lib/tocsv.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "tocsv/version"
2
+
3
+ module Tocsv
4
+ end
data/tocsv.gemspec ADDED
@@ -0,0 +1,31 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "tocsv/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tocsv"
8
+ spec.version = Tocsv::VERSION
9
+ spec.authors = ["jiangzhi.xie"]
10
+ spec.email = ["xiejiangzhi@gmail.com"]
11
+
12
+ spec.summary = %q{A tool to convert xls, xlsx, ect to csv}
13
+ spec.description = %q{A tool to convert xls, xlsx, ect to csv}
14
+ spec.homepage = "https://github.com/xiejiangzhi/tocsv"
15
+ spec.license = "MIT"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_dependency "roo", "~> 2.0"
27
+ spec.add_dependency "roo-xls", "~> 1.2.0"
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.17"
30
+ spec.add_development_dependency "rspec", "~> 3.0"
31
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tocsv
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - jiangzhi.xie
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: roo
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: roo-xls
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.17'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.17'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: A tool to convert xls, xlsx, ect to csv
70
+ email:
71
+ - xiejiangzhi@gmail.com
72
+ executables:
73
+ - tocsv
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - Gemfile.lock
82
+ - LICENSE.txt
83
+ - README.md
84
+ - Rakefile
85
+ - exe/tocsv
86
+ - lib/tocsv.rb
87
+ - lib/tocsv/version.rb
88
+ - tocsv.gemspec
89
+ homepage: https://github.com/xiejiangzhi/tocsv
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.7.6
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: A tool to convert xls, xlsx, ect to csv
113
+ test_files: []