evva 0.1.2 → 0.1.3

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: 0ecc532385f462a9f37aec975d66fbd19b18aa05
4
- data.tar.gz: acea35b0751f2f5574da3c75a615911a2093c6ab
3
+ metadata.gz: a2035011b8f6202d2b35fcd09ca78b8ff8bb6389
4
+ data.tar.gz: 5b95ccca60f3a3e4993a929b4fdca3b50dbc157f
5
5
  SHA512:
6
- metadata.gz: f628dec72519c201300590971a50c6ad81e7d0fe43d529b10b8d36f5463f03536c522a6307d2a082f2a39f55a147d626db9840521dca271cb895c336bc2ab668
7
- data.tar.gz: 9a69b2a1810f3ea7a783e399fbda02eb03806526680096dfa1fb7f438e258480b4f7c551bb304078e4f0371b051bc48faa87bdac3dfbf3d2ac58f8aae5832d38
6
+ metadata.gz: 9ae9f0b205f9cd929e7450f75d2ad4945d0cec6afa012e678e8b09d5143a20a0b7042004a2938779b887428b10552a3b35017651c5220f19eeaa6d0f54e39eb2
7
+ data.tar.gz: 46c8e5461bb3d15f35fca9b9179ac47c9edfc1af55ed3d625204f120e80af0d80d57c319da15db3dc751dd11503a63d2039440c1119f5a116f42d1f36de43673
data/.gitignore CHANGED
@@ -3,3 +3,4 @@
3
3
  running
4
4
  coverage
5
5
  .DS_Store*
6
+ .byebug_history
@@ -1,4 +1,6 @@
1
1
  # Change Log
2
+ ##[0.1.3] - 2018-02-08
3
+ Fixes quotations and spacing on Swift code generation
2
4
 
3
5
  ##[0.1.2] - 2018-01-25
4
6
  Improves swift code generation
@@ -1,4 +1,4 @@
1
- type: Android
1
+ type: iOS
2
2
 
3
3
  data_source:
4
4
  type: google_sheet
@@ -1,5 +1,6 @@
1
1
  require 'optparse'
2
2
  require 'yaml'
3
+ require 'byebug'
3
4
 
4
5
  require 'evva/logger'
5
6
  require 'evva/google_sheet'
@@ -5,11 +5,11 @@ module Evva
5
5
  "import Foundation\n"\
6
6
  "import SharedCode\n\n"\
7
7
  "class MixpanelHelper: NSObject {\n"\
8
- "enum Event {\n".freeze
8
+ "\tenum Event {\n".freeze
9
9
 
10
10
  SWIFT_EVENT_DATA_HEADER =
11
- "private var data: EventData {\n"\
12
- "switch self {\n\n\n".freeze
11
+ "\t\tprivate var data: EventData {\n"\
12
+ "\t\t\tswitch self {\n".freeze
13
13
 
14
14
  SWIFT_PEOPLE_HEADER = "fileprivate enum Counter: String {\n".freeze
15
15
 
@@ -26,8 +26,7 @@ module Evva
26
26
  event_file += swift_case(event)
27
27
  end
28
28
  event_file += "}\n"
29
- event_file += "private var data: EventData {\n"\
30
- "switch self {\n\n"
29
+ event_file += SWIFT_EVENT_DATA_HEADER
31
30
  bundle.each do |event|
32
31
  event_file += swift_event_data(event)
33
32
  end
@@ -39,21 +38,21 @@ module Evva
39
38
  if event_data.properties.empty?
40
39
  "\t\tcase #{function_name}\n"
41
40
  else
42
- trimmed_properties = event_data.properties.map { |k, v| "#{k}: #{v.gsub('Boolean', 'Bool')}" }
43
- "\t\tcase #{function_name}(#{trimmed_properties})\n"
41
+ trimmed_properties = event_data.properties.map { |k, v| k.to_s + '": ' + v.gsub('Boolean', 'Bool') }.join(",\"")
42
+ "\t\tcase #{function_name}(\"#{trimmed_properties})\n"
44
43
  end
45
44
  end
46
45
 
47
46
  def swift_event_data(event_data)
48
47
  function_name = 'track' + titleize(event_data.event_name)
49
48
  if event_data.properties.empty?
50
- function_body = "case .#{function_name} \n" \
51
- "\treturn EventData(name:\"#{event_data.event_name}\")\n\n"
49
+ function_body = "\t\t\tcase .#{function_name} \n" \
50
+ "\t\t\t\treturn EventData(name:\"#{event_data.event_name}\")\n\n"
52
51
  else
53
52
  function_header = prepend_let(event_data.properties)
54
53
  function_arguments = process_arguments(event_data.properties.map { |k, v| "#{k}: #{v.gsub('Boolean', 'Bool')}" })
55
- function_body = "case .#{function_name}(#{function_header}):\n" \
56
- "\treturn EventData(name:\"#{event_data.event_name}\", properties: [#{function_arguments}])\n\n"
54
+ function_body = "\t\t\tcase .#{function_name}(#{function_header}):\n" \
55
+ "\t\t\t\treturn EventData(name:\"#{event_data.event_name}\", properties: [#{function_arguments}])\n\n"
57
56
  end
58
57
  function_body
59
58
  end
@@ -1,4 +1,4 @@
1
1
  module Evva
2
- VERSION = '0.1.2'.freeze
3
- VERSION_UPDATED_AT = '2018-01-25'.freeze
2
+ VERSION = '0.1.3'.freeze
3
+ VERSION_UPDATED_AT = '2018-02-08'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - RicardoTrindade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-25 00:00:00.000000000 Z
11
+ date: 2018-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: safe_yaml