evva 0.1.4.3 → 0.4.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 +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 +18 -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 +141 -84
- data/lib/evva/config.rb +21 -4
- 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 +65 -0
- data/lib/evva/templates/swift/people_properties.swift +49 -0
- data/lib/evva/templates/swift/special_property_enums.swift +10 -0
- data/lib/evva/version.rb +2 -2
- data/lib/evva.rb +16 -6
- 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 -4
- data/spec/lib/evva/android_generator_spec.rb +132 -58
- data/spec/lib/evva/config_spec.rb +13 -5
- data/spec/lib/evva/google_sheet_spec.rb +60 -72
- data/spec/lib/evva/swift_generator_spec.rb +153 -40
- metadata +23 -39
- data/evva_config.yml +0 -10
- 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: f74dbff0766dc7623ca1ac518e7636172440511a4470398d594fefef8364fba9
|
4
|
+
data.tar.gz: 4793e14af612e48d0e7cf85aa313d5c6c4f92c5eb440be7a853503f39fd093e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebbee6abfa8abd7e6717f20246a1271a7d7b35e4b9a42414293ff436cff842e82ac45beb7638dc642cdb00c1408f7c81cb4b8dcfdd7d4ee6dafa04f121388b5a
|
7
|
+
data.tar.gz: 18c42c24f8f2b7d923c9a99b5ec58a43d258340b2523fdb4bf8f136bb0d4d9a075f3497b4c0c8a8176c4e01b07db56f116066b1139389104497db86e6ed9e30b
|
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.0] - 2021-12-21
|
4
|
+
- Adds type to people properties
|
5
|
+
- Adds a list of destinations to events and people properties
|
6
|
+
|
7
|
+
## [0.3.0] - 2021-12-16
|
8
|
+
- Revamp Android generator to generate events as classes instead of methods.
|
9
|
+
|
10
|
+
## [0.2.0] - 2021-08-30
|
11
|
+
- Google Spreadsheet option stopped working due to a change in the API. This version fixes that.
|
12
|
+
|
13
|
+
Note: You'll need a new setup. View README.
|
14
|
+
|
15
|
+
## [0.1.4.4] - 2019-02-04
|
16
|
+
- Adds support for dynamic android package name
|
17
|
+
|
2
18
|
## [0.1.4.3] - 2018-10-12
|
3
19
|
- Fixes swift and kotlin tabs, indentation and property names
|
4
20
|
- Merges all special enums in a single file
|
@@ -23,5 +39,6 @@
|
|
23
39
|
## [0.1.1] - 2017-11-07
|
24
40
|
- Fixes mismatch between file name and class name generated.
|
25
41
|
|
26
|
-
## [0.1.0] - 2017
|
42
|
+
## [0.1.0] - 2017-10-26
|
27
43
|
- Initial Release.
|
44
|
+
|
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
|
@@ -1,125 +1,182 @@
|
|
1
1
|
module Evva
|
2
2
|
class AndroidGenerator
|
3
|
+
attr_accessor :package_name
|
3
4
|
|
4
|
-
def
|
5
|
-
|
6
|
-
|
5
|
+
def initialize(package_name)
|
6
|
+
@package_name = package_name
|
7
|
+
end
|
7
8
|
|
8
|
-
|
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__)
|
9
16
|
|
10
|
-
|
11
|
-
\t\tmask.updateProperties(property.key, value)
|
12
|
-
\t}
|
17
|
+
TAB_SIZE = " " # \t -> 4 spaces
|
13
18
|
|
14
|
-
|
15
|
-
\t\tmask.incrementCounter(property.key)
|
16
|
-
\t}
|
17
|
-
}"""
|
18
|
-
end
|
19
|
-
end
|
19
|
+
NATIVE_TYPES = %w[Long Int String Double Float Boolean Date].freeze
|
20
20
|
|
21
|
-
def
|
21
|
+
def events(bundle, file_name, enums_file_name, destinations_file_name)
|
22
22
|
header_footer_wrapper do
|
23
|
-
|
24
|
-
|
25
|
-
|
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) }
|
49
|
+
|
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
|
58
|
+
|
59
|
+
template_from(EVENTS_TEMPLATE).result(binding)
|
26
60
|
end
|
27
61
|
end
|
28
62
|
|
29
63
|
def event_enum(bundle, file_name)
|
30
|
-
header_footer_wrapper
|
31
|
-
|
32
|
-
|
33
|
-
|
64
|
+
header_footer_wrapper do
|
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)
|
34
75
|
end
|
35
76
|
end
|
36
77
|
|
37
|
-
def
|
78
|
+
def people_properties(people_bundle, file_name, enums_file_name, destinations_file_name)
|
38
79
|
header_footer_wrapper do
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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)
|
44
95
|
end
|
45
96
|
end
|
46
97
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
NATIVE_TYPES = %w[Long Int String Double Float Boolean].freeze
|
98
|
+
def people_properties_enum(people_bundle, file_name)
|
99
|
+
header_footer_wrapper do
|
100
|
+
class_name = file_name
|
52
101
|
|
53
|
-
|
102
|
+
properties = people_bundle.map(&:property_name).map do |property_name|
|
103
|
+
{
|
104
|
+
name: constantize(property_name),
|
105
|
+
value: property_name,
|
106
|
+
}
|
107
|
+
end
|
54
108
|
|
55
|
-
|
56
|
-
|
57
|
-
imports.join("\n") + "\n\n"
|
109
|
+
template_from(PEOPLE_PROPERTIES_ENUM_TEMPLATE).result(binding)
|
110
|
+
end
|
58
111
|
end
|
59
112
|
|
60
|
-
def
|
61
|
-
|
62
|
-
|
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
|
63
122
|
|
64
|
-
|
65
|
-
|
66
|
-
|
123
|
+
{
|
124
|
+
class_name: enum.enum_name,
|
125
|
+
values: values,
|
126
|
+
}
|
127
|
+
end
|
67
128
|
|
68
|
-
|
69
|
-
|
129
|
+
template_from(SPECIAL_PROPERTY_ENUMS_TEMPLATE).result(binding)
|
130
|
+
end
|
70
131
|
end
|
71
132
|
|
72
|
-
def
|
73
|
-
|
74
|
-
|
75
|
-
if !function_arguments.empty?
|
76
|
-
props = json_props(event_data.properties)
|
77
|
-
"""\topen fun #{function_name}(#{function_arguments}) {
|
78
|
-
#{props}
|
79
|
-
\t\tmask.trackEvent(MixpanelEvent.#{event_data.event_name.upcase}, properties)
|
80
|
-
\t}"""
|
133
|
+
def destinations(bundle, file_name)
|
134
|
+
header_footer_wrapper do
|
135
|
+
class_name = file_name
|
81
136
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
\t}"""
|
137
|
+
destinations = bundle.map { |d| constantize(d) }
|
138
|
+
|
139
|
+
template_from(DESTINATIONS_TEMPLATE).result(binding)
|
86
140
|
end
|
87
141
|
end
|
88
142
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
else
|
97
|
-
"put(\"#{name}\", #{name}.key)"
|
98
|
-
end
|
99
|
-
else
|
100
|
-
if optional_property?(type)
|
101
|
-
"#{name}?.let { put(\"#{name}\", it) }"
|
102
|
-
else
|
103
|
-
"put(\"#{name}\", #{name})"
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
.map { |line| "\t\t\t#{line}" }
|
108
|
-
.join("\n")
|
143
|
+
private
|
144
|
+
|
145
|
+
def header_footer_wrapper
|
146
|
+
package_name = @package_name
|
147
|
+
|
148
|
+
content = yield
|
149
|
+
.chop # trim trailing newlines created by sublime
|
109
150
|
|
110
|
-
|
151
|
+
template_from(BASE_TEMPLATE).result(binding).gsub("\t", TAB_SIZE)
|
111
152
|
end
|
112
153
|
|
113
|
-
def
|
114
|
-
|
154
|
+
def template_from(path)
|
155
|
+
file = File.read(path)
|
156
|
+
|
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, '-')
|
115
161
|
end
|
116
162
|
|
117
|
-
|
118
|
-
|
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("/", "::")
|
119
172
|
end
|
120
173
|
|
121
|
-
def
|
122
|
-
|
174
|
+
def constantize(string)
|
175
|
+
string.tr(' ', '_').upcase
|
176
|
+
end
|
177
|
+
|
178
|
+
def is_special_property?(type)
|
179
|
+
!NATIVE_TYPES.include?(type.chomp('?'))
|
123
180
|
end
|
124
181
|
end
|
125
182
|
end
|
data/lib/evva/config.rb
CHANGED
@@ -31,18 +31,30 @@ 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
|
+
|
54
|
+
def package_name
|
55
|
+
@hash[:package_name]
|
56
|
+
end
|
57
|
+
|
46
58
|
CONFIG_STRUCT = {
|
47
59
|
type: Hash,
|
48
60
|
elements: {
|
@@ -53,7 +65,10 @@ module Evva
|
|
53
65
|
out_path: { type: String },
|
54
66
|
event_file_name: { type: String },
|
55
67
|
event_enum_file_name: { type: String },
|
56
|
-
people_file_name: { type: String }
|
68
|
+
people_file_name: { type: String },
|
69
|
+
people_enum_file_name: { type: String },
|
70
|
+
destinations_file_name: { type: String },
|
71
|
+
package_name: { type: String }
|
57
72
|
}
|
58
73
|
}.freeze
|
59
74
|
|
@@ -61,7 +76,9 @@ module Evva
|
|
61
76
|
type: Hash,
|
62
77
|
elements: {
|
63
78
|
type: { type: String },
|
64
|
-
|
79
|
+
events_url: { type: String },
|
80
|
+
people_properties_url: { type: String },
|
81
|
+
enum_classes_url: { type: String },
|
65
82
|
}
|
66
83
|
}.freeze
|
67
84
|
|