evva 0.5.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: 3a7fdd2ee1db1b0b8d9858f2b0bc471433cccf5b5849367c95cf635ba8ae57bf
4
- data.tar.gz: b3ea8ed00b37ca80cabaa59e17185abb57b1cc35f4ed4557e127417d21cf227f
3
+ metadata.gz: 415fbfd75fa7a900193f7d0f1367c3009caacf93f3dfccd32b0560020208236e
4
+ data.tar.gz: 13af9d9f0734e605192a9c2812ad42f5357501e1aa4520e23130ada9818c8ce3
5
5
  SHA512:
6
- metadata.gz: b1b97510a06bdd23c3ff1e0c3e23844dae95398bb8ac26b6c4a633b8fb4fc49a951b93c8874c45ac69390fd42daf68951b82908e4f8b94863d5e1951ffabdb58
7
- data.tar.gz: 469521b52c80533c4e81a2d09bdc25a5e6fdc7ad8ffa6e630a6f29a4246130c9b54e3e18eb7d878d90c86a5e4af03c0dd6b08abe9e3d87c43f98c44d1dc4b0e6
6
+ metadata.gz: e4873ea17016be8c93d815cd222d7f9a9741a0af82920d8b1d0fb49077a94349888bf93e5c792b96459845e1531738e8dd1c13ca127055cbf2e881c2f4c8c3d5
7
+ data.tar.gz: 7f29cb22f2cee0afdaff32c50a6086a86be8980960bc4fefaaf0c2b1161a453dc15a578be97501d342df232f25763c85693efd4ae15a003b983ceeb333793043
@@ -0,0 +1,30 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ "*" ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby-version: ['3.2', '3.3', '3.4']
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - name: Set up Ruby ${{ matrix.ruby-version }}
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: ${{ matrix.ruby-version }}
27
+ bundler-cache: true
28
+
29
+ - name: Run tests
30
+ run: bundle exec rake
data/.rubocop_todo.yml CHANGED
@@ -207,18 +207,6 @@ Naming/HeredocDelimiterCase:
207
207
  - 'spec/lib/evva/kotlin_generator_spec.rb'
208
208
  - 'spec/lib/evva/swift_generator_spec.rb'
209
209
 
210
- # Offense count: 2
211
- # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
212
- # NamePrefix: is_, has_, have_
213
- # ForbiddenPrefixes: is_, has_, have_
214
- # AllowedMethods: is_a?
215
- # MethodDefinitionMacros: define_method, define_singleton_method
216
- Naming/PredicateName:
217
- Exclude:
218
- - 'spec/**/*'
219
- - 'lib/evva/kotlin_generator.rb'
220
- - 'lib/evva/swift_generator.rb'
221
-
222
210
  # Offense count: 22
223
211
  # This cop supports safe autocorrection (--autocorrect).
224
212
  # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
data/Gemfile CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "colorize"
6
- gem "safe_yaml"
5
+ gemspec
7
6
 
8
7
  group :test do
9
8
  gem "rake"
data/Gemfile.lock CHANGED
@@ -1,69 +1,84 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ evva (0.7.0)
5
+ colorize (~> 1.0)
6
+ csv (>= 3.0)
7
+ safe_yaml (~> 1.0)
8
+
1
9
  GEM
2
10
  remote: https://rubygems.org/
3
11
  specs:
4
12
  addressable (2.8.7)
5
13
  public_suffix (>= 2.0.2, < 7.0)
6
- ast (2.4.2)
7
- bigdecimal (3.1.8)
14
+ ast (2.4.3)
15
+ bigdecimal (3.3.1)
8
16
  colorize (1.1.0)
9
17
  crack (1.0.0)
10
18
  bigdecimal
11
19
  rexml
12
- diff-lcs (1.5.1)
20
+ csv (3.3.5)
21
+ diff-lcs (1.6.2)
13
22
  docile (1.4.1)
14
- hashdiff (1.1.1)
15
- json (2.7.2)
16
- language_server-protocol (3.17.0.3)
17
- parallel (1.26.3)
18
- parser (3.3.5.0)
23
+ hashdiff (1.2.1)
24
+ json (2.15.1)
25
+ language_server-protocol (3.17.0.5)
26
+ lint_roller (1.1.0)
27
+ parallel (1.27.0)
28
+ parser (3.3.9.0)
19
29
  ast (~> 2.4.1)
20
30
  racc
21
- public_suffix (6.0.1)
31
+ prism (1.5.2)
32
+ public_suffix (6.0.2)
22
33
  racc (1.8.1)
23
34
  rainbow (3.1.1)
24
- rake (13.2.1)
25
- regexp_parser (2.9.2)
26
- rexml (3.3.8)
27
- rspec (3.13.0)
35
+ rake (13.3.0)
36
+ regexp_parser (2.11.3)
37
+ rexml (3.4.4)
38
+ rspec (3.13.1)
28
39
  rspec-core (~> 3.13.0)
29
40
  rspec-expectations (~> 3.13.0)
30
41
  rspec-mocks (~> 3.13.0)
31
- rspec-core (3.13.1)
42
+ rspec-core (3.13.5)
32
43
  rspec-support (~> 3.13.0)
33
- rspec-expectations (3.13.3)
44
+ rspec-expectations (3.13.5)
34
45
  diff-lcs (>= 1.2.0, < 2.0)
35
46
  rspec-support (~> 3.13.0)
36
- rspec-its (1.3.0)
37
- rspec-core (>= 3.0.0)
38
- rspec-expectations (>= 3.0.0)
39
- rspec-mocks (3.13.2)
47
+ rspec-its (2.0.0)
48
+ rspec-core (>= 3.13.0)
49
+ rspec-expectations (>= 3.13.0)
50
+ rspec-mocks (3.13.5)
40
51
  diff-lcs (>= 1.2.0, < 2.0)
41
52
  rspec-support (~> 3.13.0)
42
- rspec-support (3.13.1)
43
- rubocop (1.67.0)
53
+ rspec-support (3.13.6)
54
+ rubocop (1.81.1)
44
55
  json (~> 2.3)
45
- language_server-protocol (>= 3.17.0)
56
+ language_server-protocol (~> 3.17.0.2)
57
+ lint_roller (~> 1.1.0)
46
58
  parallel (~> 1.10)
47
59
  parser (>= 3.3.0.2)
48
60
  rainbow (>= 2.2.2, < 4.0)
49
- regexp_parser (>= 2.4, < 3.0)
50
- rubocop-ast (>= 1.32.2, < 2.0)
61
+ regexp_parser (>= 2.9.3, < 3.0)
62
+ rubocop-ast (>= 1.47.1, < 2.0)
51
63
  ruby-progressbar (~> 1.7)
52
- unicode-display_width (>= 2.4.0, < 3.0)
53
- rubocop-ast (1.32.3)
54
- parser (>= 3.3.1.0)
64
+ unicode-display_width (>= 2.4.0, < 4.0)
65
+ rubocop-ast (1.47.1)
66
+ parser (>= 3.3.7.2)
67
+ prism (~> 1.4)
55
68
  ruby-progressbar (1.13.0)
56
69
  safe_yaml (1.0.5)
57
70
  simplecov (0.22.0)
58
71
  docile (~> 1.1)
59
72
  simplecov-html (~> 0.11)
60
73
  simplecov_json_formatter (~> 0.1)
61
- simplecov-html (0.13.1)
74
+ simplecov-html (0.13.2)
62
75
  simplecov-rcov (0.3.7)
63
76
  simplecov (>= 0.4.1)
64
77
  simplecov_json_formatter (0.1.4)
65
- unicode-display_width (2.6.0)
66
- webmock (3.24.0)
78
+ unicode-display_width (3.2.0)
79
+ unicode-emoji (~> 4.1)
80
+ unicode-emoji (4.1.0)
81
+ webmock (3.25.1)
67
82
  addressable (>= 2.8.0)
68
83
  crack (>= 0.3.2)
69
84
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -72,15 +87,14 @@ PLATFORMS
72
87
  ruby
73
88
 
74
89
  DEPENDENCIES
75
- colorize
90
+ evva!
76
91
  rake
77
92
  rspec
78
93
  rspec-its
79
94
  rubocop
80
- safe_yaml
81
95
  simplecov
82
96
  simplecov-rcov
83
97
  webmock
84
98
 
85
99
  BUNDLED WITH
86
- 2.5.21
100
+ 2.7.2
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/bin/evva CHANGED
File without changes
data/changelog.md CHANGED
@@ -2,6 +2,15 @@
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
+
9
+ ## [0.6.0] - 2025-10-13
10
+
11
+ - Add support for ruby 3.4
12
+ - Add Github test workflow
13
+
5
14
  ## [0.5.0] - 2024-10-16
6
15
 
7
16
  - Update all dependencies
data/evva.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.summary = "An event generating service"
8
8
  s.description = "Evva generates all the analytics event tracking functions for you"
9
9
  s.authors = ["André Andrade", "João Costa", "Ricardo Trindade"]
10
- s.email = "ricardo.trindade743@gmail.com"
10
+ s.email = "andre.andrade@hole19golf.com"
11
11
  s.license = "MIT"
12
12
  s.homepage = "https://github.com/hole19/"
13
13
 
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.required_ruby_version = ">= 3.2.0"
20
20
 
21
- s.add_runtime_dependency "colorize", "~> 1.0"
22
- s.add_runtime_dependency "safe_yaml", "~> 1.0"
21
+ s.add_runtime_dependency "colorize", "~> 1.0"
22
+ s.add_runtime_dependency "csv", ">= 3.0"
23
+ s.add_runtime_dependency "safe_yaml", "~> 1.0"
23
24
  end
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
 
@@ -31,7 +31,7 @@ module Evva
31
31
  param_name = camelize(name.to_s, false)
32
32
  value_fetcher = param_name
33
33
 
34
- if is_special_property?(type)
34
+ if special_property?(type)
35
35
  if type.end_with?("?")
36
36
  # optional value, we need ? to access a parameter
37
37
  value_fetcher += "?"
@@ -88,7 +88,7 @@ module Evva
88
88
  class_name: camelize(property.property_name),
89
89
  property_name: constantize(property.property_name),
90
90
  type: type,
91
- is_special_property: is_special_property?(property.type),
91
+ is_special_property: special_property?(property.type),
92
92
  destinations: property.destinations.map { |p| constantize(p) },
93
93
  }
94
94
  end
@@ -180,7 +180,7 @@ module Evva
180
180
  .gsub("Date","String")
181
181
  end
182
182
 
183
- def is_special_property?(type)
183
+ def special_property?(type)
184
184
  !NATIVE_TYPES.include?(type.chomp("?"))
185
185
  end
186
186
  end
@@ -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|
@@ -20,7 +24,7 @@ module Evva
20
24
 
21
25
  value_fetcher = k.to_s
22
26
 
23
- if is_special_property?(type)
27
+ if special_property?(type)
24
28
  if type.end_with?("?")
25
29
  # optional value, we need ? to access a parameter
26
30
  value_fetcher += "?"
@@ -59,7 +63,7 @@ module Evva
59
63
  case_name: camelize(p.property_name),
60
64
  property_name: p.property_name,
61
65
  type: type,
62
- is_special_property: is_special_property?(type),
66
+ is_special_property: special_property?(type),
63
67
  destinations: p.destinations.map { |p| camelize(p) },
64
68
  }
65
69
  end
@@ -123,7 +127,7 @@ module Evva
123
127
  .gsub("Long", "Int")
124
128
  end
125
129
 
126
- def is_special_property?(type)
130
+ def special_property?(type)
127
131
  !NATIVE_TYPES.include?(type.chomp("?"))
128
132
  end
129
133
 
@@ -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.5.0".freeze
3
- VERSION_UPDATED_AT = "2024-10-16".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,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Andrade
8
8
  - João Costa
9
9
  - Ricardo Trindade
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2024-10-16 00:00:00.000000000 Z
12
+ date: 2026-04-07 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: colorize
@@ -26,6 +25,20 @@ dependencies:
26
25
  - - "~>"
27
26
  - !ruby/object:Gem::Version
28
27
  version: '1.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: csv
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '3.0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '3.0'
29
42
  - !ruby/object:Gem::Dependency
30
43
  name: safe_yaml
31
44
  requirement: !ruby/object:Gem::Requirement
@@ -41,17 +54,17 @@ dependencies:
41
54
  - !ruby/object:Gem::Version
42
55
  version: '1.0'
43
56
  description: Evva generates all the analytics event tracking functions for you
44
- email: ricardo.trindade743@gmail.com
57
+ email: andre.andrade@hole19golf.com
45
58
  executables:
46
59
  - evva
47
60
  extensions: []
48
61
  extra_rdoc_files: []
49
62
  files:
63
+ - ".github/workflows/test.yml"
50
64
  - ".gitignore"
51
65
  - ".rspec"
52
66
  - ".rubocop.yml"
53
67
  - ".rubocop_todo.yml"
54
- - ".travis.yml"
55
68
  - Gemfile
56
69
  - Gemfile.lock
57
70
  - README.md
@@ -99,7 +112,6 @@ homepage: https://github.com/hole19/
99
112
  licenses:
100
113
  - MIT
101
114
  metadata: {}
102
- post_install_message:
103
115
  rdoc_options: []
104
116
  require_paths:
105
117
  - lib
@@ -114,8 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
126
  - !ruby/object:Gem::Version
115
127
  version: '0'
116
128
  requirements: []
117
- rubygems_version: 3.4.22
118
- signing_key:
129
+ rubygems_version: 3.7.2
119
130
  specification_version: 4
120
131
  summary: An event generating service
121
132
  test_files: []
data/.travis.yml DELETED
@@ -1 +0,0 @@
1
- language: ruby