evva 0.1.4.3 → 0.1.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87f47c713fe2f646dc5302d44a06e739976bfd6f
4
- data.tar.gz: ed72f81ccb086f03fc21426dee5332260a38aa6b
3
+ metadata.gz: f29745f30be02ffd8aaeaabc97bb6f7aa78e336a
4
+ data.tar.gz: 7997447508877d82eea4904e50c43a71a15b9ddb
5
5
  SHA512:
6
- metadata.gz: dda81be8b9ea3b174d0d20b8e68846681521574eee808318778ccd7265ec7ae27c185b5f615a010c8d544bf62ef5f3fd47382252476d7e46e8a80dc829c4f997
7
- data.tar.gz: cede59eb52f5858775c0fce0d6ca35621dc0365ace4171bd69f1961d9ea10fcdda4b2139f1fb4bfdb93a2462dafaa3ef0e980fb130eed78fa07bd2b3eb5a8adb
6
+ metadata.gz: 287b552754e902b50d228fc4813375a88083f79dc11a3cf8475bf29b15842f850036ccc69dcc5ec407735c9263458446f1b23dcdd8f98afccd9ae966f44b8f48
7
+ data.tar.gz: 9606d7647b418445d8417063e2dba6652be7c5252c9395b62ec65a1bc35e1f1f21fba68f173fa13f72fc4db4b6c4c44a477d1ae3547558e5b7465035c48dc31d
@@ -1,4 +1,7 @@
1
1
  # Change Log
2
+ ## [0.1.4.4] - 2019-02-04
3
+ - Adds support for dynamic android package name
4
+
2
5
  ## [0.1.4.3] - 2018-10-12
3
6
  - Fixes swift and kotlin tabs, indentation and property names
4
7
  - Merges all special enums in a single file
@@ -25,3 +28,4 @@
25
28
 
26
29
  ## [0.1.0] - 2017/10/26
27
30
  - Initial Release.
31
+
@@ -7,4 +7,5 @@ data_source:
7
7
  out_path: analytics
8
8
  event_file_name: MixpanelAnalytics
9
9
  event_enum_file_name: MixpanelEvent
10
- people_file_name: MixpanelProperties
10
+ people_file_name: MixpanelProperties
11
+ package_name: com.hole19golf.hole19.analytics
@@ -26,7 +26,7 @@ module Evva
26
26
  bundle = analytics_data(config: config.data_source)
27
27
  case config.type.downcase
28
28
  when 'android'
29
- generator = Evva::AndroidGenerator.new
29
+ generator = Evva::AndroidGenerator.new(config.package_name)
30
30
  evva_write(bundle, generator, config, 'kt')
31
31
  when 'ios'
32
32
  generator = Evva::SwiftGenerator.new
@@ -1,5 +1,16 @@
1
1
  module Evva
2
2
  class AndroidGenerator
3
+ attr_accessor :package_name
4
+
5
+ def initialize(package_name)
6
+ @package_name = package_name
7
+ end
8
+
9
+ IMPORT_EVENT = "import packagename.Event".freeze
10
+ IMPORT_MASK = "import packagename.MixpanelAnalyticsMask".freeze
11
+ IMPORT_JSON = "import org.json.JSONObject".freeze
12
+
13
+ NATIVE_TYPES = %w[Long Int String Double Float Boolean].freeze
3
14
 
4
15
  def events(bundle, file_name)
5
16
  header_footer_wrapper([IMPORT_EVENT, IMPORT_MASK, IMPORT_JSON]) do
@@ -44,22 +55,17 @@ module Evva
44
55
  end
45
56
  end
46
57
 
47
- IMPORT_EVENT = "import com.hole19golf.hole19.analytics.Event".freeze
48
- IMPORT_MASK = "import com.hole19golf.hole19.analytics.MixpanelAnalyticsMask".freeze
49
- IMPORT_JSON = "import org.json.JSONObject".freeze
50
-
51
- NATIVE_TYPES = %w[Long Int String Double Float Boolean].freeze
52
-
53
58
  private
54
59
 
55
60
  def imports_header(imports = [])
56
61
  return unless imports.length > 0
57
- imports.join("\n") + "\n\n"
62
+ imports.map { |ev| ev. gsub("packagename", @package_name) }
63
+ .join("\n") + "\n\n"
58
64
  end
59
65
 
60
66
  def header_footer_wrapper(imports = [])
61
67
  <<-Kotlin
62
- package com.hole19golf.hole19.analytics
68
+ package #{@package_name}
63
69
 
64
70
  #{imports_header(imports)}/**
65
71
  * This file was automatically generated by evva: https://github.com/hole19/evva
@@ -43,6 +43,10 @@ module Evva
43
43
  @hash[:special_enum_file_name]
44
44
  end
45
45
 
46
+ def package_name
47
+ @hash[:package_name]
48
+ end
49
+
46
50
  CONFIG_STRUCT = {
47
51
  type: Hash,
48
52
  elements: {
@@ -53,7 +57,8 @@ module Evva
53
57
  out_path: { type: String },
54
58
  event_file_name: { type: String },
55
59
  event_enum_file_name: { type: String },
56
- people_file_name: { type: String }
60
+ people_file_name: { type: String },
61
+ package_name: { type: String }
57
62
  }
58
63
  }.freeze
59
64
 
@@ -1,4 +1,4 @@
1
1
  module Evva
2
- VERSION = '0.1.4.3'.freeze
3
- VERSION_UPDATED_AT = '2018-10-12'.freeze
2
+ VERSION = '0.1.4.4'.freeze
3
+ VERSION_UPDATED_AT = '2019-02-04'.freeze
4
4
  end
@@ -7,4 +7,5 @@ data_source:
7
7
  out_path: analytics
8
8
  event_file_name: MixpanelAnalytics
9
9
  event_enum_file_name: MixpanelEvent
10
- people_file_name: MixpanelProperties
10
+ people_file_name: MixpanelProperties
11
+ package_name: com.package.name.analytics
@@ -1,5 +1,5 @@
1
1
  describe Evva::AndroidGenerator do
2
- let(:generator) { described_class.new }
2
+ let(:generator) { described_class.new("com.hole19golf.hole19.analytics") }
3
3
 
4
4
  describe '#events' do
5
5
  subject { generator.events(events, "MixpanelAnalytics") }
@@ -11,7 +11,8 @@ describe Evva::Config do
11
11
  out_path: 'clear/path/to/event',
12
12
  event_file_name: 'event/file/name',
13
13
  people_file_name: 'people/file/name',
14
- event_enum_file_name: 'event/enum/file'
14
+ event_enum_file_name: 'event/enum/file',
15
+ package_name: 'com.package.name.analytics'
15
16
  }
16
17
  end
17
18
 
@@ -26,6 +27,7 @@ describe Evva::Config do
26
27
  its(:event_file_name) { should eq('event/file/name') }
27
28
  its(:people_file_name) { should eq('people/file/name') }
28
29
  its(:event_enum_file_name) { should eq 'event/enum/file' }
30
+ its(:package_name) { should eq 'com.package.name.analytics' }
29
31
 
30
32
  describe '#data_source' do
31
33
  subject(:data_source) { config.data_source }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4.3
4
+ version: 0.1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - RicardoTrindade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-12 00:00:00.000000000 Z
11
+ date: 2019-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: safe_yaml