vulcano 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -1
- data/lib/vulcano/version.rb +1 -1
- data/lib/vulcano.rb +23 -2
- data/resources/TemplateFile.swift +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bec1a2e75ca067374d1f62dc992368be1d61511
|
4
|
+
data.tar.gz: 8d9add772d73b62f4c7e5a3326359c41b2f468f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f2fa6e2d4c94a18cc6cffae2e1f70cc6c5f9feefb07ab5135d4beb43c4df53cc923486341952cc9768c8b5e451402c10ade270edd0d6bdffe41ff188765b62b
|
7
|
+
data.tar.gz: 88fb5229c05d5f6679c6c54c48364784853827a40e64a3d115d222b461f152e32b3638531e41e62d0acf96aa3976c956d749114933e0dba2c8720431e6309e6a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/vulcano/version.rb
CHANGED
data/lib/vulcano.rb
CHANGED
@@ -3,16 +3,37 @@ require "vulcano/json_reader"
|
|
3
3
|
require "vulcano/codable_generator"
|
4
4
|
require "json"
|
5
5
|
require "erb"
|
6
|
+
require 'optparse'
|
6
7
|
|
7
8
|
module Vulcano
|
8
9
|
class Main
|
9
10
|
def start
|
10
11
|
raise RuntimeError, 'The script has to be called with a JSON path' unless ARGV.length > 0
|
11
12
|
|
13
|
+
options = parse_options()
|
14
|
+
|
12
15
|
json_path = ARGV[0]
|
13
|
-
destination_folder =
|
16
|
+
destination_folder = options[:destination_folder].nil? ? "." : options[:destination_folder]
|
14
17
|
json = JsonReader.new.read_from_file(json_path)
|
15
|
-
CodableGenerator.new.generate_codable_file(json, destination_folder)
|
18
|
+
CodableGenerator.new.generate_codable_file(json, destination_folder, options[:class_name])
|
19
|
+
end
|
20
|
+
|
21
|
+
def parse_options
|
22
|
+
options = {}
|
23
|
+
|
24
|
+
OptionParser.new do |opts|
|
25
|
+
opts.banner = "Usage: vulcano json_path [options]"
|
26
|
+
|
27
|
+
opts.on("-d", "--destination-folder DESTINATION_FOLDER", String, "Destination folder for the generated source") do |destination_folder|
|
28
|
+
options[:destination_folder] = destination_folder
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on("-n", "--class-name CLASS_NAME", String, "Name for the generated class (the default name is 'Generated')") do |class_name|
|
32
|
+
options[:class_name] = class_name
|
33
|
+
end
|
34
|
+
end.parse!
|
35
|
+
|
36
|
+
return options
|
16
37
|
end
|
17
38
|
end
|
18
39
|
end
|
@@ -1,3 +1,9 @@
|
|
1
|
+
//
|
2
|
+
// <%= @name %>.swift
|
3
|
+
//
|
4
|
+
// Generated with Vulcano https://rubygems.org/gems/vulcano/.
|
5
|
+
//
|
6
|
+
|
1
7
|
class <%= @name %>: Codable {<% for @variable in @variables %>
|
2
8
|
var <%= @variable.name %>: <%= @variable.type %><% end %><% if (@codable_keys != nil) then %>
|
3
9
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vulcano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Meloni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|