evva 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/changelog.md +9 -1
- data/lib/evva/google_sheet.rb +2 -2
- data/lib/evva/swift_generator.rb +3 -0
- data/lib/evva/templates/swift/destinations.swift +1 -1
- data/lib/evva/templates/swift/people_properties.swift +1 -1
- data/lib/evva/version.rb +1 -1
- data/spec/fixtures/sample_public_events.csv +1 -0
- data/spec/lib/evva/google_sheet_spec.rb +1 -0
- data/spec/lib/evva/swift_generator_spec.rb +15 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4bd21f1186f93a3a74f4febc9a78aecd96143670f80c6439bdb3f77fc7fdd7bf
|
|
4
|
+
data.tar.gz: 12d0b83ac30590bcf4eba94bff73a2935fe10e6a6f40279e71c3fb146a965f2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ded77a6c3d166d091190ec6aef7bf3b07956ca86f2f32c2817acd6e001b35cb8d31ee843f1e72a3b79a4997dbc38ace293614ca06535c4a25151d7bd5871de7
|
|
7
|
+
data.tar.gz: 497b8ae862042b0d926fd88e21507abaa2a1500a63ed28a999691efa8057940ced0f1d3d57b8e2ce5045d2d1032aff4078eedd2cbaa3cf912a625bb877181d71
|
data/Gemfile.lock
CHANGED
data/changelog.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## [0.8.2] - 2026-05-26
|
|
4
|
+
|
|
5
|
+
- Strip whitespace from property names and types when parsing CSV, fixing double spaces in generated Swift code
|
|
6
|
+
|
|
7
|
+
## [0.8.1] - 2026-05-26
|
|
8
|
+
|
|
9
|
+
- Fix missing optional chaining for Swift people properties (`value?.rawValue` instead of `value.rawValue`)
|
|
10
|
+
- Escape Swift reserved keywords in generated enum case names (e.g. `` case `default` ``)
|
|
11
|
+
- Remove redundant `public` modifier from `Destination` enum inside `public extension`
|
|
4
12
|
|
|
5
13
|
## [0.8.0] - 2026-05-26
|
|
6
14
|
|
data/lib/evva/google_sheet.rb
CHANGED
|
@@ -101,8 +101,8 @@ module Evva
|
|
|
101
101
|
unless property_array.nil? || property_array.empty?
|
|
102
102
|
property_array.split(",").each do |prop|
|
|
103
103
|
split_prop = prop.split(":")
|
|
104
|
-
prop_name = split_prop[0].to_sym
|
|
105
|
-
prop_type = split_prop[1].to_s
|
|
104
|
+
prop_name = split_prop[0].strip.to_sym
|
|
105
|
+
prop_type = split_prop[1].to_s.strip
|
|
106
106
|
h[prop_name] = prop_type
|
|
107
107
|
end
|
|
108
108
|
end
|
data/lib/evva/swift_generator.rb
CHANGED
|
@@ -11,6 +11,7 @@ module Evva
|
|
|
11
11
|
TAB_SIZE = " " # \t -> 4 spaces
|
|
12
12
|
|
|
13
13
|
NATIVE_TYPES = %w[Int String Double Float Bool Date].freeze
|
|
14
|
+
SWIFT_KEYWORDS = %w[default].freeze
|
|
14
15
|
|
|
15
16
|
def initialize(swift_public: false)
|
|
16
17
|
@swift_public_modifier = swift_public ? "public " : ""
|
|
@@ -64,6 +65,7 @@ module Evva
|
|
|
64
65
|
property_name: p.property_name,
|
|
65
66
|
type: type,
|
|
66
67
|
is_special_property: special_property?(type),
|
|
68
|
+
is_optional: type.end_with?("?"),
|
|
67
69
|
destinations: p.destinations.map { |p| camelize(p) },
|
|
68
70
|
}
|
|
69
71
|
end
|
|
@@ -136,6 +138,7 @@ module Evva
|
|
|
136
138
|
string = string.sub(/^(?:#{@acronym_regex}(?=\b|[A-Z_])|\w)/) { |match| match.downcase }
|
|
137
139
|
string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }
|
|
138
140
|
string.gsub!("/".freeze, "::".freeze)
|
|
141
|
+
string = "`#{string}`" if SWIFT_KEYWORDS.include?(string)
|
|
139
142
|
string
|
|
140
143
|
end
|
|
141
144
|
end
|
|
@@ -40,7 +40,7 @@ enum Property {
|
|
|
40
40
|
<%- properties.each_with_index do |p, index| -%>
|
|
41
41
|
case let .<%= p[:case_name] %>(value):
|
|
42
42
|
return PropertyData(type: .<%= p[:case_name] %>,
|
|
43
|
-
value: value<% if p[:is_special_property] %>.rawValue<% end %>)
|
|
43
|
+
value: value<% if p[:is_special_property] %><%= "?" if p[:is_optional] %>.rawValue<% end %>)
|
|
44
44
|
<%- unless index == properties.count - 1 -%>
|
|
45
45
|
|
|
46
46
|
<%- end -%>
|
data/lib/evva/version.rb
CHANGED
|
@@ -2,3 +2,4 @@ Event Name,Event Properties,Event Destination
|
|
|
2
2
|
cp_page_view,"course_id:Long,course_name:String","firebase,custom destination"
|
|
3
3
|
nav_feed_tap,,
|
|
4
4
|
cp_view_scorecard,"course_id:Long,course_name:String","custom destination"
|
|
5
|
+
side_game_delete,"fromScreen: SideGameFromScreen,round_group_creation_token:String",firebase
|
|
@@ -26,6 +26,7 @@ describe Evva::GoogleSheet do
|
|
|
26
26
|
Evva::AnalyticsEvent.new("cp_page_view", { course_id: "Long", course_name: "String" }, ["firebase", "custom destination"]),
|
|
27
27
|
Evva::AnalyticsEvent.new("nav_feed_tap", {}, []),
|
|
28
28
|
Evva::AnalyticsEvent.new("cp_view_scorecard", { course_id: "Long", course_name: "String" }, ["custom destination"]),
|
|
29
|
+
Evva::AnalyticsEvent.new("side_game_delete", { fromScreen: "SideGameFromScreen", round_group_creation_token: "String" }, ["firebase"]),
|
|
29
30
|
]
|
|
30
31
|
expect(events).to eq(expected)
|
|
31
32
|
end
|
|
@@ -113,6 +113,7 @@ Swift
|
|
|
113
113
|
let(:enums) { [
|
|
114
114
|
Evva::AnalyticsEnum.new("CourseProfileSource", ["course_discovery", "synced_courses"]),
|
|
115
115
|
Evva::AnalyticsEnum.new("PremiumFrom", ["Course Profile", "Round Setup"]),
|
|
116
|
+
Evva::AnalyticsEnum.new("PreAuthenticationScreenType", ["default", "self_improvement"]),
|
|
116
117
|
] }
|
|
117
118
|
|
|
118
119
|
let(:expected) {
|
|
@@ -131,6 +132,11 @@ extension Analytics {
|
|
|
131
132
|
case courseProfile = "Course Profile"
|
|
132
133
|
case roundSetup = "Round Setup"
|
|
133
134
|
}
|
|
135
|
+
|
|
136
|
+
enum PreAuthenticationScreenType: String {
|
|
137
|
+
case `default` = "default"
|
|
138
|
+
case selfImprovement = "self_improvement"
|
|
139
|
+
}
|
|
134
140
|
}
|
|
135
141
|
Swift
|
|
136
142
|
}
|
|
@@ -144,6 +150,7 @@ Swift
|
|
|
144
150
|
let(:people_bundle) { [
|
|
145
151
|
Evva::AnalyticsProperty.new("rounds_with_wear", "String", ["firebase"]),
|
|
146
152
|
Evva::AnalyticsProperty.new("wear_platform", "WearableAppPlatform", ["firebase", "custom destination"]),
|
|
153
|
+
Evva::AnalyticsProperty.new("reverse_trial_type", "ReverseTrialType?", ["firebase"]),
|
|
147
154
|
Evva::AnalyticsProperty.new("number_of_times_it_happened", "Long", []),
|
|
148
155
|
] }
|
|
149
156
|
|
|
@@ -173,6 +180,7 @@ extension Analytics {
|
|
|
173
180
|
enum PropertyType: String {
|
|
174
181
|
case roundsWithWear = "rounds_with_wear"
|
|
175
182
|
case wearPlatform = "wear_platform"
|
|
183
|
+
case reverseTrialType = "reverse_trial_type"
|
|
176
184
|
case numberOfTimesItHappened = "number_of_times_it_happened"
|
|
177
185
|
|
|
178
186
|
var name: String { return rawValue }
|
|
@@ -181,6 +189,7 @@ extension Analytics {
|
|
|
181
189
|
switch self {
|
|
182
190
|
case .roundsWithWear: return [.firebase]
|
|
183
191
|
case .wearPlatform: return [.firebase, .customDestination]
|
|
192
|
+
case .reverseTrialType: return [.firebase]
|
|
184
193
|
case .numberOfTimesItHappened: return []
|
|
185
194
|
}
|
|
186
195
|
}
|
|
@@ -189,6 +198,7 @@ extension Analytics {
|
|
|
189
198
|
enum Property {
|
|
190
199
|
case roundsWithWear(String)
|
|
191
200
|
case wearPlatform(WearableAppPlatform)
|
|
201
|
+
case reverseTrialType(ReverseTrialType?)
|
|
192
202
|
case numberOfTimesItHappened(Int)
|
|
193
203
|
|
|
194
204
|
var data: PropertyData {
|
|
@@ -201,6 +211,10 @@ extension Analytics {
|
|
|
201
211
|
return PropertyData(type: .wearPlatform,
|
|
202
212
|
value: value.rawValue)
|
|
203
213
|
|
|
214
|
+
case let .reverseTrialType(value):
|
|
215
|
+
return PropertyData(type: .reverseTrialType,
|
|
216
|
+
value: value?.rawValue)
|
|
217
|
+
|
|
204
218
|
case let .numberOfTimesItHappened(value):
|
|
205
219
|
return PropertyData(type: .numberOfTimesItHappened,
|
|
206
220
|
value: value)
|
|
@@ -249,7 +263,7 @@ Swift
|
|
|
249
263
|
import Foundation
|
|
250
264
|
|
|
251
265
|
public extension Analytics {
|
|
252
|
-
|
|
266
|
+
enum Destination {
|
|
253
267
|
case firebase
|
|
254
268
|
case whateverYouWantReally
|
|
255
269
|
}
|