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 +4 -4
- data/.gitignore +1 -0
- data/changelog.md +2 -0
- data/evva_config.yml +1 -1
- data/lib/evva.rb +1 -0
- data/lib/evva/swift_generator.rb +10 -11
- data/lib/evva/version.rb +2 -2
- 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: a2035011b8f6202d2b35fcd09ca78b8ff8bb6389
|
4
|
+
data.tar.gz: 5b95ccca60f3a3e4993a929b4fdca3b50dbc157f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ae9f0b205f9cd929e7450f75d2ad4945d0cec6afa012e678e8b09d5143a20a0b7042004a2938779b887428b10552a3b35017651c5220f19eeaa6d0f54e39eb2
|
7
|
+
data.tar.gz: 46c8e5461bb3d15f35fca9b9179ac47c9edfc1af55ed3d625204f120e80af0d80d57c319da15db3dc751dd11503a63d2039440c1119f5a116f42d1f36de43673
|
data/.gitignore
CHANGED
data/changelog.md
CHANGED
data/evva_config.yml
CHANGED
data/lib/evva.rb
CHANGED
data/lib/evva/swift_generator.rb
CHANGED
@@ -5,11 +5,11 @@ module Evva
|
|
5
5
|
"import Foundation\n"\
|
6
6
|
"import SharedCode\n\n"\
|
7
7
|
"class MixpanelHelper: NSObject {\n"\
|
8
|
-
"
|
8
|
+
"\tenum Event {\n".freeze
|
9
9
|
|
10
10
|
SWIFT_EVENT_DATA_HEADER =
|
11
|
-
"
|
12
|
-
"
|
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 +=
|
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| "
|
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 = "
|
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 = "
|
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
|
data/lib/evva/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: safe_yaml
|