veda-apps 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/parser.rb +16 -5
- data/lib/veda/version.rb +1 -1
- 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: 09a4ec7bd09d373ef7e917c9ed71c7501ac2773a
|
4
|
+
data.tar.gz: 17728d6a7145834fb61bf7a9e9517215e698b0d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de41731697fc54d4c66b64bbd1753b6aa7d29cf200eabcd50482b941e31b662c34f354832693a031405f7b72e86ce811ac946f798f80fbad93d562e799b2f0d1
|
7
|
+
data.tar.gz: e2985944fa9e3a2678aefc93b2c73a7c62bbaff73d691d78ad034347ed339aa9270f4e8d30ca6b34a1f554b33579ed12c2e25a2d0c5b306b05e9f951da41485f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
veda-apps (0.0.
|
4
|
+
veda-apps (0.0.6)
|
5
5
|
gli (= 2.17.1)
|
6
6
|
rest-client
|
7
7
|
|
@@ -37,7 +37,7 @@ GEM
|
|
37
37
|
cucumber-tag_expressions (1.1.1)
|
38
38
|
cucumber-wire (0.0.1)
|
39
39
|
diff-lcs (1.3)
|
40
|
-
domain_name (0.5.
|
40
|
+
domain_name (0.5.20170404)
|
41
41
|
unf (>= 0.0.5, < 1.0.0)
|
42
42
|
ffi (1.9.18)
|
43
43
|
gherkin (5.0.0)
|
@@ -63,7 +63,7 @@ GEM
|
|
63
63
|
thor (0.20.0)
|
64
64
|
unf (0.1.4)
|
65
65
|
unf_ext
|
66
|
-
unf_ext (0.0.7.
|
66
|
+
unf_ext (0.0.7.4)
|
67
67
|
|
68
68
|
PLATFORMS
|
69
69
|
ruby
|
data/lib/parser.rb
CHANGED
@@ -6,6 +6,9 @@ require 'uri'
|
|
6
6
|
class String
|
7
7
|
def camelize
|
8
8
|
filtered = self.split('_').select {|v| v != ""}
|
9
|
+
if self == ""
|
10
|
+
return "--INVALID--"
|
11
|
+
end
|
9
12
|
camel_text = filtered[1..-1].collect(&:capitalize).join
|
10
13
|
camel_text = filtered.first.nil? ? self : (filtered.first + camel_text)
|
11
14
|
camel_text.unHyphoniezed
|
@@ -66,6 +69,7 @@ class Parser
|
|
66
69
|
File.open(_filename, "w") do |file|
|
67
70
|
file.write content
|
68
71
|
puts "created file #{_filename}"
|
72
|
+
# puts content
|
69
73
|
end
|
70
74
|
# end
|
71
75
|
end
|
@@ -112,7 +116,8 @@ class Parser
|
|
112
116
|
end
|
113
117
|
elsif json.is_a? Array
|
114
118
|
if json.first.is_a? Hash
|
115
|
-
generate_attributes_literals json.first
|
119
|
+
newSwiftClass = generate_attributes_literals json.first
|
120
|
+
@parsed.store("TOPLEVELCONTAINER", newSwiftClass)
|
116
121
|
end
|
117
122
|
end
|
118
123
|
# swiftClass
|
@@ -189,7 +194,7 @@ CLASS
|
|
189
194
|
if @json.is_a? Hash
|
190
195
|
@parsed.store("Container", swiftClass)
|
191
196
|
end
|
192
|
-
|
197
|
+
all_content = ""
|
193
198
|
@parsed.each do |class_name, attributes|
|
194
199
|
attribute_literals = ""
|
195
200
|
mapping_literals = ""
|
@@ -199,9 +204,9 @@ CLASS
|
|
199
204
|
mapping_literal = ""
|
200
205
|
key_literal = ""
|
201
206
|
if attribute.is_array
|
202
|
-
attribute_literal = "\tlet #{attribute.name.camelize}: [#{attribute.type.capitalize}]\n"
|
207
|
+
attribute_literal = "\tlet #{attribute.name.camelize}: [#{attribute.type.capitalize.camelize}]\n"
|
203
208
|
else
|
204
|
-
attribute_literal = "\tlet #{attribute.name.camelize}: #{attribute.type.capitalize}\n"
|
209
|
+
attribute_literal = "\tlet #{attribute.name.camelize}: #{attribute.type.capitalize.camelize}\n"
|
205
210
|
end
|
206
211
|
mapping_literal = "\t\t#{attribute.name.camelize} = try map.from(Key.#{attribute.name.camelize})\n"
|
207
212
|
key_literal = "\t\tstatic let #{attribute.name.camelize} = \"#{attribute.name}\"\n"
|
@@ -215,12 +220,16 @@ CLASS
|
|
215
220
|
// Created with veda-apps.
|
216
221
|
// https://rubygems.org/gems/veda-apps
|
217
222
|
//
|
223
|
+
|
218
224
|
import Foundation
|
219
225
|
import Moya
|
220
226
|
import Mapper
|
221
227
|
|
222
|
-
struct #{class_name}
|
228
|
+
struct #{class_name} {
|
223
229
|
#{attribute_literals}
|
230
|
+
}
|
231
|
+
|
232
|
+
extension #{class_name}: Mappable {
|
224
233
|
\tinit(map: Mapper) throws {
|
225
234
|
#{mapping_literals}
|
226
235
|
\t}
|
@@ -230,8 +239,10 @@ struct #{class_name}: Mappable {
|
|
230
239
|
\t}
|
231
240
|
}\n
|
232
241
|
CLASS
|
242
|
+
all_content += ("\n\n" + class_model)
|
233
243
|
create_file class_name, class_model
|
234
244
|
end
|
245
|
+
create_file "ALLCONTENT", all_content
|
235
246
|
end
|
236
247
|
|
237
248
|
end
|
data/lib/veda/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: veda-apps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shishir sapkota
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|