scon 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 +4 -4
- data/bin/scon +32 -0
- data/lib/scon/version.rb +1 -1
- data/scon.gemspec +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96a8ac80f8ff0d178edd9e66402b49e7ab1d580d
|
4
|
+
data.tar.gz: db5548b13106dfdfc836349d6b436697c213d950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02acd1ce5075bff0b0de6878b25b4b6b5d81a6f193d770f5a361150fb47c45a66cfb407270739bb787cb917ab7c687bc07bc8c4742501283eea9266d9e729515
|
7
|
+
data.tar.gz: 5aa365eef16c84a7b533dcd3665293cfe958b2d4d24aacb97b272a7aec243fbdf1720e84788c706f5115a1d7516285b7c52ece4bd6649c7037aa5dd522daa01f
|
data/bin/scon
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'scon'
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
@options = { :type => :json }
|
6
|
+
OptionParser.new do |o|
|
7
|
+
o.on("-o", "--output FILE", "Output generated SCON to the file") {|x| @options[:output] = x }
|
8
|
+
o.on("-i", "--input FILE", "Input JSON from a specified file") {|x| @options[:input] = x }
|
9
|
+
o.on("--json", "Use JSON as an input type") {|x| @options[:type] = :json}
|
10
|
+
o.on("--msgpack", "Use MessagePack as an input type") {|x| @options[:type] = :msgpack}
|
11
|
+
end.parse!
|
12
|
+
|
13
|
+
if @options.include? :type
|
14
|
+
@type = @options[:type]
|
15
|
+
require "#{@type.to_s}"
|
16
|
+
else
|
17
|
+
require "json"
|
18
|
+
end
|
19
|
+
|
20
|
+
def parse data
|
21
|
+
case @type
|
22
|
+
when :json
|
23
|
+
return JSON.parse(data)
|
24
|
+
when :msgpack
|
25
|
+
return MessagePack.unpack(data)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
data = @options.include?(:input) ? File.read(@options[:input]) : ARGF.read
|
30
|
+
scon = SCON.generate! parse(data)
|
31
|
+
|
32
|
+
@options.include?(:output) ? File.write(@options[:output], scon) : $stdout.puts(scon)
|
data/lib/scon/version.rb
CHANGED
data/scon.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
|
26
26
|
spec.bindir = "bin"
|
27
27
|
spec.files = Dir.glob("lib/**/*") + ['Rakefile', 'scon.gemspec', 'Gemfile', 'Rakefile']
|
28
|
-
spec.executables = []
|
28
|
+
spec.executables = ["scon"]
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
31
|
spec.add_development_dependency "bundler"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JacisNonsense
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,12 +44,14 @@ description: |-
|
|
44
44
|
reusing duplicate keys with a binary reference and clever type definitions.
|
45
45
|
email:
|
46
46
|
- jaci.brunning@gmail.com
|
47
|
-
executables:
|
47
|
+
executables:
|
48
|
+
- scon
|
48
49
|
extensions: []
|
49
50
|
extra_rdoc_files: []
|
50
51
|
files:
|
51
52
|
- Gemfile
|
52
53
|
- Rakefile
|
54
|
+
- bin/scon
|
53
55
|
- lib/scon.rb
|
54
56
|
- lib/scon/constants.rb
|
55
57
|
- lib/scon/generator.rb
|