evva 0.1.4.4 → 0.4.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 +5 -5
- data/.gitignore +1 -2
- data/.rspec +0 -1
- data/.rubocop_todo.yml +10 -10
- data/.travis.yml +1 -0
- data/Gemfile +9 -8
- data/Gemfile.lock +7 -11
- data/README.md +12 -2
- data/Rakefile +9 -0
- data/changelog.md +17 -1
- data/evva.gemspec +0 -3
- data/lib/evva/{mixpanel_enum.rb → analytics_enum.rb} +2 -1
- data/lib/evva/analytics_event.rb +17 -0
- data/lib/evva/analytics_property.rb +17 -0
- data/lib/evva/android_generator.rb +135 -84
- data/lib/evva/config.rb +15 -3
- data/lib/evva/google_sheet.rb +69 -44
- data/lib/evva/swift_generator.rb +91 -81
- data/lib/evva/templates/kotlin/base.kt +7 -0
- data/lib/evva/templates/kotlin/destinations.kt +5 -0
- data/lib/evva/templates/kotlin/event_enum.kt +5 -0
- data/lib/evva/templates/kotlin/events.kt +34 -0
- data/lib/evva/templates/kotlin/people_properties.kt +24 -0
- data/lib/evva/templates/kotlin/people_properties_enum.kt +5 -0
- data/lib/evva/templates/kotlin/special_property_enums.kt +10 -0
- data/lib/evva/templates/swift/base.swift +7 -0
- data/lib/evva/templates/swift/destinations.swift +5 -0
- data/lib/evva/templates/swift/events.swift +66 -0
- data/lib/evva/templates/swift/people_properties.swift +50 -0
- data/lib/evva/templates/swift/special_property_enums.swift +10 -0
- data/lib/evva/version.rb +2 -2
- data/lib/evva.rb +15 -5
- data/spec/evva_spec.rb +3 -5
- data/spec/fixtures/sample_public_enums.csv +3 -0
- data/spec/fixtures/sample_public_events.csv +4 -0
- data/spec/fixtures/sample_public_people_properties.csv +4 -0
- data/spec/fixtures/test.yml +9 -5
- data/spec/lib/evva/android_generator_spec.rb +131 -57
- data/spec/lib/evva/config_spec.rb +12 -6
- data/spec/lib/evva/google_sheet_spec.rb +60 -72
- data/spec/lib/evva/swift_generator_spec.rb +157 -40
- metadata +23 -39
- data/evva_config.yml +0 -11
- data/lib/evva/mixpanel_event.rb +0 -13
- data/spec/fixtures/sample_public_enums.html +0 -1
- data/spec/fixtures/sample_public_info.html +0 -1
- data/spec/fixtures/sample_public_people_properties.html +0 -1
- data/spec/fixtures/sample_public_sheet.html +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f4038f23c86f1051786de3a9a9407a9b9656fc6b449d2e1f62be66f0081fa054
|
4
|
+
data.tar.gz: 6fc90e80a8a4ac97d935df0fa90cc410d582270845f8a7083081f85bf5069b93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87a050829faed5ec1792fcca19e064adb17009ddcdf0b19366cab4aedc251816363665d5577cbe8e5c0e9206e30b8eaafb06546b5fdc72adc3243db90cde9d1e
|
7
|
+
data.tar.gz: ca0d51be95a1f5f0dd4e3e6a224dfb5aa734258be9a1b5e8b1d45386d87174d473268ceec6973147b47aa9ef726d9d8c246a7941365f753d606d9d24769c66da
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -57,8 +57,8 @@ Layout/EmptyLinesAroundBlockBody:
|
|
57
57
|
Layout/EmptyLinesAroundClassBody:
|
58
58
|
Exclude:
|
59
59
|
- 'lib/evva/android_generator.rb'
|
60
|
-
- 'lib/evva/
|
61
|
-
- 'lib/evva/
|
60
|
+
- 'lib/evva/analytics_enum.rb'
|
61
|
+
- 'lib/evva/analytics_event.rb'
|
62
62
|
|
63
63
|
# Offense count: 1
|
64
64
|
# Cop supports --auto-correct.
|
@@ -163,8 +163,8 @@ Layout/TrailingBlankLines:
|
|
163
163
|
- 'lib/evva/enum_generator.rb'
|
164
164
|
- 'lib/evva/event_generator.rb'
|
165
165
|
- 'lib/evva/google_sheet.rb'
|
166
|
-
- 'lib/evva/
|
167
|
-
- 'lib/evva/
|
166
|
+
- 'lib/evva/analytics_enum.rb'
|
167
|
+
- 'lib/evva/analytics_event.rb'
|
168
168
|
- 'spec/lib/evva/enum_generator_spec.rb'
|
169
169
|
- 'spec/lib/evva/event_generator_spec.rb'
|
170
170
|
- 'spec/lib/evva/google_sheet_spec.rb'
|
@@ -226,8 +226,8 @@ Lint/UselessAssignment:
|
|
226
226
|
# Offense count: 2
|
227
227
|
Lint/Void:
|
228
228
|
Exclude:
|
229
|
-
- 'lib/evva/
|
230
|
-
- 'lib/evva/
|
229
|
+
- 'lib/evva/analytics_enum.rb'
|
230
|
+
- 'lib/evva/analytics_event.rb'
|
231
231
|
|
232
232
|
# Offense count: 8
|
233
233
|
Metrics/AbcSize:
|
@@ -309,8 +309,8 @@ Style/Documentation:
|
|
309
309
|
- 'lib/evva/event_generator.rb'
|
310
310
|
- 'lib/evva/google_sheet.rb'
|
311
311
|
- 'lib/evva/logger.rb'
|
312
|
-
- 'lib/evva/
|
313
|
-
- 'lib/evva/
|
312
|
+
- 'lib/evva/analytics_enum.rb'
|
313
|
+
- 'lib/evva/analytics_event.rb'
|
314
314
|
|
315
315
|
# Offense count: 1
|
316
316
|
# Cop supports --auto-correct.
|
@@ -407,8 +407,8 @@ Style/RaiseArgs:
|
|
407
407
|
# Cop supports --auto-correct.
|
408
408
|
Style/RedundantSelf:
|
409
409
|
Exclude:
|
410
|
-
- 'lib/evva/
|
411
|
-
- 'lib/evva/
|
410
|
+
- 'lib/evva/analytics_enum.rb'
|
411
|
+
- 'lib/evva/analytics_event.rb'
|
412
412
|
- 'lib/evva/object_extension.rb'
|
413
413
|
|
414
414
|
# Offense count: 1
|
data/.travis.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
language: ruby
|
data/Gemfile
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
ruby '2.3.3'
|
3
2
|
|
4
3
|
gem 'colorize'
|
5
|
-
gem 'rubocop'
|
6
4
|
gem 'safe_yaml'
|
7
|
-
gem 'xml-simple'
|
8
5
|
|
9
|
-
|
10
|
-
gem '
|
11
|
-
gem '
|
12
|
-
gem '
|
13
|
-
gem '
|
6
|
+
group :test do
|
7
|
+
gem 'rake'
|
8
|
+
gem 'rspec'
|
9
|
+
gem 'rspec-its'
|
10
|
+
gem 'simplecov', require: false, group: :test
|
11
|
+
gem 'simplecov-rcov', require: false
|
12
|
+
gem 'webmock', '~> 1.20'
|
13
|
+
gem 'rubocop'
|
14
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.
|
5
|
-
public_suffix (>= 2.0.2, <
|
4
|
+
addressable (2.8.0)
|
5
|
+
public_suffix (>= 2.0.2, < 5.0)
|
6
6
|
ast (2.3.0)
|
7
7
|
colorize (0.8.1)
|
8
8
|
crack (0.4.3)
|
@@ -10,15 +10,15 @@ GEM
|
|
10
10
|
diff-lcs (1.3)
|
11
11
|
docile (1.1.5)
|
12
12
|
hashdiff (0.3.7)
|
13
|
-
json (2.
|
13
|
+
json (2.3.0)
|
14
14
|
parallel (1.12.0)
|
15
15
|
parser (2.4.0.0)
|
16
16
|
ast (~> 2.2)
|
17
17
|
powerpack (0.1.1)
|
18
|
-
public_suffix (
|
18
|
+
public_suffix (4.0.6)
|
19
19
|
rainbow (2.2.2)
|
20
20
|
rake
|
21
|
-
rake (12.
|
21
|
+
rake (12.3.3)
|
22
22
|
rspec (3.7.0)
|
23
23
|
rspec-core (~> 3.7.0)
|
24
24
|
rspec-expectations (~> 3.7.0)
|
@@ -56,13 +56,13 @@ GEM
|
|
56
56
|
addressable (>= 2.3.6)
|
57
57
|
crack (>= 0.3.2)
|
58
58
|
hashdiff
|
59
|
-
xml-simple (1.1.5)
|
60
59
|
|
61
60
|
PLATFORMS
|
62
61
|
ruby
|
63
62
|
|
64
63
|
DEPENDENCIES
|
65
64
|
colorize
|
65
|
+
rake
|
66
66
|
rspec
|
67
67
|
rspec-its
|
68
68
|
rubocop
|
@@ -70,10 +70,6 @@ DEPENDENCIES
|
|
70
70
|
simplecov
|
71
71
|
simplecov-rcov
|
72
72
|
webmock (~> 1.20)
|
73
|
-
xml-simple
|
74
|
-
|
75
|
-
RUBY VERSION
|
76
|
-
ruby 2.3.3p222
|
77
73
|
|
78
74
|
BUNDLED WITH
|
79
|
-
|
75
|
+
2.2.26
|
data/README.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
Evva
|
2
|
+
========
|
3
|
+
|
4
|
+
[](https://travis-ci.org/hole19/evva?branch=master)
|
5
|
+
[](http://rubygems.org/gems/evva "View this project in Rubygems")
|
6
|
+
|
7
|
+
Evva automatically generates code for triggering events based on a Google Sheets specification. It generated code for both iOS (Swift) and Android (Kotlin).
|
2
8
|
|
3
9
|
# Instalation
|
4
10
|
|
@@ -18,11 +24,15 @@ Evva
|
|
18
24
|
|
19
25
|
data_source:
|
20
26
|
type: google_sheet
|
21
|
-
|
27
|
+
events_url: <GOOGLE-DRIVE-EVENTS-SHEET-URL>
|
28
|
+
people_properties_url: <GOOGLE-DRIVE-PEOPLE-PROPERTIES-SHEET-URL>
|
29
|
+
enum_classes_url: <GOOGLE-DRIVE-ENUM-CLASSES-SHEET-URL>
|
22
30
|
|
23
31
|
out_path: /folder/where/analytics/classes/are
|
24
32
|
event_file_name: /file/with/tracking/functions
|
25
33
|
event_enum_file_name: /file/with/event/names
|
26
34
|
people_file_name: /file/with/people/properties
|
27
|
-
|
35
|
+
people_file_name: /file/with/people/property/names
|
36
|
+
destinations_file_name: /file/with/destinations
|
37
|
+
special_enum_file_name: /file/with/special/enum/properties/
|
28
38
|
```
|
data/Rakefile
ADDED
data/changelog.md
CHANGED
@@ -1,4 +1,20 @@
|
|
1
1
|
# Change Log
|
2
|
+
|
3
|
+
## [0.4.1] - 2021-12-23
|
4
|
+
- Changes swift implementation so that destinations belong to EventType/PropertyType instead of Event/Property
|
5
|
+
|
6
|
+
## [0.4.0] - 2021-12-21
|
7
|
+
- Adds type to people properties
|
8
|
+
- Adds a list of destinations to events and people properties
|
9
|
+
|
10
|
+
## [0.3.0] - 2021-12-16
|
11
|
+
- Revamp Android generator to generate events as classes instead of methods.
|
12
|
+
|
13
|
+
## [0.2.0] - 2021-08-30
|
14
|
+
- Google Spreadsheet option stopped working due to a change in the API. This version fixes that.
|
15
|
+
|
16
|
+
Note: You'll need a new setup. View README.
|
17
|
+
|
2
18
|
## [0.1.4.4] - 2019-02-04
|
3
19
|
- Adds support for dynamic android package name
|
4
20
|
|
@@ -26,6 +42,6 @@
|
|
26
42
|
## [0.1.1] - 2017-11-07
|
27
43
|
- Fixes mismatch between file name and class name generated.
|
28
44
|
|
29
|
-
## [0.1.0] - 2017
|
45
|
+
## [0.1.0] - 2017-10-26
|
30
46
|
- Initial Release.
|
31
47
|
|
data/evva.gemspec
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Evva
|
2
|
+
class AnalyticsEvent
|
3
|
+
attr_reader :event_name, :properties, :destinations
|
4
|
+
|
5
|
+
def initialize(event_name, properties, destinations)
|
6
|
+
@event_name = event_name
|
7
|
+
@properties = properties
|
8
|
+
@destinations = destinations
|
9
|
+
end
|
10
|
+
|
11
|
+
def ==(other)
|
12
|
+
event_name == other.event_name &&
|
13
|
+
properties == other.properties &&
|
14
|
+
destinations == other.destinations
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Evva
|
2
|
+
class AnalyticsProperty
|
3
|
+
attr_reader :property_name, :type, :destinations
|
4
|
+
|
5
|
+
def initialize(property_name, type, destinations)
|
6
|
+
@property_name = property_name
|
7
|
+
@type = type
|
8
|
+
@destinations = destinations
|
9
|
+
end
|
10
|
+
|
11
|
+
def ==(other)
|
12
|
+
property_name == other.property_name &&
|
13
|
+
type == other.type &&
|
14
|
+
destinations == other.destinations
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -6,126 +6,177 @@ module Evva
|
|
6
6
|
@package_name = package_name
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
BASE_TEMPLATE = File.expand_path("./templates/kotlin/base.kt", __dir__)
|
10
|
+
EVENTS_TEMPLATE = File.expand_path("./templates/kotlin/events.kt", __dir__)
|
11
|
+
EVENT_ENUM_TEMPLATE = File.expand_path("./templates/kotlin/event_enum.kt", __dir__)
|
12
|
+
PEOPLE_PROPERTIES_TEMPLATE = File.expand_path("./templates/kotlin/people_properties.kt", __dir__)
|
13
|
+
PEOPLE_PROPERTIES_ENUM_TEMPLATE = File.expand_path("./templates/kotlin/people_properties_enum.kt", __dir__)
|
14
|
+
SPECIAL_PROPERTY_ENUMS_TEMPLATE = File.expand_path("./templates/kotlin/special_property_enums.kt", __dir__)
|
15
|
+
DESTINATIONS_TEMPLATE = File.expand_path("./templates/kotlin/destinations.kt", __dir__)
|
12
16
|
|
13
|
-
|
17
|
+
TAB_SIZE = " " # \t -> 4 spaces
|
14
18
|
|
15
|
-
|
16
|
-
header_footer_wrapper([IMPORT_EVENT, IMPORT_MASK, IMPORT_JSON]) do
|
17
|
-
"""open class #{file_name}(private val mask: MixpanelAnalyticsMask) {
|
19
|
+
NATIVE_TYPES = %w[Long Int String Double Float Boolean Date].freeze
|
18
20
|
|
19
|
-
|
21
|
+
def events(bundle, file_name, enums_file_name, destinations_file_name)
|
22
|
+
header_footer_wrapper do
|
23
|
+
class_name = file_name
|
24
|
+
enums_class_name = enums_file_name
|
25
|
+
destinations_class_name = destinations_file_name
|
26
|
+
|
27
|
+
events = bundle.map do |event|
|
28
|
+
properties = event.properties.map do |name, type|
|
29
|
+
param_name = camelize(name.to_s, false)
|
30
|
+
value_fetcher = param_name
|
31
|
+
|
32
|
+
if is_special_property?(type)
|
33
|
+
if type.end_with?('?')
|
34
|
+
# optional value, we need ? to access a parameter
|
35
|
+
value_fetcher += "?"
|
36
|
+
end
|
37
|
+
value_fetcher += ".key"
|
38
|
+
end
|
39
|
+
|
40
|
+
{
|
41
|
+
param_name: param_name,
|
42
|
+
value_fetcher: value_fetcher,
|
43
|
+
type: type,
|
44
|
+
name: name.to_s,
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
destinations = event.destinations.map { |p| constantize(p) }
|
20
49
|
|
21
|
-
|
22
|
-
|
23
|
-
|
50
|
+
{
|
51
|
+
class_name: camelize(event.event_name),
|
52
|
+
event_name: constantize(event.event_name),
|
53
|
+
properties: properties,
|
54
|
+
destinations: destinations,
|
55
|
+
is_object: properties.count == 0 && destinations.count == 0,
|
56
|
+
}
|
57
|
+
end
|
24
58
|
|
25
|
-
|
26
|
-
\t\tmask.incrementCounter(property.key)
|
27
|
-
\t}
|
28
|
-
}"""
|
59
|
+
template_from(EVENTS_TEMPLATE).result(binding)
|
29
60
|
end
|
30
61
|
end
|
31
62
|
|
32
|
-
def
|
63
|
+
def event_enum(bundle, file_name)
|
33
64
|
header_footer_wrapper do
|
34
|
-
|
35
|
-
|
36
|
-
|
65
|
+
class_name = file_name
|
66
|
+
|
67
|
+
events = bundle.map(&:event_name).map do |event_name|
|
68
|
+
{
|
69
|
+
name: constantize(event_name),
|
70
|
+
value: event_name,
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
template_from(EVENT_ENUM_TEMPLATE).result(binding)
|
37
75
|
end
|
38
76
|
end
|
39
77
|
|
40
|
-
def
|
41
|
-
header_footer_wrapper
|
42
|
-
|
43
|
-
|
44
|
-
|
78
|
+
def people_properties(people_bundle, file_name, enums_file_name, destinations_file_name)
|
79
|
+
header_footer_wrapper do
|
80
|
+
class_name = file_name
|
81
|
+
enums_class_name = enums_file_name
|
82
|
+
destinations_class_name = destinations_file_name
|
83
|
+
|
84
|
+
properties = people_bundle.map do |property|
|
85
|
+
{
|
86
|
+
class_name: camelize(property.property_name),
|
87
|
+
property_name: constantize(property.property_name),
|
88
|
+
type: property.type,
|
89
|
+
is_special_property: is_special_property?(property.type),
|
90
|
+
destinations: property.destinations.map { |p| constantize(p) },
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
template_from(PEOPLE_PROPERTIES_TEMPLATE).result(binding)
|
45
95
|
end
|
46
96
|
end
|
47
97
|
|
48
|
-
def
|
98
|
+
def people_properties_enum(people_bundle, file_name)
|
49
99
|
header_footer_wrapper do
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
100
|
+
class_name = file_name
|
101
|
+
|
102
|
+
properties = people_bundle.map(&:property_name).map do |property_name|
|
103
|
+
{
|
104
|
+
name: constantize(property_name),
|
105
|
+
value: property_name,
|
106
|
+
}
|
107
|
+
end
|
108
|
+
|
109
|
+
template_from(PEOPLE_PROPERTIES_ENUM_TEMPLATE).result(binding)
|
55
110
|
end
|
56
111
|
end
|
57
112
|
|
58
|
-
|
113
|
+
def special_property_enums(enums_bundle)
|
114
|
+
header_footer_wrapper do
|
115
|
+
enums = enums_bundle.map do |enum|
|
116
|
+
values = enum.values.map do |value|
|
117
|
+
{
|
118
|
+
name: constantize(value),
|
119
|
+
value: value,
|
120
|
+
}
|
121
|
+
end
|
122
|
+
|
123
|
+
{
|
124
|
+
class_name: enum.enum_name,
|
125
|
+
values: values,
|
126
|
+
}
|
127
|
+
end
|
59
128
|
|
60
|
-
|
61
|
-
|
62
|
-
imports.map { |ev| ev. gsub("packagename", @package_name) }
|
63
|
-
.join("\n") + "\n\n"
|
129
|
+
template_from(SPECIAL_PROPERTY_ENUMS_TEMPLATE).result(binding)
|
130
|
+
end
|
64
131
|
end
|
65
132
|
|
66
|
-
def
|
67
|
-
|
68
|
-
|
133
|
+
def destinations(bundle, file_name)
|
134
|
+
header_footer_wrapper do
|
135
|
+
class_name = file_name
|
69
136
|
|
70
|
-
|
71
|
-
* This file was automatically generated by evva: https://github.com/hole19/evva
|
72
|
-
*/
|
137
|
+
destinations = bundle.map { |d| constantize(d) }
|
73
138
|
|
74
|
-
|
75
|
-
|
139
|
+
template_from(DESTINATIONS_TEMPLATE).result(binding)
|
140
|
+
end
|
76
141
|
end
|
77
142
|
|
78
|
-
|
79
|
-
function_name = 'track' + titleize(event_data.event_name)
|
80
|
-
function_arguments = event_data.properties.map { |name, type| "#{name}: #{type}" }.join(', ')
|
81
|
-
if !function_arguments.empty?
|
82
|
-
props = json_props(event_data.properties)
|
83
|
-
"""\topen fun #{function_name}(#{function_arguments}) {
|
84
|
-
#{props}
|
85
|
-
\t\tmask.trackEvent(MixpanelEvent.#{event_data.event_name.upcase}, properties)
|
86
|
-
\t}"""
|
143
|
+
private
|
87
144
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
145
|
+
def header_footer_wrapper
|
146
|
+
package_name = @package_name
|
147
|
+
|
148
|
+
content = yield
|
149
|
+
.chop # trim trailing newlines created by sublime
|
150
|
+
|
151
|
+
template_from(BASE_TEMPLATE).result(binding).gsub("\t", TAB_SIZE)
|
93
152
|
end
|
94
153
|
|
95
|
-
def
|
96
|
-
|
97
|
-
properties
|
98
|
-
.map do |name, type|
|
99
|
-
if special_property?(type)
|
100
|
-
if optional_property?(type)
|
101
|
-
"#{name}?.let { put(\"#{name}\", it.key) }"
|
102
|
-
else
|
103
|
-
"put(\"#{name}\", #{name}.key)"
|
104
|
-
end
|
105
|
-
else
|
106
|
-
if optional_property?(type)
|
107
|
-
"#{name}?.let { put(\"#{name}\", it) }"
|
108
|
-
else
|
109
|
-
"put(\"#{name}\", #{name})"
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
.map { |line| "\t\t\t#{line}" }
|
114
|
-
.join("\n")
|
154
|
+
def template_from(path)
|
155
|
+
file = File.read(path)
|
115
156
|
|
116
|
-
|
157
|
+
# - 2nd argument (nil) changes nothing
|
158
|
+
# - 3rd argument activates trim mode using "-" so that you can decide to
|
159
|
+
# not include a line (useful on loops and if statements)
|
160
|
+
ERB.new(file, nil, '-')
|
117
161
|
end
|
118
162
|
|
119
|
-
|
120
|
-
|
163
|
+
# extracted from Rails' ActiveSupport
|
164
|
+
def camelize(string, uppercase_first_letter = true)
|
165
|
+
string = string.to_s
|
166
|
+
if uppercase_first_letter
|
167
|
+
string = string.sub(/^[a-z\d]*/) { |match| match.capitalize }
|
168
|
+
else
|
169
|
+
string = string.sub(/^(?:(?=\b|[A-Z_])|\w)/) { |match| match.downcase }
|
170
|
+
end
|
171
|
+
string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub("/", "::")
|
121
172
|
end
|
122
173
|
|
123
|
-
def
|
124
|
-
|
174
|
+
def constantize(string)
|
175
|
+
string.tr(' ', '_').upcase
|
125
176
|
end
|
126
177
|
|
127
|
-
def
|
128
|
-
|
178
|
+
def is_special_property?(type)
|
179
|
+
!NATIVE_TYPES.include?(type.chomp('?'))
|
129
180
|
end
|
130
181
|
end
|
131
182
|
end
|
data/lib/evva/config.rb
CHANGED
@@ -31,18 +31,26 @@ module Evva
|
|
31
31
|
@hash[:event_file_name]
|
32
32
|
end
|
33
33
|
|
34
|
+
def event_enum_file_name
|
35
|
+
@hash[:event_enum_file_name]
|
36
|
+
end
|
37
|
+
|
34
38
|
def people_file_name
|
35
39
|
@hash[:people_file_name]
|
36
40
|
end
|
37
41
|
|
38
|
-
def
|
39
|
-
@hash[:
|
42
|
+
def people_enum_file_name
|
43
|
+
@hash[:people_enum_file_name]
|
40
44
|
end
|
41
45
|
|
42
46
|
def special_enum_file_name
|
43
47
|
@hash[:special_enum_file_name]
|
44
48
|
end
|
45
49
|
|
50
|
+
def destinations_file_name
|
51
|
+
@hash[:destinations_file_name]
|
52
|
+
end
|
53
|
+
|
46
54
|
def package_name
|
47
55
|
@hash[:package_name]
|
48
56
|
end
|
@@ -58,6 +66,8 @@ module Evva
|
|
58
66
|
event_file_name: { type: String },
|
59
67
|
event_enum_file_name: { type: String },
|
60
68
|
people_file_name: { type: String },
|
69
|
+
people_enum_file_name: { type: String },
|
70
|
+
destinations_file_name: { type: String },
|
61
71
|
package_name: { type: String }
|
62
72
|
}
|
63
73
|
}.freeze
|
@@ -66,7 +76,9 @@ module Evva
|
|
66
76
|
type: Hash,
|
67
77
|
elements: {
|
68
78
|
type: { type: String },
|
69
|
-
|
79
|
+
events_url: { type: String },
|
80
|
+
people_properties_url: { type: String },
|
81
|
+
enum_classes_url: { type: String },
|
70
82
|
}
|
71
83
|
}.freeze
|
72
84
|
|