ss2json 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -7,6 +7,8 @@
7
7
  * cli.rb (process_vertical) : New mode for processing in vertical was added.
8
8
  * cli.rb (open) : Added support for old excel files (not so much tested).
9
9
  * options.rb (initialize) : Added --version support.
10
+ * merge_jsons : Added the binary for merging several jsons into one
11
+ document.
10
12
 
11
13
  2012-05-23 Guillermo Alvarez <guillermo@cientifico.net>
12
14
 
data/bin/merge_jsons ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ unless (ARGV.size >= 1 && ARGV.all?{|f| File.file?(f)})
4
+ $stderr.puts "Usage: #{File.basename($0)} file1.json file2.json ..."
5
+ $stderr.puts <<-EOF
6
+ \nmerge_jsons will receive several files as an arguments and will generate
7
+ and write to the stdout the a json hash with the name of the filename
8
+ (without the extension) as a key, and the content of the file as a value
9
+ for each file passed.
10
+ EOF
11
+ exit -1
12
+ end
13
+
14
+ require 'rubygems'
15
+ require 'json'
16
+
17
+ global_hash = {}
18
+
19
+ ARGV.each do |file|
20
+ begin
21
+ json = JSON.parse(File.read(file))
22
+ rescue => e
23
+ $stderr.puts "Could not parse or read the file #{file}"
24
+ exit -1
25
+ end
26
+
27
+ key = File.basename(file).split(".").first
28
+ global_hash[key] = json
29
+
30
+ end
31
+
32
+ puts JSON.pretty_generate(global_hash)
@@ -1,3 +1,3 @@
1
1
  class Ss2Json
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ss2json
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Guillermo A\xCC\x81lvarez"
@@ -50,6 +50,7 @@ description: Convert SpreadSheet documents to json following some conventions.
50
50
  email:
51
51
  - guillermo@cientifico.net
52
52
  executables:
53
+ - merge_jsons
53
54
  - ss2json
54
55
  extensions: []
55
56
 
@@ -61,6 +62,7 @@ files:
61
62
  - Gemfile
62
63
  - README.md
63
64
  - Rakefile
65
+ - bin/merge_jsons
64
66
  - bin/ss2json
65
67
  - doc/ss2json-1.png
66
68
  - doc/ss2json-2.png