evva 0.6.0 → 0.7.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: 91bbc611bc1080edc062a357906590141678a014ddb4e820978b68498cb31af4
4
- data.tar.gz: e15cc4ea36cbabc7e87c55607481755a7b12e57d1e0abdd11b6dfe8cd80ec8a7
3
+ metadata.gz: 415fbfd75fa7a900193f7d0f1367c3009caacf93f3dfccd32b0560020208236e
4
+ data.tar.gz: 13af9d9f0734e605192a9c2812ad42f5357501e1aa4520e23130ada9818c8ce3
5
5
  SHA512:
6
- metadata.gz: 3411a35dde566fdda39433830da928830d9c38fd20f8b9a01fb107933a38fd33c638a92b1ac9b051efdb9ad2a7ec45ef0b6952285c84ceedc4c24f56af29f77c
7
- data.tar.gz: bfb62d2fdfbde961ddcd3c3693bee06b9a6427a5b2aaaf4d0647f2f19699394cbf5c16b5b24cba056e4bb9ca2216acdfff9ce938659806bec4de989d99dc5237
6
+ metadata.gz: e4873ea17016be8c93d815cd222d7f9a9741a0af82920d8b1d0fb49077a94349888bf93e5c792b96459845e1531738e8dd1c13ca127055cbf2e881c2f4c8c3d5
7
+ data.tar.gz: 7f29cb22f2cee0afdaff32c50a6086a86be8980960bc4fefaaf0c2b1161a453dc15a578be97501d342df232f25763c85693efd4ae15a003b983ceeb333793043
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- evva (0.6.0)
4
+ evva (0.7.0)
5
5
  colorize (~> 1.0)
6
6
  csv (>= 3.0)
7
7
  safe_yaml (~> 1.0)
data/README.md CHANGED
@@ -32,7 +32,8 @@ Evva automatically generates code for triggering events based on a Google Sheets
32
32
  event_file_name: /file/with/tracking/functions
33
33
  event_enum_file_name: /file/with/event/names
34
34
  people_file_name: /file/with/people/properties
35
- people_file_name: /file/with/people/property/names
35
+ people_enum_file_name: /file/with/people/property/names
36
36
  destinations_file_name: /file/with/destinations
37
37
  special_enum_file_name: /file/with/special/enum/properties/
38
+ swift_public: false # optional; when true (iOS), generated Swift uses the public access modifier for generated extensions
38
39
  ```
data/changelog.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [0.7.0] - 2026-04-07
6
+
7
+ - Add `swift_public` configuration which modifies the accessibility of all the Swift code extensions to `public`
8
+
5
9
  ## [0.6.0] - 2025-10-13
6
10
 
7
11
  - Add support for ruby 3.4
data/lib/evva/config.rb CHANGED
@@ -9,6 +9,10 @@ module Evva
9
9
  end
10
10
 
11
11
  @hash[:data_source].validate_structure!(dict_struct)
12
+
13
+ if @hash.key?(:swift_public) && ![true, false].include?(@hash[:swift_public])
14
+ raise ArgumentError, "swift_public must be true or false"
15
+ end
12
16
  end
13
17
 
14
18
  def to_h
@@ -55,6 +59,10 @@ module Evva
55
59
  @hash[:package_name]
56
60
  end
57
61
 
62
+ def swift_public?
63
+ @hash[:swift_public] == true
64
+ end
65
+
58
66
  CONFIG_STRUCT = {
59
67
  type: Hash,
60
68
  elements: {
@@ -68,7 +76,8 @@ module Evva
68
76
  people_file_name: { type: String },
69
77
  people_enum_file_name: { type: String },
70
78
  destinations_file_name: { type: String },
71
- package_name: { type: String }
79
+ package_name: { type: String },
80
+ swift_public: { type: Object, optional: true }
72
81
  }
73
82
  }.freeze
74
83
 
@@ -12,6 +12,10 @@ module Evva
12
12
 
13
13
  NATIVE_TYPES = %w[Int String Double Float Bool Date].freeze
14
14
 
15
+ def initialize(swift_public: false)
16
+ @swift_public_modifier = swift_public ? "public " : ""
17
+ end
18
+
15
19
  def events(bundle, _file_name, _enums_file_name, _destinations_file_name)
16
20
  header_footer_wrapper do
17
21
  events = bundle.map do |event|
@@ -2,6 +2,6 @@
2
2
 
3
3
  import Foundation
4
4
 
5
- extension Analytics {
5
+ <%= @swift_public_modifier %>extension Analytics {
6
6
  <%= content %>
7
7
  }
@@ -1,4 +1,4 @@
1
- enum Destination {
1
+ <%= @swift_public_modifier %>enum Destination {
2
2
  <%- destinations.each do |d| -%>
3
3
  case <%= d %>
4
4
  <%- end -%>
@@ -3,13 +3,13 @@ struct EventData {
3
3
  var properties: [String: Any]?
4
4
  let destinations: [Destination]
5
5
 
6
- init(name: String, properties: [String: Any]?, destinations: [Destination]) {
6
+ <%= @swift_public_modifier %>init(name: String, properties: [String: Any]?, destinations: [Destination]) {
7
7
  self.name = name
8
8
  self.properties = properties
9
9
  self.destinations = destinations
10
10
  }
11
11
 
12
- init(type: EventType, properties: [String: Any]?) {
12
+ <%= @swift_public_modifier %>init(type: EventType, properties: [String: Any]?) {
13
13
  self.init(name: type.name, properties: properties, destinations: type.destinations)
14
14
  }
15
15
  }
@@ -3,13 +3,13 @@ struct PropertyData {
3
3
  let value: Any
4
4
  let destinations: [Destination]
5
5
 
6
- init(name: String, value: Any, destinations: [Destination]) {
6
+ <%= @swift_public_modifier %>init(name: String, value: Any, destinations: [Destination]) {
7
7
  self.name = name
8
8
  self.value = value
9
9
  self.destinations = destinations
10
10
  }
11
11
 
12
- init(type: PropertyType, value: Any) {
12
+ <%= @swift_public_modifier %>init(type: PropertyType, value: Any) {
13
13
  self.init(name: type.name, value: value, destinations: type.destinations)
14
14
  }
15
15
  }
data/lib/evva/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Evva
2
- VERSION = "0.6.0".freeze
3
- VERSION_UPDATED_AT = "2025-10-13".freeze
2
+ VERSION = "0.7.0".freeze
3
+ VERSION_UPDATED_AT = "2026-04-07".freeze
4
4
  end
data/lib/evva.rb CHANGED
@@ -30,7 +30,7 @@ module Evva
30
30
  generator = Evva::KotlinGenerator.new(config.package_name)
31
31
  evva_write(bundle, generator, config, "kt")
32
32
  when "ios"
33
- generator = Evva::SwiftGenerator.new
33
+ generator = Evva::SwiftGenerator.new(swift_public: config.swift_public?)
34
34
  evva_write(bundle, generator, config, "swift")
35
35
  end
36
36
  Evva::Logger.print_summary
@@ -34,6 +34,7 @@ describe Evva::Config do
34
34
  its(:people_enum_file_name) { should eq("people/enum/file/name") }
35
35
  its(:destinations_file_name) { should eq "destinations/file/name" }
36
36
  its(:package_name) { should eq "com.package.name.analytics" }
37
+ its(:swift_public?) { should eq(false) }
37
38
 
38
39
  describe "#data_source" do
39
40
  subject(:data_source) { config.data_source }
@@ -45,4 +46,24 @@ describe Evva::Config do
45
46
  it { expect { config }.to raise_error /unknown data source type 'i_dunno'/i }
46
47
  end
47
48
  end
49
+
50
+ describe "#swift_public?" do
51
+ context "when swift_public is true" do
52
+ before { hash[:swift_public] = true }
53
+
54
+ its(:swift_public?) { should eq(true) }
55
+ end
56
+
57
+ context "when swift_public is false" do
58
+ before { hash[:swift_public] = false }
59
+
60
+ its(:swift_public?) { should eq(false) }
61
+ end
62
+
63
+ context "when swift_public is not a boolean" do
64
+ before { hash[:swift_public] = "yes" }
65
+
66
+ it { expect { config }.to raise_error(ArgumentError, "swift_public must be true or false") }
67
+ end
68
+ end
48
69
  end
@@ -238,5 +238,26 @@ Swift
238
238
  }
239
239
 
240
240
  it { should eq expected }
241
+
242
+ context "when swift_public is true" do
243
+ let(:generator) { described_class.new(swift_public: true) }
244
+
245
+ let(:expected) {
246
+ <<-Swift
247
+ // This file was automatically generated by evva: https://github.com/hole19/evva
248
+
249
+ import Foundation
250
+
251
+ public extension Analytics {
252
+ public enum Destination {
253
+ case firebase
254
+ case whateverYouWantReally
255
+ }
256
+ }
257
+ Swift
258
+ }
259
+
260
+ it { should eq expected }
261
+ end
241
262
  end
242
263
  end
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.6.0
4
+ version: 0.7.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: 2025-10-13 00:00:00.000000000 Z
12
+ date: 2026-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize