evva 0.11.0 → 0.12.1

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: 2ee0a5c710dfc85ab04a707bd4792bbab9a59c81aceff7394f6efe243c2deb5d
4
- data.tar.gz: d53cec7c07687a96dc24c8fb65f8a32f2e523af19b51ef72f7558fb2c8068dc6
3
+ metadata.gz: d4b045c978a7b25e6d70bb351b98ca386b64562f370109568e08bff047998d81
4
+ data.tar.gz: 7929eb9fd1cae326d1f2d04d734ab4bb4bb6a37ff0ceede20b11f9d3ae35a7fc
5
5
  SHA512:
6
- metadata.gz: 6b7267254416b123602b3d5f3ba7c5d0577d255b981ba9404ab28e2e02dcebc0d8f08f4373af847508502c5a0d41cb3f05733b98a98d79f0c226b871f1eae607
7
- data.tar.gz: 80ee70c43aec3f46304afc0647446f25cf874acc9a60f48521adb292918936c9fba62f127079daa7a97956d279470a324f30fb3ca7fa12de654c4a166c6451ad
6
+ metadata.gz: 5b230e781a153d3375a7d64b44a9e6e7f0804a25a78159dbb3e8f6e6e8e6e7b2dd36740c2c541fc5b3c34da87ec891d8cc026e6b49b79c958646799c5014ab75
7
+ data.tar.gz: ecd25a86c5374539dbd6fb2b6c1f7b3b0e94633260a3afb809bbf1d2261f8bab97e1fde29f530f0c31e587b61e31573cf62c17b21938a199af37cf4a9b629983
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- evva (0.11.0)
4
+ evva (0.12.1)
5
5
  colorize (~> 1.0)
6
6
  csv (~> 3.0)
7
7
  safe_yaml (~> 1.0)
@@ -9,7 +9,7 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- addressable (2.9.0)
12
+ addressable (2.9.1)
13
13
  public_suffix (>= 2.0.2, < 8.0)
14
14
  ast (2.4.3)
15
15
  bigdecimal (3.3.1)
data/README.md CHANGED
@@ -48,10 +48,38 @@ 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
+ ### Destinations
70
+
71
+ `Event Destination` (and `Property Destination` in the people properties sheet)
72
+ accepts the same separators, and spaces around each destination are ignored.
73
+ A multi-select dropdown works too: Google's CSV export joins its values with a
74
+ plain comma (`mixpanel,braze`).
75
+
76
+ ### Enum values
77
+
78
+ `Possible Values` in the enum classes sheet accepts the same separators: commas,
79
+ one value per line, or both. Spaces around each value are ignored, spaces inside a
80
+ value (`main app`) are kept. Each value is the exact string sent to analytics.
81
+ An enum with no values stops the run with an error naming it.
82
+
55
83
  ### Platform
56
84
 
57
85
  `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.1] - 2026-11-17
6
+
7
+ - Enum `Possible Values` accept the same separators as `Event Properties` (commas and/or one value per line) and trim spaces around each value; an enum with no values stops the run with an error naming it
8
+
9
+ ## [0.12.0] - 2026-11-11
10
+
11
+ - `Event Properties` can be written one property per line (and mixed with commas); `Event Destination` and `Property Destination` accept the same separators and trim spaces around each destination
12
+
5
13
  ## [0.11.0] - 2026-11-09
6
14
 
7
15
  - **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
@@ -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
 
@@ -63,7 +63,10 @@ module Evva
63
63
 
64
64
  @enum_classes ||= @enum_classes_csv.map do |row|
65
65
  enum_name = row[ENUM_NAME]
66
- values = row[ENUM_VALUES].split(",")
66
+ values = list_parser(row[ENUM_VALUES])
67
+ # An enum with no cases is not valid Swift with a String raw type.
68
+ raise "Enum #{enum_name} has no #{ENUM_VALUES}" if values.empty?
69
+
67
70
  Evva::AnalyticsEnum.new(enum_name, values)
68
71
  end
69
72
  end
@@ -118,15 +121,19 @@ module Evva
118
121
  tokens.map(&:downcase).uniq
119
122
  end
120
123
 
124
+ # Items may be separated by commas, line breaks, or both, so a long list can
125
+ # be written one item per line in the cell.
126
+ def list_parser(list)
127
+ list.to_s.split(/,|\r\n|\r|\n/).map(&:strip).reject(&:empty?)
128
+ end
129
+
121
130
  def hash_parser(property_array)
122
131
  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
132
+ list_parser(property_array).each do |prop|
133
+ split_prop = prop.split(":")
134
+ prop_name = split_prop[0].strip.to_sym
135
+ prop_type = split_prop[1].to_s.strip
136
+ h[prop_name] = prop_type
130
137
  end
131
138
  h
132
139
  end
data/lib/evva/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Evva
2
- VERSION = "0.11.0".freeze
3
- VERSION_UPDATED_AT = "2026-11-09".freeze
2
+ VERSION = "0.12.1".freeze
3
+ VERSION_UPDATED_AT = "2026-11-17".freeze
4
4
  end
@@ -0,0 +1,10 @@
1
+ Enum Name,Possible Values
2
+ PageViewSourceScreen,"course_discovery
3
+ synced_courses,
4
+ nearby
5
+
6
+ deal
7
+ "
8
+ PremiumClickBuy,"notes
9
+ hi_res_maps
10
+ whatever"
@@ -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
+ "with a space after each comma" => "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 spaces in the destination cell" do
237
+ let(:people_file) { File.read("spec/fixtures/sample_public_people_properties_spaced.csv") }
238
+
239
+ it "trims the space 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
 
@@ -183,6 +254,58 @@ describe Evva::GoogleSheet do
183
254
  Evva::AnalyticsEnum.new("PremiumClickBuy", ["notes","hi_res_maps","whatever"])
184
255
  ]
185
256
  end
257
+
258
+ context "when values are written one per line, as exported by Google Sheets" do
259
+ let(:enum_file) { File.read("spec/fixtures/sample_public_enums_multiline.csv") }
260
+
261
+ it "parses the same values as the comma separated sheet" do
262
+ expect(enum_classes.map(&:values)).to eq [
263
+ ["course_discovery", "synced_courses", "nearby", "deal"],
264
+ ["notes", "hi_res_maps", "whatever"],
265
+ ]
266
+ end
267
+ end
268
+
269
+ describe "a Possible Values cell" do
270
+ let(:enum_file) { %(Enum Name,Possible Values\nSomeEnum,"#{values}"\n) }
271
+
272
+ {
273
+ "comma separated" => "a,b",
274
+ "one per line" => "a\nb",
275
+ "one per line with CRLF" => "a\r\nb",
276
+ "mixed commas and line breaks" => "a,\nb",
277
+ "a trailing comma" => "a,b,",
278
+ "a trailing line break" => "a\nb\n",
279
+ "blank lines between values" => "a\n\nb",
280
+ "spaces around separators" => " a ,\n b ",
281
+ }.each do |description, cell|
282
+ context "written #{description}" do
283
+ let(:values) { cell }
284
+
285
+ it "parses the same values" do
286
+ expect(enum_classes.first.values).to eq(["a", "b"])
287
+ end
288
+ end
289
+ end
290
+
291
+ context "with spaces inside a value" do
292
+ let(:values) { "main app,No Scoring" }
293
+
294
+ it "keeps them" do
295
+ expect(enum_classes.first.values).to eq(["main app", "No Scoring"])
296
+ end
297
+ end
298
+
299
+ ["", ",", "\n\n", " , "].each do |cell|
300
+ context "with no values (#{cell.inspect})" do
301
+ let(:values) { cell }
302
+
303
+ it "stops with an error naming the enum, instead of generating an enum Swift cannot compile" do
304
+ expect { enum_classes }.to raise_error("Enum SomeEnum has no Possible Values")
305
+ end
306
+ end
307
+ end
308
+ end
186
309
  end
187
310
 
188
311
  describe "#destinations" do
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.11.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Andrade
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2026-11-09 00:00:00.000000000 Z
13
+ date: 2026-11-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: colorize
@@ -99,10 +99,13 @@ files:
99
99
  - lib/evva/version.rb
100
100
  - spec/evva_spec.rb
101
101
  - spec/fixtures/sample_public_enums.csv
102
+ - spec/fixtures/sample_public_enums_multiline.csv
102
103
  - spec/fixtures/sample_public_enums_with_platform.csv
103
104
  - spec/fixtures/sample_public_events.csv
105
+ - spec/fixtures/sample_public_events_multiline.csv
104
106
  - spec/fixtures/sample_public_events_with_platform.csv
105
107
  - spec/fixtures/sample_public_people_properties.csv
108
+ - spec/fixtures/sample_public_people_properties_spaced.csv
106
109
  - spec/fixtures/test.yml
107
110
  - spec/lib/evva/config_spec.rb
108
111
  - spec/lib/evva/google_sheet_spec.rb