evva 0.10.0 → 0.12.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dec4f42e824897d939df66cc400f64c7d0f8ed0afa61d7c47f90e35a3730593f
4
- data.tar.gz: 46151f2d8987db8501e73c84dd1d7cddf96fa8364d71495b9e838817bf73b24e
3
+ metadata.gz: 945fb4d07c2dc210b99bf3c55d982c11d4c1c1c7307c7490d205149cc86dc831
4
+ data.tar.gz: '0781922206107e696a41f94cd15382af80be989c29f03f72dc6b65a5a6453645'
5
5
  SHA512:
6
- metadata.gz: 0e48b6d338ad0cbea9604afe19ca59b1bcf4842cb28d10681c918a1a3e4532afc9346939c4748bc85cb753f5520e5552c3bc5fa7c45f08050da301249d9f1de9
7
- data.tar.gz: 0bea87253e07e92fbd7546ee66dd798b6418a7534c1f5655f42990f4d8ec83617bc081c763422ddb1a6c13eec40a1c2d33dc0e4e008c4ce638c17bb732328837
6
+ metadata.gz: 0e9b3fff1aec327f2444a1d6b989bc84b38d96aa0a7d691702b3cc81a2eb7b177ba059ab12aa9c620d54c4488cdf11acda28afa4779c415bc6791cf36ff8f0d4
7
+ data.tar.gz: 7bfb6cf627c14722c27f77339c6211116a73cc67edd28a28baef17f1f802a99c2ded603d5e4ddd6a9939c742feb77262e1445f926026eb332e7edf79f4219f6b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- evva (0.10.0)
4
+ evva (0.12.0)
5
5
  colorize (~> 1.0)
6
6
  csv (~> 3.0)
7
7
  safe_yaml (~> 1.0)
data/README.md CHANGED
@@ -48,10 +48,34 @@ Evva automatically generates code for triggering events based on a Google Sheets
48
48
  | Column | Required | Meaning |
49
49
  | --- | --- | --- |
50
50
  | `Event Name` | yes | The event name |
51
- | `Event Properties` | no | Comma separated `name:Type` pairs |
51
+ | `Event Properties` | no | `name:Type` pairs, comma separated or one per line |
52
52
  | `Event Destination` | no | Comma separated destinations |
53
53
  | `Platform` | no | Which platforms track the event |
54
54
 
55
+ ### Event Properties
56
+
57
+ Properties can be separated by commas, by line breaks inside the cell, or both,
58
+ so a long list can be kept readable with one property per line (Option+Enter
59
+ on Mac, Alt+Enter on Windows):
60
+
61
+ ```
62
+ handicap:Double?
63
+ playing_handicap:Int?
64
+ number_of_played_holes:Int
65
+ ```
66
+
67
+ Blank lines, trailing commas and spaces around items or around `:` are ignored.
68
+
69
+ Multi-line cells need evva 0.12.0 or newer. Older versions read the whole cell as
70
+ a single broken property, so only convert rows once every app generating from
71
+ the sheet has been updated.
72
+
73
+ ### Destinations
74
+
75
+ `Event Destination` (and `Property Destination` in the people properties sheet)
76
+ accepts the same separators, and spaces around each destination are ignored, so
77
+ the cell can be a multi-select dropdown, which writes values as `mixpanel, braze`.
78
+
55
79
  ### Platform
56
80
 
57
81
  `Platform` tags an event with the platforms it belongs to. Filtering is driven
data/changelog.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.12.0] - 2026-11-11
6
+
7
+ - `Event Properties` can be written one property per line (and mixed with commas); `Event Destination` and `Property Destination` trim spaces around each destination, so a multi-select dropdown (`mixpanel, braze`) works
8
+
9
+ ## [0.11.0] - 2026-11-09
10
+
11
+ - **Breaking:** Kotlin enum constants (events, people properties, special property enums and destinations) are now generated in PascalCase, e.g. `RoundStarted` instead of `ROUND_STARTED`. The `key` values are unchanged
12
+
5
13
  ## [0.10.0] - 2026-10-13
6
14
 
7
15
  - Support optional people properties in Kotlin: `innerValue` is now `Any?` and optional special properties use `value?.key`
@@ -34,9 +34,9 @@ module Evva
34
34
  @events_csv.map do |row|
35
35
  event_name = row[EVENT_NAME]
36
36
  properties = hash_parser(row[EVENT_PROPERTIES])
37
- destinations = row[EVENT_DESTINATION]&.split(",")
37
+ destinations = list_parser(row[EVENT_DESTINATION])
38
38
  platforms = platform_parser(platform_header && row[platform_header])
39
- Evva::AnalyticsEvent.new(event_name, properties, destinations || [], platforms)
39
+ Evva::AnalyticsEvent.new(event_name, properties, destinations, platforms)
40
40
  end
41
41
  end
42
42
  end
@@ -50,8 +50,8 @@ module Evva
50
50
  @people_properties ||= @people_properties_csv.map do |row|
51
51
  property_name = row[PROPERTY_NAME]
52
52
  property_type = row[PROPERTY_TYPE]
53
- destinations = row[PROPERTY_DESTINATION]&.split(",")
54
- Evva::AnalyticsProperty.new(property_name, property_type, destinations || [])
53
+ destinations = list_parser(row[PROPERTY_DESTINATION])
54
+ Evva::AnalyticsProperty.new(property_name, property_type, destinations)
55
55
  end
56
56
  end
57
57
 
@@ -118,15 +118,20 @@ module Evva
118
118
  tokens.map(&:downcase).uniq
119
119
  end
120
120
 
121
+ # Items may be separated by commas, line breaks, or both, so a long list can
122
+ # be written one item per line in the cell. A multi-select dropdown joins its
123
+ # values with ", ", hence the strip.
124
+ def list_parser(list)
125
+ list.to_s.split(/,|\r\n|\r|\n/).map(&:strip).reject(&:empty?)
126
+ end
127
+
121
128
  def hash_parser(property_array)
122
129
  h = {}
123
- unless property_array.nil? || property_array.empty?
124
- property_array.split(",").each do |prop|
125
- split_prop = prop.split(":")
126
- prop_name = split_prop[0].strip.to_sym
127
- prop_type = split_prop[1].to_s.strip
128
- h[prop_name] = prop_type
129
- end
130
+ list_parser(property_array).each do |prop|
131
+ split_prop = prop.split(":")
132
+ prop_name = split_prop[0].strip.to_sym
133
+ prop_type = split_prop[1].to_s.strip
134
+ h[prop_name] = prop_type
130
135
  end
131
136
  h
132
137
  end
@@ -47,11 +47,11 @@ module Evva
47
47
  }
48
48
  end
49
49
 
50
- destinations = event.destinations.map { |p| constantize(p) }
50
+ destinations = event.destinations.map { |p| pascalize(p) }
51
51
 
52
52
  {
53
53
  class_name: camelize(event.event_name),
54
- event_name: constantize(event.event_name),
54
+ event_name: pascalize(event.event_name),
55
55
  properties: properties,
56
56
  destinations: destinations
57
57
  }
@@ -67,7 +67,7 @@ module Evva
67
67
 
68
68
  events = bundle.map(&:event_name).map do |event_name|
69
69
  {
70
- name: constantize(event_name),
70
+ name: pascalize(event_name),
71
71
  value: event_name,
72
72
  }
73
73
  end
@@ -96,10 +96,10 @@ module Evva
96
96
 
97
97
  {
98
98
  class_name: camelize(property.property_name),
99
- property_name: constantize(property.property_name),
99
+ property_name: pascalize(property.property_name),
100
100
  type: type,
101
101
  value_fetcher: value_fetcher,
102
- destinations: property.destinations.map { |p| constantize(p) },
102
+ destinations: property.destinations.map { |p| pascalize(p) },
103
103
  }
104
104
  end
105
105
 
@@ -113,7 +113,7 @@ module Evva
113
113
 
114
114
  properties = people_bundle.map(&:property_name).map do |property_name|
115
115
  {
116
- name: constantize(property_name),
116
+ name: pascalize(property_name),
117
117
  value: property_name,
118
118
  }
119
119
  end
@@ -127,7 +127,7 @@ module Evva
127
127
  enums = enums_bundle.map do |enum|
128
128
  values = enum.values.map do |value|
129
129
  {
130
- name: constantize(value),
130
+ name: pascalize(value),
131
131
  value: value,
132
132
  }
133
133
  end
@@ -146,7 +146,7 @@ module Evva
146
146
  header_footer_wrapper do
147
147
  class_name = file_name
148
148
 
149
- destinations = bundle.map { |d| constantize(d) }
149
+ destinations = bundle.map { |d| pascalize(d) }
150
150
 
151
151
  template_from(DESTINATIONS_TEMPLATE).result(binding)
152
152
  end
@@ -181,8 +181,9 @@ module Evva
181
181
  string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub("/", "::")
182
182
  end
183
183
 
184
- def constantize(string)
185
- string.tr(" ", "_").upcase
184
+ def pascalize(string)
185
+ name = string.to_s.split(/[^\p{Alnum}]+/).map(&:capitalize).join
186
+ name.match?(/\A\p{L}/) ? name : "_#{name}"
186
187
  end
187
188
 
188
189
  def native_type(type)
data/lib/evva/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Evva
2
- VERSION = "0.10.0".freeze
3
- VERSION_UPDATED_AT = "2026-10-13".freeze
2
+ VERSION = "0.12.0".freeze
3
+ VERSION_UPDATED_AT = "2026-11-11".freeze
4
4
  end
@@ -0,0 +1,10 @@
1
+ Event Name,Event Properties,Event Destination
2
+ cp_page_view,"course_id:Long
3
+ course_name:String","firebase, custom destination"
4
+ nav_feed_tap,,
5
+ cp_view_scorecard,"course_id:Long,
6
+ course_name:String
7
+ ",custom destination
8
+ side_game_delete,"fromScreen: SideGameFromScreen
9
+
10
+ round_group_creation_token:String",firebase
@@ -0,0 +1,4 @@
1
+ Property Name,Property Type,Property Destination
2
+ rounds_with_wear,String,"firebase, custom destination"
3
+ total_friends,Int,
4
+ wearable_platform,WearableAppPlatform,firebase
@@ -31,6 +31,69 @@ describe Evva::GoogleSheet do
31
31
  expect(events).to eq(expected)
32
32
  end
33
33
 
34
+ context "when list cells use line breaks, as exported by Google Sheets" do
35
+ let(:events_file) { File.read("spec/fixtures/sample_public_events_multiline.csv") }
36
+
37
+ it "reads each multi-line cell as one field and parses it like the comma separated sheet" do
38
+ comma_separated = Evva::GoogleSheet.new(events_sheet, people_sheet, enum_sheet)
39
+ stub_request(:get, events_sheet).to_return(status: 200, body: File.read("spec/fixtures/sample_public_events.csv"))
40
+ expected = comma_separated.events
41
+
42
+ stub_request(:get, events_sheet).to_return(status: 200, body: events_file)
43
+ expect(events).to eq(expected)
44
+ end
45
+ end
46
+
47
+ describe "list cells" do
48
+ let(:events_file) { %(Event Name,Event Properties,Event Destination\nsome_event,"#{properties}","#{destinations}"\n) }
49
+ let(:properties) { "a:Int,b:String?" }
50
+ let(:destinations) { "mixpanel,braze" }
51
+
52
+ {
53
+ "comma separated" => "a:Int,b:String?",
54
+ "one per line" => "a:Int\nb:String?",
55
+ "one per line with CRLF" => "a:Int\r\nb:String?",
56
+ "one per line with CR" => "a:Int\rb:String?",
57
+ "mixed commas and line breaks" => "a:Int,\nb:String?",
58
+ "a trailing comma" => "a:Int,b:String?,",
59
+ "a trailing line break" => "a:Int\nb:String?\n",
60
+ "blank lines between items" => "a:Int\n\n\nb:String?",
61
+ "spaces around separators and colons" => " a : Int ,\n b: String? ",
62
+ }.each do |description, cell|
63
+ context "with event properties written with #{description}" do
64
+ let(:properties) { cell }
65
+
66
+ it "parses the same properties" do
67
+ expect(events.first.properties).to eq(a: "Int", b: "String?")
68
+ end
69
+ end
70
+ end
71
+
72
+ {
73
+ "comma separated" => "mixpanel,braze",
74
+ "as a multi-select dropdown (comma and space)" => "mixpanel, braze",
75
+ "one per line" => "mixpanel\nbraze",
76
+ "a trailing comma" => "mixpanel,braze,",
77
+ }.each do |description, cell|
78
+ context "with event destinations written #{description}" do
79
+ let(:destinations) { cell }
80
+
81
+ it "parses the same destinations" do
82
+ expect(events.first.destinations).to eq(["mixpanel", "braze"])
83
+ end
84
+ end
85
+ end
86
+
87
+ context "with empty cells" do
88
+ let(:events_file) { "Event Name,Event Properties,Event Destination\nsome_event,,\n" }
89
+
90
+ it "has no properties and no destinations" do
91
+ expect(events.first.properties).to eq({})
92
+ expect(events.first.destinations).to eq([])
93
+ end
94
+ end
95
+ end
96
+
34
97
  context "when the sheet has no Platform column" do
35
98
  it "leaves platforms as nil (unrestricted)" do
36
99
  expect(events.map(&:platforms)).to all(be_nil)
@@ -170,6 +233,14 @@ describe Evva::GoogleSheet do
170
233
  end
171
234
  end
172
235
 
236
+ describe "#people_properties with a multi-select destination dropdown" do
237
+ let(:people_file) { File.read("spec/fixtures/sample_public_people_properties_multiselect.csv") }
238
+
239
+ it "trims the space the dropdown puts after each comma" do
240
+ expect(sheet.people_properties.first.destinations).to eq(["firebase", "custom destination"])
241
+ end
242
+ end
243
+
173
244
  describe "#enum_classes" do
174
245
  subject(:enum_classes) { sheet.enum_classes }
175
246
 
@@ -29,13 +29,13 @@ sealed class AnalyticsEvent(
29
29
  val name = event.key
30
30
 
31
31
  data object CpPageView : AnalyticsEvent(
32
- event = AnalyticsEvents.CP_PAGE_VIEW,
32
+ event = AnalyticsEvents.CpPageView,
33
33
  )
34
34
 
35
35
  data object CpPageView2 : AnalyticsEvent(
36
- event = AnalyticsEvents.CP_PAGE_VIEW_2,
36
+ event = AnalyticsEvents.CpPageView2,
37
37
  destinations = arrayOf(
38
- AnalyticsDestinations.FIREBASE,
38
+ AnalyticsDestinations.Firebase,
39
39
  ),
40
40
  )
41
41
 
@@ -43,14 +43,14 @@ sealed class AnalyticsEvent(
43
43
  val courseId: Long,
44
44
  val courseName: String,
45
45
  ) : AnalyticsEvent(
46
- event = AnalyticsEvents.CP_PAGE_VIEW_A,
46
+ event = AnalyticsEvents.CpPageViewA,
47
47
  properties = mapOf(
48
48
  "course_id" to courseId,
49
49
  "course_name" to courseName,
50
50
  ),
51
51
  destinations = arrayOf(
52
- AnalyticsDestinations.FIREBASE,
53
- AnalyticsDestinations.CUSTOM_DESTINATION,
52
+ AnalyticsDestinations.Firebase,
53
+ AnalyticsDestinations.CustomDestination,
54
54
  ),
55
55
  )
56
56
 
@@ -59,14 +59,14 @@ sealed class AnalyticsEvent(
59
59
  val courseName: String,
60
60
  val fromScreen: CourseProfileSource,
61
61
  ) : AnalyticsEvent(
62
- event = AnalyticsEvents.CP_PAGE_VIEW_B,
62
+ event = AnalyticsEvents.CpPageViewB,
63
63
  properties = mapOf(
64
64
  "course_id" to courseId,
65
65
  "course_name" to courseName,
66
66
  "from_screen" to fromScreen.key,
67
67
  ),
68
68
  destinations = arrayOf(
69
- AnalyticsDestinations.FIREBASE,
69
+ AnalyticsDestinations.Firebase,
70
70
  ),
71
71
  )
72
72
 
@@ -75,7 +75,7 @@ sealed class AnalyticsEvent(
75
75
  val courseName: String,
76
76
  val fromScreen: CourseProfileSource?,
77
77
  ) : AnalyticsEvent(
78
- event = AnalyticsEvents.CP_PAGE_VIEW_C,
78
+ event = AnalyticsEvents.CpPageViewC,
79
79
  properties = mapOf(
80
80
  "course_id" to courseId,
81
81
  "course_name" to courseName,
@@ -88,7 +88,7 @@ sealed class AnalyticsEvent(
88
88
  val courseName: String,
89
89
  val viewedAt: String,
90
90
  ) : AnalyticsEvent(
91
- event = AnalyticsEvents.CP_PAGE_VIEW_D,
91
+ event = AnalyticsEvents.CpPageViewD,
92
92
  properties = mapOf(
93
93
  "course_id" to courseId,
94
94
  "course_name" to courseName,
@@ -106,7 +106,7 @@ Kotlin
106
106
  subject { generator.special_property_enums(enums) }
107
107
  let(:enums) { [
108
108
  Evva::AnalyticsEnum.new("CourseProfileSource", ["course_discovery", "synced_courses"]),
109
- Evva::AnalyticsEnum.new("PremiumFrom", ["Course Profile", "Round Setup"]),
109
+ Evva::AnalyticsEnum.new("PremiumFrom", ["Course Profile", "Round Setup", "PAYWALL", "push-notification v2"]),
110
110
  ] }
111
111
  let(:expected) {
112
112
  <<-Kotlin
@@ -117,17 +117,37 @@ package com.hole19golf.hole19.analytics
117
117
  */
118
118
 
119
119
  enum class CourseProfileSource(val key: String) {
120
- COURSE_DISCOVERY("course_discovery"),
121
- SYNCED_COURSES("synced_courses"),
120
+ CourseDiscovery("course_discovery"),
121
+ SyncedCourses("synced_courses"),
122
122
  }
123
123
 
124
124
  enum class PremiumFrom(val key: String) {
125
- COURSE_PROFILE("Course Profile"),
126
- ROUND_SETUP("Round Setup"),
125
+ CourseProfile("Course Profile"),
126
+ RoundSetup("Round Setup"),
127
+ Paywall("PAYWALL"),
128
+ PushNotificationV2("push-notification v2"),
127
129
  }
128
130
  Kotlin
129
131
  }
130
132
  it { should eq expected }
133
+
134
+ context "when values do not start with a letter or use non-ASCII letters" do
135
+ let(:enums) { [
136
+ Evva::AnalyticsEnum.new("HoleCount", ["9 holes", "_2fa", "日本語"]),
137
+ ] }
138
+
139
+ let(:expected_enum) {
140
+ <<-Kotlin
141
+ enum class HoleCount(val key: String) {
142
+ _9Holes("9 holes"),
143
+ _2fa("_2fa"),
144
+ 日本語("日本語"),
145
+ }
146
+ Kotlin
147
+ }
148
+
149
+ it { should include expected_enum }
150
+ end
131
151
  end
132
152
 
133
153
  describe "#event_enum" do
@@ -145,8 +165,8 @@ package com.hole19golf.hole19.analytics
145
165
  */
146
166
 
147
167
  enum class AnalyticsEvents(val key: String) {
148
- NAV_FEED_TAP("nav_feed_tap"),
149
- NAV_PERFORMANCE_TAP("nav_performance_tap"),
168
+ NavFeedTap("nav_feed_tap"),
169
+ NavPerformanceTap("nav_performance_tap"),
150
170
  }
151
171
  Kotlin
152
172
  }
@@ -179,32 +199,32 @@ sealed class AnalyticsProperty(
179
199
  data class RoundsWithWear(
180
200
  val value: String?,
181
201
  ) : AnalyticsProperty(
182
- property = AnalyticsProperties.ROUNDS_WITH_WEAR,
202
+ property = AnalyticsProperties.RoundsWithWear,
183
203
  innerValue = value,
184
204
  )
185
205
 
186
206
  data class LastActiveAt(
187
207
  val value: String,
188
208
  ) : AnalyticsProperty(
189
- property = AnalyticsProperties.LAST_ACTIVE_AT,
209
+ property = AnalyticsProperties.LastActiveAt,
190
210
  innerValue = value,
191
211
  )
192
212
 
193
213
  data class UpgradeSource(
194
214
  val value: PremiumFrom,
195
215
  ) : AnalyticsProperty(
196
- property = AnalyticsProperties.UPGRADE_SOURCE,
216
+ property = AnalyticsProperties.UpgradeSource,
197
217
  innerValue = value.key,
198
218
  )
199
219
 
200
220
  data class WearPlatform(
201
221
  val value: WearableAppPlatform?,
202
222
  ) : AnalyticsProperty(
203
- property = AnalyticsProperties.WEAR_PLATFORM,
223
+ property = AnalyticsProperties.WearPlatform,
204
224
  innerValue = value?.key,
205
225
  destinations = arrayOf(
206
- AnalyticsDestinations.FIREBASE,
207
- AnalyticsDestinations.CUSTOM_DESTINATION,
226
+ AnalyticsDestinations.Firebase,
227
+ AnalyticsDestinations.CustomDestination,
208
228
  ),
209
229
  )
210
230
  }
@@ -229,8 +249,8 @@ package com.hole19golf.hole19.analytics
229
249
  */
230
250
 
231
251
  enum class AnalyticsProperties(val key: String) {
232
- ROUNDS_WITH_WEAR("rounds_with_wear"),
233
- WEAR_PLATFORM("wear_platform"),
252
+ RoundsWithWear("rounds_with_wear"),
253
+ WearPlatform("wear_platform"),
234
254
  }
235
255
  Kotlin
236
256
  }
@@ -252,8 +272,8 @@ package com.hole19golf.hole19.analytics
252
272
  */
253
273
 
254
274
  enum class AnalyticsDestinations {
255
- FIREBASE,
256
- WHATEVER_YOU_WANT_REALLY,
275
+ Firebase,
276
+ WhateverYouWantReally,
257
277
  }
258
278
  Kotlin
259
279
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Andrade
@@ -9,7 +9,7 @@ authors:
9
9
  - Ricardo Trindade
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2026-10-13 00:00:00.000000000 Z
12
+ date: 2026-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -100,8 +100,10 @@ files:
100
100
  - spec/fixtures/sample_public_enums.csv
101
101
  - spec/fixtures/sample_public_enums_with_platform.csv
102
102
  - spec/fixtures/sample_public_events.csv
103
+ - spec/fixtures/sample_public_events_multiline.csv
103
104
  - spec/fixtures/sample_public_events_with_platform.csv
104
105
  - spec/fixtures/sample_public_people_properties.csv
106
+ - spec/fixtures/sample_public_people_properties_multiselect.csv
105
107
  - spec/fixtures/test.yml
106
108
  - spec/lib/evva/config_spec.rb
107
109
  - spec/lib/evva/google_sheet_spec.rb