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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/changelog.md +4 -0
- data/lib/evva/config.rb +10 -1
- data/lib/evva/swift_generator.rb +4 -0
- data/lib/evva/templates/swift/base.swift +1 -1
- data/lib/evva/templates/swift/destinations.swift +1 -1
- data/lib/evva/templates/swift/events.swift +2 -2
- data/lib/evva/templates/swift/people_properties.swift +2 -2
- data/lib/evva/version.rb +2 -2
- data/lib/evva.rb +1 -1
- data/spec/lib/evva/config_spec.rb +21 -0
- data/spec/lib/evva/swift_generator_spec.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 415fbfd75fa7a900193f7d0f1367c3009caacf93f3dfccd32b0560020208236e
|
|
4
|
+
data.tar.gz: 13af9d9f0734e605192a9c2812ad42f5357501e1aa4520e23130ada9818c8ce3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4873ea17016be8c93d815cd222d7f9a9741a0af82920d8b1d0fb49077a94349888bf93e5c792b96459845e1531738e8dd1c13ca127055cbf2e881c2f4c8c3d5
|
|
7
|
+
data.tar.gz: 7f29cb22f2cee0afdaff32c50a6086a86be8980960bc4fefaaf0c2b1161a453dc15a578be97501d342df232f25763c85693efd4ae15a003b983ceeb333793043
|
data/Gemfile.lock
CHANGED
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
|
-
|
|
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
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
|
|
data/lib/evva/swift_generator.rb
CHANGED
|
@@ -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|
|
|
@@ -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
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.
|
|
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:
|
|
12
|
+
date: 2026-04-07 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: colorize
|