evva 0.1.3.1 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/changelog.md +9 -4
- data/lib/evva.rb +4 -3
- data/lib/evva/swift_generator.rb +13 -13
- data/lib/evva/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56e6842ab3d66a9abb5650bb441f0291e8c51e72
|
4
|
+
data.tar.gz: b823b271c2577b6fd072617d55546558a097ae10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32d566d2c257d59dd7dd5a8f19c07342322d3402ea34fb2e230126ec92e6410829ee5a9d2a302b829cfee0df0dfa52b9ac236807a82f6996df59a3b06443a8e7
|
7
|
+
data.tar.gz: f82155689b8307c2c7709921e5ee9f602612c13b5065d7b5a1ca32f253d0a7efe179be5cead7adf78e1de35eebf77ec1faa062ac3b5476a9de961fba60104156
|
data/changelog.md
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
# Change Log
|
2
|
+
##[0.1.4] - 2018-02-08
|
3
|
+
- Removes not needed enum file on Swift generator
|
4
|
+
- Removes Long type on Swift generator
|
5
|
+
- More tabbing fixes according to #9
|
6
|
+
|
2
7
|
##[0.1.3] - 2018-02-08
|
3
|
-
Fixes quotations and spacing on Swift code generation
|
8
|
+
- Fixes quotations and spacing on Swift code generation
|
4
9
|
|
5
10
|
##[0.1.2] - 2018-01-25
|
6
|
-
Improves swift code generation
|
11
|
+
- Improves swift code generation
|
7
12
|
|
8
13
|
## [0.1.1] - 2017-11-07
|
9
|
-
Fixes mismatch between file name and class name generated.
|
14
|
+
- Fixes mismatch between file name and class name generated.
|
10
15
|
|
11
16
|
## [0.1.0] - 2017/10/26
|
12
|
-
Initial Release.
|
17
|
+
- Initial Release.
|
data/lib/evva.rb
CHANGED
@@ -40,9 +40,10 @@ module Evva
|
|
40
40
|
path = "#{configuration.out_path}/#{configuration.event_file_name}.#{extension}"
|
41
41
|
write_to_file(path, generator.events(bundle[:events], configuration.event_file_name))
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
unless configuration.type.downcase == 'ios'
|
44
|
+
path = "#{configuration.out_path}/#{configuration.event_enum_file_name}.#{extension}"
|
45
|
+
write_to_file(path, generator.event_enum(bundle[:events], configuration.event_enum_file_name))
|
46
|
+
end
|
46
47
|
path = "#{configuration.out_path}/#{configuration.people_file_name}.#{extension}"
|
47
48
|
write_to_file(path, generator.people_properties(bundle[:people], configuration.people_file_name))
|
48
49
|
|
data/lib/evva/swift_generator.rb
CHANGED
@@ -4,7 +4,7 @@ module Evva
|
|
4
4
|
"import CoreLocation\n"\
|
5
5
|
"import Foundation\n"\
|
6
6
|
"import SharedCode\n\n"\
|
7
|
-
"class MixpanelHelper: NSObject {\n"\
|
7
|
+
"@objc class MixpanelHelper: NSObject {\n"\
|
8
8
|
"\tenum Event {\n".freeze
|
9
9
|
|
10
10
|
SWIFT_EVENT_DATA_HEADER =
|
@@ -14,23 +14,23 @@ module Evva
|
|
14
14
|
SWIFT_PEOPLE_HEADER = "fileprivate enum Counter: String {\n".freeze
|
15
15
|
|
16
16
|
SWIFT_INCREMENT_FUNCTION =
|
17
|
-
"
|
18
|
-
"
|
19
|
-
'}'.freeze
|
17
|
+
"\tfunc increment(times: Int = 1) {\n"\
|
18
|
+
"\t\tMixpanelAPI.instance.incrementCounter(rawValue, times: times)\n"\
|
19
|
+
'\t}'.freeze
|
20
20
|
|
21
|
-
NATIVE_TYPES = %w[
|
21
|
+
NATIVE_TYPES = %w[Int String Double Float Bool].freeze
|
22
22
|
|
23
23
|
def events(bundle, file_name)
|
24
24
|
event_file = SWIFT_EVENT_HEADER
|
25
25
|
bundle.each do |event|
|
26
26
|
event_file += swift_case(event)
|
27
27
|
end
|
28
|
-
event_file += "}\n"
|
28
|
+
event_file += "\t}\n\n"
|
29
29
|
event_file += SWIFT_EVENT_DATA_HEADER
|
30
30
|
bundle.each do |event|
|
31
31
|
event_file += swift_event_data(event)
|
32
32
|
end
|
33
|
-
event_file += "}\n}\n"
|
33
|
+
event_file += "\t}\n}\n"
|
34
34
|
end
|
35
35
|
|
36
36
|
def swift_case(event_data)
|
@@ -38,21 +38,21 @@ module Evva
|
|
38
38
|
if event_data.properties.empty?
|
39
39
|
"\t\tcase #{function_name}\n"
|
40
40
|
else
|
41
|
-
trimmed_properties = event_data.properties.map { |k, v| k.to_s + '
|
42
|
-
"\t\tcase #{function_name}(
|
41
|
+
trimmed_properties = event_data.properties.map { |k, v| k.to_s + ': ' + v.gsub('Boolean','Bool').gsub('Long', 'Int') }.join(", ")
|
42
|
+
"\t\tcase #{function_name}(#{trimmed_properties})\n"
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
def swift_event_data(event_data)
|
47
47
|
function_name = 'track' + titleize(event_data.event_name)
|
48
48
|
if event_data.properties.empty?
|
49
|
-
function_body = "\t\t\tcase .#{function_name}
|
50
|
-
"\t\t\t\treturn EventData(name
|
49
|
+
function_body = "\t\t\tcase .#{function_name}:\n" \
|
50
|
+
"\t\t\t\treturn EventData(name: \"#{event_data.event_name}\")\n\n"
|
51
51
|
else
|
52
52
|
function_header = prepend_let(event_data.properties)
|
53
|
-
function_arguments = process_arguments(event_data.properties.map { |k, v| "#{k}: #{v
|
53
|
+
function_arguments = process_arguments(event_data.properties.map { |k, v| "#{k}: #{v}" })
|
54
54
|
function_body = "\t\t\tcase .#{function_name}(#{function_header}):\n" \
|
55
|
-
"\t\t\t\treturn EventData(name
|
55
|
+
"\t\t\t\treturn EventData(name: \"#{event_data.event_name}\", properties: [#{function_arguments}])\n\n"
|
56
56
|
end
|
57
57
|
function_body
|
58
58
|
end
|
data/lib/evva/version.rb
CHANGED