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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56836eca037b3c53214be7ada6488144c465150e
4
- data.tar.gz: c2db5aea2dc56503fe22b3d3a97ce1e578093269
3
+ metadata.gz: 09a4ec7bd09d373ef7e917c9ed71c7501ac2773a
4
+ data.tar.gz: 17728d6a7145834fb61bf7a9e9517215e698b0d8
5
5
  SHA512:
6
- metadata.gz: 088e50b34dd94473673660946f746a5f0665699168aea60fc450dac347ad0433dd59ee91e0ca351b725265bf99ece8dd4f89d2bebeaf3aba737086833acecb5f
7
- data.tar.gz: e6a5eacb2473756d98f5cc8231a7722896d0f6d2cc87b687845b19928196544e31b9adf56fec0cd9f80e80ee1650f99a2347125486a1d521fbf945ad856b4cd8
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.5)
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.20161129)
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.2)
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}: Mappable {
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
@@ -1,3 +1,3 @@
1
1
  module Veda
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
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.6
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-05 00:00:00.000000000 Z
11
+ date: 2018-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake