evva 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.rspec +5 -0
- data/.rubocop_todo.yml +477 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +79 -0
- data/README.md +27 -0
- data/bin/evva +4 -0
- data/evva.gemspec +24 -0
- data/evva_config.yml +10 -0
- data/lib/evva.rb +95 -0
- data/lib/evva/android_generator.rb +115 -0
- data/lib/evva/config.rb +68 -0
- data/lib/evva/data_source.rb +23 -0
- data/lib/evva/file_reader.rb +24 -0
- data/lib/evva/google_sheet.rb +91 -0
- data/lib/evva/logger.rb +61 -0
- data/lib/evva/mixpanel_enum.rb +14 -0
- data/lib/evva/mixpanel_event.rb +13 -0
- data/lib/evva/object_extension.rb +41 -0
- data/lib/evva/swift_generator.rb +128 -0
- data/lib/evva/version.rb +4 -0
- data/rubocop.yml +54 -0
- data/spec/evva_spec.rb +40 -0
- data/spec/fixtures/sample_public_enums.html +1 -0
- data/spec/fixtures/sample_public_info.html +1 -0
- data/spec/fixtures/sample_public_people_properties.html +1 -0
- data/spec/fixtures/sample_public_sheet.html +1 -0
- data/spec/fixtures/test.yml +10 -0
- data/spec/lib/evva/android_generator_spec.rb +135 -0
- data/spec/lib/evva/config_spec.rb +40 -0
- data/spec/lib/evva/data_source_spec.rb +28 -0
- data/spec/lib/evva/google_sheet_spec.rb +107 -0
- data/spec/lib/evva/logger_spec.rb +36 -0
- data/spec/lib/evva/object_extension_spec.rb +99 -0
- data/spec/lib/evva/swift_generator_spec.rb +81 -0
- data/spec/spec_helper.rb +113 -0
- metadata +136 -0
@@ -0,0 +1,81 @@
|
|
1
|
+
describe Evva::SwiftGenerator do
|
2
|
+
let(:generator) { described_class.new }
|
3
|
+
|
4
|
+
def trim_spaces(str)
|
5
|
+
str.gsub(/^[ \t]+/, '')
|
6
|
+
.gsub(/[ \t]+$/, '')
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#events' do
|
10
|
+
subject { trim_spaces(generator.events(event_bundle)) }
|
11
|
+
let(:event_bundle) {
|
12
|
+
[Evva::MixpanelEvent.new('nav_feed_tap', []),
|
13
|
+
Evva::MixpanelEvent.new('cp_page_view', 'course_id:Long,course_name:String')]
|
14
|
+
}
|
15
|
+
let(:expected) { <<-Swift
|
16
|
+
import CoreLocation
|
17
|
+
import Foundation
|
18
|
+
import SharedCode
|
19
|
+
|
20
|
+
class MixpanelHelper: NSObject {
|
21
|
+
enum Event {
|
22
|
+
case trackNavFeedTap
|
23
|
+
case trackCpPageView(course_id:Long,course_name:String)
|
24
|
+
}
|
25
|
+
private var data: EventData {
|
26
|
+
switch self {
|
27
|
+
|
28
|
+
case .trackNavFeedTap
|
29
|
+
return EventData(name:"nav_feed_tap")
|
30
|
+
|
31
|
+
case .trackCpPageView(let course_id, let course_name):
|
32
|
+
return EventData(name:"cp_page_view", properties: ["course_id":course_id, "course_name":course_name])
|
33
|
+
|
34
|
+
}
|
35
|
+
}
|
36
|
+
Swift
|
37
|
+
}
|
38
|
+
it { should eq trim_spaces(expected) }
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#swift_case' do
|
42
|
+
context 'event has no properties' do
|
43
|
+
event = Evva::MixpanelEvent.new('nav_feed_tap', [])
|
44
|
+
it 'should create a case for an event to be tracked' do
|
45
|
+
expected = "\t\tcase trackNavFeedTap\n"
|
46
|
+
expect(generator.swift_case(event)).to eq expected
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'event has properties' do
|
51
|
+
event = Evva::MixpanelEvent.new('cp_page_view', 'course_id:Long,course_name:String')
|
52
|
+
it 'should create a case for an event to be tracked' do
|
53
|
+
expected = "\t\tcase trackCpPageView(course_id:Long,course_name:String)\n"
|
54
|
+
expect(generator.swift_case(event)).to eq expected
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#process_arguments' do
|
60
|
+
properties = 'course_id:Long,course_name:String,from_screen: CourseProfileSource'
|
61
|
+
it 'should process the arguments looking for special properties' do
|
62
|
+
expected = '"course_id":course_id, "course_name":course_name, "from_screen":from_screen.rawValue'
|
63
|
+
expect(generator.process_arguments(properties)).to eq expected
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '#special_property_enum' do
|
68
|
+
subject { trim_spaces(generator.special_property_enum(enum)) }
|
69
|
+
let(:enum) { Evva::MixpanelEnum.new('CourseProfileSource', 'course_discovery,synced_courses') }
|
70
|
+
let(:expected) { <<-Swift
|
71
|
+
import Foundation
|
72
|
+
|
73
|
+
enum CourseProfileSource: String {
|
74
|
+
case course_discovery = "course_discovery"
|
75
|
+
case synced_courses = "synced_courses"
|
76
|
+
}
|
77
|
+
Swift
|
78
|
+
}
|
79
|
+
it { should eq trim_spaces(expected) }
|
80
|
+
end
|
81
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start
|
3
|
+
|
4
|
+
require 'evva'
|
5
|
+
require 'rspec/its'
|
6
|
+
require 'webmock/rspec'
|
7
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
8
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
9
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
10
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
11
|
+
# files.
|
12
|
+
#
|
13
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
14
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
15
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
16
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
17
|
+
# a separate helper file that requires the additional dependencies and performs
|
18
|
+
# the additional setup, and require it from the spec files that actually need
|
19
|
+
# it.
|
20
|
+
#
|
21
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
22
|
+
|
23
|
+
RSpec.configure do |config|
|
24
|
+
config.before do
|
25
|
+
Evva::Logger.silent_mode = true
|
26
|
+
end
|
27
|
+
|
28
|
+
config.after do
|
29
|
+
Evva::Logger.clean_summary
|
30
|
+
end
|
31
|
+
RSpec::Matchers.define_negated_matcher :not_change, :change
|
32
|
+
# rspec-expectations config goes here. You can use an alternate
|
33
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
34
|
+
# assertions if you prefer.
|
35
|
+
config.expect_with :rspec do |expectations|
|
36
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
37
|
+
# and `failure_message` of custom matchers include text for helper methods
|
38
|
+
# defined using `chain`, e.g.:
|
39
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
40
|
+
# # => "be bigger than 2 and smaller than 4"
|
41
|
+
# ...rather than:
|
42
|
+
# # => "be bigger than 2"
|
43
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
44
|
+
end
|
45
|
+
|
46
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
47
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
48
|
+
config.mock_with :rspec do |mocks|
|
49
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
50
|
+
# a real object. This is generally recommended, and will default to
|
51
|
+
# `true` in RSpec 4.
|
52
|
+
mocks.verify_partial_doubles = true
|
53
|
+
end
|
54
|
+
|
55
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
56
|
+
# have no way to turn it off -- the option exists only for backwards
|
57
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
58
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
59
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
60
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
61
|
+
|
62
|
+
# The settings below are suggested to provide a good initial experience
|
63
|
+
# with RSpec, but feel free to customize to your heart's content.
|
64
|
+
# # This allows you to limit a spec run to individual examples or groups
|
65
|
+
# # you care about by tagging them with `:focus` metadata. When nothing
|
66
|
+
# # is tagged with `:focus`, all examples get run. RSpec also provides
|
67
|
+
# # aliases for `it`, `describe`, and `context` that include `:focus`
|
68
|
+
# # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
69
|
+
# config.filter_run_when_matching :focus
|
70
|
+
#
|
71
|
+
# # Allows RSpec to persist some state between runs in order to support
|
72
|
+
# # the `--only-failures` and `--next-failure` CLI options. We recommend
|
73
|
+
# # you configure your source control system to ignore this file.
|
74
|
+
# config.example_status_persistence_file_path = "spec/examples.txt"
|
75
|
+
#
|
76
|
+
# # Limits the available syntax to the non-monkey patched syntax that is
|
77
|
+
# # recommended. For more details, see:
|
78
|
+
# # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
79
|
+
# # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
80
|
+
# # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
81
|
+
# config.disable_monkey_patching!
|
82
|
+
#
|
83
|
+
# # This setting enables warnings. It's recommended, but in some cases may
|
84
|
+
# # be too noisy due to issues in dependencies.
|
85
|
+
# config.warnings = true
|
86
|
+
#
|
87
|
+
# # Many RSpec users commonly either run the entire suite or an individual
|
88
|
+
# # file, and it's useful to allow more verbose output when running an
|
89
|
+
# # individual spec file.
|
90
|
+
# if config.files_to_run.one?
|
91
|
+
# # Use the documentation formatter for detailed output,
|
92
|
+
# # unless a formatter has already been configured
|
93
|
+
# # (e.g. via a command-line flag).
|
94
|
+
# config.default_formatter = "doc"
|
95
|
+
# end
|
96
|
+
#
|
97
|
+
# # Print the 10 slowest examples and example groups at the
|
98
|
+
# # end of the spec run, to help surface which specs are running
|
99
|
+
# # particularly slow.
|
100
|
+
# config.profile_examples = 10
|
101
|
+
#
|
102
|
+
# # Run specs in random order to surface order dependencies. If you find an
|
103
|
+
# # order dependency and want to debug it, you can fix the order by providing
|
104
|
+
# # the seed, which is printed after each run.
|
105
|
+
# # --seed 1234
|
106
|
+
# config.order = :random
|
107
|
+
#
|
108
|
+
# # Seed global randomization in this process using the `--seed` CLI option.
|
109
|
+
# # Setting this allows you to use `--seed` to deterministically reproduce
|
110
|
+
# # test failures related to randomization by passing the same `--seed` value
|
111
|
+
# # as the one that triggered the failure.
|
112
|
+
# Kernel.srand config.seed
|
113
|
+
end
|
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: evva
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- RicardoTrindade
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: safe_yaml
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: colorize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.7'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: xml-simple
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.20'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.20'
|
69
|
+
description: Evva generates all the analytics event tracking functions for you
|
70
|
+
email: ricardo.trindade743@gmail.com
|
71
|
+
executables:
|
72
|
+
- evva
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".rubocop_todo.yml"
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- README.md
|
82
|
+
- bin/evva
|
83
|
+
- evva.gemspec
|
84
|
+
- evva_config.yml
|
85
|
+
- lib/evva.rb
|
86
|
+
- lib/evva/android_generator.rb
|
87
|
+
- lib/evva/config.rb
|
88
|
+
- lib/evva/data_source.rb
|
89
|
+
- lib/evva/file_reader.rb
|
90
|
+
- lib/evva/google_sheet.rb
|
91
|
+
- lib/evva/logger.rb
|
92
|
+
- lib/evva/mixpanel_enum.rb
|
93
|
+
- lib/evva/mixpanel_event.rb
|
94
|
+
- lib/evva/object_extension.rb
|
95
|
+
- lib/evva/swift_generator.rb
|
96
|
+
- lib/evva/version.rb
|
97
|
+
- rubocop.yml
|
98
|
+
- spec/evva_spec.rb
|
99
|
+
- spec/fixtures/sample_public_enums.html
|
100
|
+
- spec/fixtures/sample_public_info.html
|
101
|
+
- spec/fixtures/sample_public_people_properties.html
|
102
|
+
- spec/fixtures/sample_public_sheet.html
|
103
|
+
- spec/fixtures/test.yml
|
104
|
+
- spec/lib/evva/android_generator_spec.rb
|
105
|
+
- spec/lib/evva/config_spec.rb
|
106
|
+
- spec/lib/evva/data_source_spec.rb
|
107
|
+
- spec/lib/evva/google_sheet_spec.rb
|
108
|
+
- spec/lib/evva/logger_spec.rb
|
109
|
+
- spec/lib/evva/object_extension_spec.rb
|
110
|
+
- spec/lib/evva/swift_generator_spec.rb
|
111
|
+
- spec/spec_helper.rb
|
112
|
+
homepage: https://github.com/hole19/
|
113
|
+
licenses:
|
114
|
+
- MIT
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
requirements: []
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 2.6.13
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: An event generating service
|
136
|
+
test_files: []
|