ios_analytics_cli 1.0.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.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +135 -0
  3. data/.rubocop.yml +2 -0
  4. data/Gemfile +7 -0
  5. data/Gemfile.lock +62 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +48 -0
  8. data/Rakefile +10 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/exe/analytics +34 -0
  12. data/ios_analytics_cli.gemspec +35 -0
  13. data/lib/ios_analytics_cli.rb +52 -0
  14. data/lib/ios_analytics_cli/commands/command.rb +6 -0
  15. data/lib/ios_analytics_cli/commands/generate.rb +77 -0
  16. data/lib/ios_analytics_cli/commands/init.rb +55 -0
  17. data/lib/ios_analytics_cli/error_handler.rb +22 -0
  18. data/lib/ios_analytics_cli/helpers/terminal.rb +11 -0
  19. data/lib/ios_analytics_cli/info.rb +16 -0
  20. data/lib/ios_analytics_cli/interactors/event.rb +22 -0
  21. data/lib/ios_analytics_cli/interactors/interactor.rb +8 -0
  22. data/lib/ios_analytics_cli/interactors/user_property.rb +12 -0
  23. data/lib/ios_analytics_cli/io/config.rb +18 -0
  24. data/lib/ios_analytics_cli/io/io.rb +10 -0
  25. data/lib/ios_analytics_cli/serializers/base.rb +43 -0
  26. data/lib/ios_analytics_cli/serializers/objc/analytics.rb +126 -0
  27. data/lib/ios_analytics_cli/serializers/objc/enums.rb +67 -0
  28. data/lib/ios_analytics_cli/serializers/objc/event.rb +182 -0
  29. data/lib/ios_analytics_cli/serializers/objc/logger.rb +53 -0
  30. data/lib/ios_analytics_cli/serializers/objc/objc.rb +23 -0
  31. data/lib/ios_analytics_cli/serializers/objc/screen.rb +90 -0
  32. data/lib/ios_analytics_cli/serializers/objc/user_property.rb +120 -0
  33. data/lib/ios_analytics_cli/serializers/swift/analytics.rb +63 -0
  34. data/lib/ios_analytics_cli/serializers/swift/event.rb +121 -0
  35. data/lib/ios_analytics_cli/serializers/swift/logger.rb +38 -0
  36. data/lib/ios_analytics_cli/serializers/swift/screen.rb +55 -0
  37. data/lib/ios_analytics_cli/serializers/swift/swift.rb +20 -0
  38. data/lib/ios_analytics_cli/serializers/swift/user_property.rb +69 -0
  39. data/lib/ios_analytics_cli/templates/header.erb +7 -0
  40. data/lib/ios_analytics_cli/templates/templates.rb +12 -0
  41. data/lib/ios_analytics_cli/version.rb +4 -0
  42. metadata +172 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 742e4b9954f42b271ec0246bac1e78f631e1dacf42842bfb4ac546a78de0b671
4
+ data.tar.gz: cacdf2b27199979a425b8ef9d258154dfdbba9d04d095e0c05eaef38b3e86a57
5
+ SHA512:
6
+ metadata.gz: 27ef1d26da04b88563c1688609c6ba47b4306cec0e92d0900cf7a0625aff6530094b8f7e101c40ec613e1c0b13418ad1b438093d6c1ff71c2d9792fb8b222d10
7
+ data.tar.gz: 75abaae748ef29ffb3bc33a97a2fc83d0f01468d79fd1ae138eb45eea4ba33472fd264076328f9f81aab9484343a8f559c3769984249cae126e92cfe4bf58d92
@@ -0,0 +1,135 @@
1
+
2
+ # Created by https://www.gitignore.io/api/ruby,xcode,macos,visualstudiocode
3
+ # Edit at https://www.gitignore.io/?templates=ruby,xcode,macos,visualstudiocode
4
+
5
+ ### macOS ###
6
+ # General
7
+ .DS_Store
8
+ .AppleDouble
9
+ .LSOverride
10
+
11
+ # Icon must end with two \r
12
+ Icon
13
+
14
+ # Thumbnails
15
+ ._*
16
+
17
+ # Files that might appear in the root of a volume
18
+ .DocumentRevisions-V100
19
+ .fseventsd
20
+ .Spotlight-V100
21
+ .TemporaryItems
22
+ .Trashes
23
+ .VolumeIcon.icns
24
+ .com.apple.timemachine.donotpresent
25
+
26
+ # Directories potentially created on remote AFP share
27
+ .AppleDB
28
+ .AppleDesktop
29
+ Network Trash Folder
30
+ Temporary Items
31
+ .apdisk
32
+
33
+ ### Ruby ###
34
+ *.gem
35
+ *.rbc
36
+ /.config
37
+ /coverage/
38
+ /InstalledFiles
39
+ /pkg/
40
+ /spec/reports/
41
+ /spec/examples.txt
42
+ /test/tmp/
43
+ /test/version_tmp/
44
+ /tmp/
45
+
46
+ # Used by dotenv library to load environment variables.
47
+ # .env
48
+
49
+ # Ignore Byebug command history file.
50
+ .byebug_history
51
+
52
+ ## Specific to RubyMotion:
53
+ .dat*
54
+ .repl_history
55
+ build/
56
+ *.bridgesupport
57
+ build-iPhoneOS/
58
+ build-iPhoneSimulator/
59
+
60
+ ## Specific to RubyMotion (use of CocoaPods):
61
+ #
62
+ # We recommend against adding the Pods directory to your .gitignore. However
63
+ # you should judge for yourself, the pros and cons are mentioned at:
64
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
65
+ # vendor/Pods/
66
+
67
+ ## Documentation cache and generated files:
68
+ /.yardoc/
69
+ /_yardoc/
70
+ /doc/
71
+ /rdoc/
72
+
73
+ ## Environment normalization:
74
+ /.bundle/
75
+ /vendor/bundle
76
+ /lib/bundler/man/
77
+
78
+ # for a library or gem, you might want to ignore these files since the code is
79
+ # intended to run in multiple environments; otherwise, check them in:
80
+ # Gemfile.lock
81
+ # .ruby-version
82
+ # .ruby-gemset
83
+
84
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
85
+ .rvmrc
86
+
87
+ ### Ruby Patch ###
88
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
89
+ # .rubocop-https?--*
90
+
91
+ ### VisualStudioCode ###
92
+ .vscode/*
93
+ !.vscode/settings.json
94
+ !.vscode/tasks.json
95
+ !.vscode/launch.json
96
+ !.vscode/extensions.json
97
+
98
+ ### VisualStudioCode Patch ###
99
+ # Ignore all local history of files
100
+ .history
101
+
102
+ ### Xcode ###
103
+ # Xcode
104
+ # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
105
+
106
+ ## User settings
107
+ xcuserdata/
108
+
109
+ ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
110
+ *.xcscmblueprint
111
+ *.xccheckout
112
+
113
+ ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
114
+ DerivedData/
115
+ *.moved-aside
116
+ *.pbxuser
117
+ !default.pbxuser
118
+ *.mode1v3
119
+ !default.mode1v3
120
+ *.mode2v3
121
+ !default.mode2v3
122
+ *.perspectivev3
123
+ !default.perspectivev3
124
+
125
+ ## Xcode Patch
126
+ *.xcodeproj/*
127
+ !*.xcodeproj/project.pbxproj
128
+ !*.xcodeproj/xcshareddata/
129
+ !*.xcworkspace/contents.xcworkspacedata
130
+ /*.gcno
131
+
132
+ ### Xcode Patch ###
133
+ **/xcshareddata/WorkspaceSettings.xcsettings
134
+
135
+ # End of https://www.gitignore.io/api/ruby,xcode,macos,visualstudiocode
@@ -0,0 +1,2 @@
1
+ Style/FrozenStringLiteralComment:
2
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # this file should be used to write all dependencies that this CLI is using,
4
+ # but there's another way, and it's to list 'em all in ios_analytics_cli.gemspec file.
5
+
6
+ # Specify your gem's dependencies in ios_analytics_cli.gemspec
7
+ gemspec
@@ -0,0 +1,62 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ios_analytics_cli (1.0.0)
5
+ commander (~> 4.5.2)
6
+ tty-prompt (~> 0.21.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.0)
12
+ commander (4.5.2)
13
+ highline (~> 2.0.0)
14
+ equatable (0.6.1)
15
+ highline (2.0.3)
16
+ jaro_winkler (1.5.4)
17
+ minitest (5.14.0)
18
+ necromancer (0.5.1)
19
+ parallel (1.19.1)
20
+ parser (2.7.1.1)
21
+ ast (~> 2.4.0)
22
+ pastel (0.7.3)
23
+ equatable (~> 0.6)
24
+ tty-color (~> 0.5)
25
+ rainbow (3.0.0)
26
+ rake (10.5.0)
27
+ rexml (3.2.4)
28
+ rubocop (0.82.0)
29
+ jaro_winkler (~> 1.5.1)
30
+ parallel (~> 1.10)
31
+ parser (>= 2.7.0.1)
32
+ rainbow (>= 2.2.2, < 4.0)
33
+ rexml
34
+ ruby-progressbar (~> 1.7)
35
+ unicode-display_width (>= 1.4.0, < 2.0)
36
+ ruby-progressbar (1.10.1)
37
+ tty-color (0.5.1)
38
+ tty-cursor (0.7.1)
39
+ tty-prompt (0.21.0)
40
+ necromancer (~> 0.5.0)
41
+ pastel (~> 0.7.0)
42
+ tty-reader (~> 0.7.0)
43
+ tty-reader (0.7.0)
44
+ tty-cursor (~> 0.7)
45
+ tty-screen (~> 0.7)
46
+ wisper (~> 2.0.0)
47
+ tty-screen (0.7.1)
48
+ unicode-display_width (1.7.0)
49
+ wisper (2.0.1)
50
+
51
+ PLATFORMS
52
+ ruby
53
+
54
+ DEPENDENCIES
55
+ bundler (~> 1.17)
56
+ ios_analytics_cli!
57
+ minitest (~> 5.0)
58
+ rake (~> 10.0)
59
+ rubocop (~> 0.82.0)
60
+
61
+ BUNDLED WITH
62
+ 1.17.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Mario Galijot
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ ## Installation
2
+
3
+ ```
4
+ $ gem install ios_analytics_cli
5
+ ```
6
+
7
+ ## Usage
8
+
9
+ Navigate to Your project folder & run
10
+
11
+ ```
12
+ $ analytics init
13
+ ```
14
+
15
+ This will ask you which programming language You're using & where do You want to store anayltics files.
16
+ Results will be stored in `analytics.yml` file.
17
+
18
+
19
+ After that, place Your JSON file in the directory that You provided when running `analytics init`. If You're not sure where it is, check `analytics.yml` file for `sourcePath` field.
20
+
21
+ After You prepared the JSON file, run
22
+
23
+ ```
24
+ $ analytics generate
25
+ ```
26
+ Files will be generated in the path that You provided in `analytics init`.
27
+ Drag those files to project & that's it! 🎉
28
+
29
+
30
+ ## Development
31
+
32
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
33
+
34
+ To install this gem onto your local machine, run `bundle exec rake install`. This will install the gem in a place where all other gems are installed
35
+
36
+
37
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
38
+
39
+ ## Contributing
40
+
41
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/infinum/ios-analytics-cli).
42
+
43
+ ## Other notes
44
+ - if You're using the ruby that came with Your system, You'll need to run some commands with `sudo`. If You're not sure if You have system version of some other, just wait until it fails & You'll know :)
45
+
46
+ ## License
47
+
48
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task default: :test
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'ios_analytics_cli'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # this file was generated by the 'commander' CLI, which is installed via 'gem install commander',
4
+ # and it's used to simplify the process of building a CLI with Ruby.
5
+ # if we were to create a CLI without commander, we would need to manually parse CLI arguments,
6
+ # which is OFC fine, but this tool simplifies it
7
+
8
+ require 'rubygems'
9
+ require 'commander/import'
10
+ require 'ios_analytics_cli'
11
+
12
+ program :name, 'analytics'
13
+ program :version, Analytics::VERSION
14
+ program :description, Analytics.description
15
+
16
+ command :init do |c|
17
+ c.syntax = 'analytics init'
18
+ c.summary = 'Creates the configuration for the analytics CLI.'
19
+ c.description = 'Use this command to create an \'analytics.yml\' file, which will hold informations about your project, needed for the generation of the analytics files.'
20
+ c.action do
21
+ Analytics::ErrorHandler.rescuable do
22
+ Analytics::Command::Init.new.perform
23
+ end
24
+ end
25
+ end
26
+
27
+ command :generate do |c|
28
+ c.syntax = 'analytics generate'
29
+ c.summary = 'Generates analytics files from the local JSON resource file.'
30
+ c.description = 'This command uses settings stored in \'analytics.yml\' file, which defines a path for the resource JSON file, programming language & destination path for newly generated files & generated analytics files out of them.'
31
+ c.action do
32
+ Analytics::Command::Generate.new.perform
33
+ end
34
+ end
@@ -0,0 +1,35 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'ios_analytics_cli/version'
4
+ require 'ios_analytics_cli/info'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'ios_analytics_cli'
8
+ spec.version = Analytics::VERSION
9
+ spec.authors = ['Mario Galijot']
10
+ spec.email = ['mario.galijot@infinum.com']
11
+
12
+ spec.summary = Analytics.summary
13
+ spec.description = Analytics.description
14
+ spec.homepage = 'https://github.com/infinum/ios-analytics-cli/'
15
+ spec.license = 'MIT'
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = 'exe'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ # the dependencies that are used in development env
27
+ spec.add_development_dependency 'bundler', '~> 1.17'
28
+ spec.add_development_dependency 'minitest', '~> 5.0'
29
+ spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_development_dependency 'rubocop', '~> 0.82.0'
31
+
32
+ # the dependencies that are used in all envs
33
+ spec.add_dependency 'commander', '~> 4.5.2'
34
+ spec.add_dependency 'tty-prompt', '~> 0.21.0'
35
+ end
@@ -0,0 +1,52 @@
1
+ require 'yaml'
2
+ require 'tty-prompt'
3
+ require 'erb'
4
+ require 'json'
5
+
6
+ # cli/helpers
7
+ require 'ios_analytics_cli/helpers/terminal'
8
+
9
+ # cli/interactors
10
+ require 'ios_analytics_cli/interactors/interactor'
11
+ require 'ios_analytics_cli/interactors/event'
12
+ require 'ios_analytics_cli/interactors/user_property'
13
+
14
+ # cli
15
+ require 'ios_analytics_cli/version'
16
+ require 'ios_analytics_cli/info'
17
+ require 'ios_analytics_cli/error_handler'
18
+
19
+ # cli/commands
20
+ require 'ios_analytics_cli/commands/command'
21
+ require 'ios_analytics_cli/commands/init'
22
+ require 'ios_analytics_cli/commands/generate'
23
+
24
+ # cli/io
25
+ require 'ios_analytics_cli/io/io'
26
+ require 'ios_analytics_cli/io/config'
27
+
28
+ # cli/serializers
29
+ require 'ios_analytics_cli/serializers/base'
30
+
31
+ require 'ios_analytics_cli/serializers/objc/analytics'
32
+ require 'ios_analytics_cli/serializers/objc/enums'
33
+ require 'ios_analytics_cli/serializers/objc/event'
34
+ require 'ios_analytics_cli/serializers/objc/logger'
35
+ require 'ios_analytics_cli/serializers/objc/objc'
36
+ require 'ios_analytics_cli/serializers/objc/screen'
37
+ require 'ios_analytics_cli/serializers/objc/user_property'
38
+
39
+ require 'ios_analytics_cli/serializers/swift/analytics'
40
+ require 'ios_analytics_cli/serializers/swift/event'
41
+ require 'ios_analytics_cli/serializers/swift/logger'
42
+ require 'ios_analytics_cli/serializers/swift/screen'
43
+ require 'ios_analytics_cli/serializers/swift/swift'
44
+ require 'ios_analytics_cli/serializers/swift/user_property'
45
+
46
+ # cli/templates
47
+ require 'ios_analytics_cli/templates/templates'
48
+
49
+ # Analytics represents base module to which
50
+ # all other modules are namespaced.
51
+ module Analytics
52
+ end