csv2json 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.md +105 -0
- data/Rakefile +55 -0
- data/bin/csv2json +61 -0
- data/lib/csv2json.rb +36 -0
- data/test/fixtures/addresses.csv +16 -0
- data/test/fixtures/addresses.json +167 -0
- data/test/fixtures/photos.csv +13 -0
- data/test/fixtures/photos.json +122 -0
- data/test/fixtures/population.csv +54 -0
- data/test/fixtures/population.json +744 -0
- data/test/helper.rb +10 -0
- data/test/test_csv2json.rb +20 -0
- metadata +80 -0
data/test/helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'csv2json.rb') # this form is important for local development
|
3
|
+
|
4
|
+
class TestCsv2json < Test::Unit::TestCase
|
5
|
+
should "parse some test files" do
|
6
|
+
fixtures_dir = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
|
7
|
+
Dir.chdir(fixtures_dir) do
|
8
|
+
Dir.glob('*.csv') do |filename|
|
9
|
+
json_template = File.basename(filename, ".csv")+'.json'
|
10
|
+
File.open(filename, "r") do |input|
|
11
|
+
output = StringIO.new()
|
12
|
+
CSV2JSON.parse(input, output)
|
13
|
+
template = File.read(json_template)
|
14
|
+
output.pos = 0
|
15
|
+
assert template == output.read
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: csv2json
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Antonin Hildebrand
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-05 00:00:00 +01:00
|
13
|
+
default_executable: csv2json
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: shoulda
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description: handy for converting xls files to json
|
26
|
+
email: antonin@hildebrand.cz
|
27
|
+
executables:
|
28
|
+
- csv2json
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README.md
|
34
|
+
files:
|
35
|
+
- .document
|
36
|
+
- .gitignore
|
37
|
+
- LICENSE
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- bin/csv2json
|
41
|
+
- lib/csv2json.rb
|
42
|
+
- test/fixtures/addresses.csv
|
43
|
+
- test/fixtures/addresses.json
|
44
|
+
- test/fixtures/photos.csv
|
45
|
+
- test/fixtures/photos.json
|
46
|
+
- test/fixtures/population.csv
|
47
|
+
- test/fixtures/population.json
|
48
|
+
- test/helper.rb
|
49
|
+
- test/test_csv2json.rb
|
50
|
+
has_rdoc: true
|
51
|
+
homepage: http://github.com/darwin/csv2json
|
52
|
+
licenses: []
|
53
|
+
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options:
|
56
|
+
- --charset=UTF-8
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
version:
|
71
|
+
requirements: []
|
72
|
+
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 1.3.5
|
75
|
+
signing_key:
|
76
|
+
specification_version: 3
|
77
|
+
summary: .csv to .json converter
|
78
|
+
test_files:
|
79
|
+
- test/helper.rb
|
80
|
+
- test/test_csv2json.rb
|