evva 0.7.0 → 0.8.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: 415fbfd75fa7a900193f7d0f1367c3009caacf93f3dfccd32b0560020208236e
4
- data.tar.gz: 13af9d9f0734e605192a9c2812ad42f5357501e1aa4520e23130ada9818c8ce3
3
+ metadata.gz: ef1f54ba1e4c525d2d9d9b909662e64fc2858cc430925e16275f62827943076d
4
+ data.tar.gz: a5399c882b3235dd00672367d7b65d9f159b89b9700c67570df6008aea20ffa0
5
5
  SHA512:
6
- metadata.gz: e4873ea17016be8c93d815cd222d7f9a9741a0af82920d8b1d0fb49077a94349888bf93e5c792b96459845e1531738e8dd1c13ca127055cbf2e881c2f4c8c3d5
7
- data.tar.gz: 7f29cb22f2cee0afdaff32c50a6086a86be8980960bc4fefaaf0c2b1161a453dc15a578be97501d342df232f25763c85693efd4ae15a003b983ceeb333793043
6
+ metadata.gz: 4f217fa85a4cc4450daf831719401636111037cfd5ee769919fab7243d5078005f114e11036022c7b87ebc9374815354943a4418b668d9c88309da4cc61b2a72
7
+ data.tar.gz: fbbeae8e67fdc87130ae3c7cd3c6664ad08eb794ed802fa2cbf158ab507cd420c723db249e35e5a76dec683488a02daf8399e7569eb1ab807b6392e1cf6249ce
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- evva (0.7.0)
4
+ evva (0.8.0)
5
5
  colorize (~> 1.0)
6
6
  csv (>= 3.0)
7
7
  safe_yaml (~> 1.0)
@@ -9,8 +9,8 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- addressable (2.8.7)
13
- public_suffix (>= 2.0.2, < 7.0)
12
+ addressable (2.9.0)
13
+ public_suffix (>= 2.0.2, < 8.0)
14
14
  ast (2.4.3)
15
15
  bigdecimal (3.3.1)
16
16
  colorize (1.1.0)
@@ -21,7 +21,7 @@ GEM
21
21
  diff-lcs (1.6.2)
22
22
  docile (1.4.1)
23
23
  hashdiff (1.2.1)
24
- json (2.15.1)
24
+ json (2.15.2.1)
25
25
  language_server-protocol (3.17.0.5)
26
26
  lint_roller (1.1.0)
27
27
  parallel (1.27.0)
@@ -29,7 +29,7 @@ GEM
29
29
  ast (~> 2.4.1)
30
30
  racc
31
31
  prism (1.5.2)
32
- public_suffix (6.0.2)
32
+ public_suffix (7.0.5)
33
33
  racc (1.8.1)
34
34
  rainbow (3.1.1)
35
35
  rake (13.3.0)
data/changelog.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Change Log
2
2
 
3
- ## Unreleased
3
+ ## [0.8.1] - 2026-05-26
4
+
5
+ - Fix missing optional chaining for Swift people properties (`value?.rawValue` instead of `value.rawValue`)
6
+ - Escape Swift reserved keywords in generated enum case names (e.g. `` case `default` ``)
7
+ - Remove redundant `public` modifier from `Destination` enum inside `public extension`
8
+
9
+ ## [0.8.0] - 2026-05-26
10
+
11
+ - Add `exclude_destinations` configuration to filter out specific destinations from generated code
4
12
 
5
13
  ## [0.7.0] - 2026-04-07
6
14
 
data/lib/evva/config.rb CHANGED
@@ -13,6 +13,7 @@ module Evva
13
13
  if @hash.key?(:swift_public) && ![true, false].include?(@hash[:swift_public])
14
14
  raise ArgumentError, "swift_public must be true or false"
15
15
  end
16
+
16
17
  end
17
18
 
18
19
  def to_h
@@ -63,6 +64,10 @@ module Evva
63
64
  @hash[:swift_public] == true
64
65
  end
65
66
 
67
+ def exclude_destinations
68
+ @hash[:exclude_destinations] || []
69
+ end
70
+
66
71
  CONFIG_STRUCT = {
67
72
  type: Hash,
68
73
  elements: {
@@ -77,7 +82,8 @@ module Evva
77
82
  people_enum_file_name: { type: String },
78
83
  destinations_file_name: { type: String },
79
84
  package_name: { type: String },
80
- swift_public: { type: Object, optional: true }
85
+ swift_public: { type: Object, optional: true },
86
+ exclude_destinations: { type: Array, optional: true }
81
87
  }
82
88
  }.freeze
83
89
 
@@ -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
@@ -1,4 +1,4 @@
1
- <%= @swift_public_modifier %>enum Destination {
1
+ enum Destination {
2
2
  <%- destinations.each do |d| -%>
3
3
  case <%= d %>
4
4
  <%- 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
@@ -1,4 +1,4 @@
1
1
  module Evva
2
- VERSION = "0.7.0".freeze
3
- VERSION_UPDATED_AT = "2026-04-07".freeze
2
+ VERSION = "0.8.1".freeze
3
+ VERSION_UPDATED_AT = "2026-05-26".freeze
4
4
  end
data/lib/evva.rb CHANGED
@@ -25,6 +25,7 @@ module Evva
25
25
 
26
26
  config = Evva::Config.new(hash: YAML.safe_load(config_file))
27
27
  bundle = analytics_data(config: config.data_source)
28
+ filter_destinations!(bundle, config.exclude_destinations)
28
29
  case config.type.downcase
29
30
  when "android"
30
31
  generator = Evva::KotlinGenerator.new(config.package_name)
@@ -93,6 +94,14 @@ module Evva
93
94
  opts_hash
94
95
  end
95
96
 
97
+ def filter_destinations!(bundle, excluded)
98
+ return if excluded.empty?
99
+
100
+ bundle[:destinations].reject! { |d| excluded.include?(d) }
101
+ bundle[:events].each { |e| e.destinations.reject! { |d| excluded.include?(d) } }
102
+ bundle[:people].each { |p| p.destinations.reject! { |d| excluded.include?(d) } }
103
+ end
104
+
96
105
  def write_to_file(path, data)
97
106
  file_reader = Evva::FileReader.new
98
107
  if file = file_reader.open_file(path, "w", false)
data/spec/evva_spec.rb CHANGED
@@ -23,6 +23,40 @@ describe Evva do
23
23
  end
24
24
  end
25
25
 
26
+ describe ".filter_destinations!" do
27
+ let(:bundle) do
28
+ {
29
+ destinations: ["firebase", "mixpanel"],
30
+ events: [Evva::AnalyticsEvent.new("test_event", {}, ["firebase", "mixpanel"])],
31
+ people: [Evva::AnalyticsProperty.new("test_prop", "String", ["firebase", "mixpanel"])],
32
+ }
33
+ end
34
+
35
+ context "when excluding a destination" do
36
+ before { Evva.filter_destinations!(bundle, ["firebase"]) }
37
+
38
+ it "removes it from the destinations list" do
39
+ expect(bundle[:destinations]).to eq(["mixpanel"])
40
+ end
41
+
42
+ it "removes it from event destinations" do
43
+ expect(bundle[:events].first.destinations).to eq(["mixpanel"])
44
+ end
45
+
46
+ it "removes it from people property destinations" do
47
+ expect(bundle[:people].first.destinations).to eq(["mixpanel"])
48
+ end
49
+ end
50
+
51
+ context "when exclude list is empty" do
52
+ before { Evva.filter_destinations!(bundle, []) }
53
+
54
+ it "does not change anything" do
55
+ expect(bundle[:destinations]).to eq(["firebase", "mixpanel"])
56
+ end
57
+ end
58
+ end
59
+
26
60
  context "when generic.yml does not exist locally" do
27
61
  let(:error) { "Could not open yml file" }
28
62
  before do
@@ -47,6 +47,24 @@ describe Evva::Config do
47
47
  end
48
48
  end
49
49
 
50
+ describe "#exclude_destinations" do
51
+ context "when not set" do
52
+ its(:exclude_destinations) { should eq([]) }
53
+ end
54
+
55
+ context "when set to an array" do
56
+ before { hash[:exclude_destinations] = ["firebase"] }
57
+
58
+ its(:exclude_destinations) { should eq(["firebase"]) }
59
+ end
60
+
61
+ context "when not an array" do
62
+ before { hash[:exclude_destinations] = "firebase" }
63
+
64
+ it { expect { config }.to raise_error(ArgumentError, /Expected Array, got String/) }
65
+ end
66
+ end
67
+
50
68
  describe "#swift_public?" do
51
69
  context "when swift_public is true" do
52
70
  before { hash[:swift_public] = true }
@@ -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
- public enum Destination {
266
+ enum Destination {
253
267
  case firebase
254
268
  case whateverYouWantReally
255
269
  }
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Andrade
8
8
  - João Costa
9
9
  - Ricardo Trindade
10
+ autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2026-04-07 00:00:00.000000000 Z
13
+ date: 2026-05-26 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: colorize
@@ -112,6 +113,7 @@ homepage: https://github.com/hole19/
112
113
  licenses:
113
114
  - MIT
114
115
  metadata: {}
116
+ post_install_message:
115
117
  rdoc_options: []
116
118
  require_paths:
117
119
  - lib
@@ -126,7 +128,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
128
  - !ruby/object:Gem::Version
127
129
  version: '0'
128
130
  requirements: []
129
- rubygems_version: 3.7.2
131
+ rubygems_version: 3.5.3
132
+ signing_key:
130
133
  specification_version: 4
131
134
  summary: An event generating service
132
135
  test_files: []