gametime-helper 0.1.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 +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/bin/.DS_Store +0 -0
- data/bin/console +14 -0
- data/bin/gametime +6 -0
- data/bin/setup +7 -0
- data/gametime-helper.gemspec +25 -0
- data/lib/gametime/helper/version.rb +5 -0
- data/lib/gametime/helper.rb +124 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6120fa2a36c1f470b5dc58f053a4a65f83cb085a
|
4
|
+
data.tar.gz: dea49cbbe25eb7739252bd59f892152bd7ebd7b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a9bc421f8137f9a7192da3702b37bb10ac186e4688ec5d490838cbc6cb14edbf618a2ad5890f5871bcaeb9b6a8c10e934f45ae20ff49cf135f37e7264e931e5a
|
7
|
+
data.tar.gz: bc07559d033e7d409147216e37f0f709fe15204e6d86dd64b70e03bcde7081c57258b6c7bdcd0595cc344412f529975b5111add72b3b492f8c10bfc1e97bfa4f
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Mike Silvis
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Gametime::Helper
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gametime/helper`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'gametime-helper'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install gametime-helper
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it ( https://github.com/[my-github-username]/gametime-helper/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/.DS_Store
ADDED
Binary file
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "gametime/helper"
|
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
|
data/bin/gametime
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gametime/helper/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gametime-helper"
|
8
|
+
spec.version = Gametime::Helper::VERSION
|
9
|
+
spec.authors = ["Mike Silvis"]
|
10
|
+
spec.email = ["mike@gametime.co"]
|
11
|
+
|
12
|
+
spec.summary = %q{Ruby CLI Gem to verify various key metrics before submitting}
|
13
|
+
spec.description = %q{Checks localization, tracking events, etc}
|
14
|
+
spec.homepage = "http://gametime.co"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.bindir = "bin"
|
20
|
+
spec.executables = ['gametime']
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require "gametime/helper/version"
|
2
|
+
|
3
|
+
module Gametime
|
4
|
+
module Helper
|
5
|
+
def self.verify
|
6
|
+
VerifyTracking.new.verify
|
7
|
+
VerifyLocalization.new.verify
|
8
|
+
end
|
9
|
+
|
10
|
+
class VerifyLocalization
|
11
|
+
def verify
|
12
|
+
puts "verifying and removing unused localization strings\n\n"
|
13
|
+
find_invalid_strings_and_remove
|
14
|
+
|
15
|
+
puts "verifying all strings in code have matching localization string\n\n"
|
16
|
+
verify_all_strings_present
|
17
|
+
end
|
18
|
+
|
19
|
+
def verify_all_strings_present
|
20
|
+
valid_lines = []
|
21
|
+
|
22
|
+
File.open('./Resources/Base.lproj/Localizable.strings').each do |line|
|
23
|
+
if line.start_with?('"')
|
24
|
+
valid_lines << line.match(/^"\S*/).to_s
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
results = `grep "stringForID" -R Classes/`.split("\n")
|
29
|
+
results.concat `grep "GTStr" -R Classes/`.split("\n")
|
30
|
+
|
31
|
+
all_strings_used = true
|
32
|
+
|
33
|
+
results.each do |result|
|
34
|
+
if matched_output = result.match(/stringForID\("\S*"/)
|
35
|
+
matched_output = matched_output.to_s.gsub(/stringForID\(/, '')
|
36
|
+
|
37
|
+
unless valid_lines.include?(matched_output)
|
38
|
+
puts "missing key: #{matched_output}"
|
39
|
+
all_strings_used = false
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
if matched_output = result.match(/GTStr\("\S*"/)
|
44
|
+
matched_output = matched_output.to_s.gsub(/GTStr\(/, '')
|
45
|
+
|
46
|
+
unless valid_lines.include?(matched_output)
|
47
|
+
puts "missing key: #{matched_output}"
|
48
|
+
all_strings_used = false
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
if all_strings_used
|
54
|
+
puts 'All strings are used and accounted for'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def find_invalid_strings_and_remove
|
59
|
+
valid_localization = []
|
60
|
+
file_path = './Resources/Base.lproj/Localizable.strings'
|
61
|
+
|
62
|
+
File.open(file_path).each do |line|
|
63
|
+
if line.start_with?('"')
|
64
|
+
localizable_string_name = line.match(/^"\S*/)
|
65
|
+
search_results = `grep "#{localizable_string_name}" -R Classes/ | grep -v "Localizable.strings"`
|
66
|
+
|
67
|
+
if search_results.to_s == ""
|
68
|
+
puts "Unused Localizable String: #{localizable_string_name}"
|
69
|
+
else
|
70
|
+
valid_localization << line
|
71
|
+
end
|
72
|
+
else
|
73
|
+
valid_localization << line
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
File.open(file_path, 'w') { |file| file.write(valid_localization.join("")) }
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
class VerifyTracking
|
83
|
+
def verify
|
84
|
+
puts "verifying tracking events\n\n"
|
85
|
+
verify_no_missing_tracking_events
|
86
|
+
|
87
|
+
puts "verifying no strings used in tracking events\n\n"
|
88
|
+
verify_tracking_functions
|
89
|
+
end
|
90
|
+
|
91
|
+
def verify_no_missing_tracking_events
|
92
|
+
File.open('./Classes/GAMTrackingEvents.h').each do |line|
|
93
|
+
if line.start_with?('static')
|
94
|
+
tracking_event_name = line.match(/kTracking(\w*)/)
|
95
|
+
search_results = `grep "#{tracking_event_name}" -R Classes/ | grep -v "GAMTrackingEvents.h"`
|
96
|
+
|
97
|
+
if search_results.to_s == ""
|
98
|
+
puts "Missing Event: #{tracking_event_name}"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def verify_tracking_functions
|
105
|
+
find_invalid_events("trackMinorEvent")
|
106
|
+
find_invalid_events("trackMajorEvent")
|
107
|
+
end
|
108
|
+
|
109
|
+
def find_invalid_events(base_string)
|
110
|
+
invalid_objective_c_events = `grep '#{base_string}:@' -R Classes/`.split("\n")
|
111
|
+
invalid_swift_events = `grep '#{base_string}("' -R Classes/`.split("\n")
|
112
|
+
|
113
|
+
invalid_events = invalid_objective_c_events.concat invalid_swift_events
|
114
|
+
|
115
|
+
invalid_events.each do |invalid_event|
|
116
|
+
invalid = invalid_event.match(/#{base_string}:@".*"\s/).to_s.gsub(/#{base_string}:/, '')
|
117
|
+
|
118
|
+
puts "Invalid minor event event: #{invalid}"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gametime-helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mike Silvis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Checks localization, tracking events, etc
|
42
|
+
email:
|
43
|
+
- mike@gametime.co
|
44
|
+
executables:
|
45
|
+
- gametime
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".DS_Store"
|
50
|
+
- ".gitignore"
|
51
|
+
- ".rspec"
|
52
|
+
- ".travis.yml"
|
53
|
+
- CODE_OF_CONDUCT.md
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- bin/.DS_Store
|
59
|
+
- bin/console
|
60
|
+
- bin/gametime
|
61
|
+
- bin/setup
|
62
|
+
- gametime-helper.gemspec
|
63
|
+
- lib/gametime/helper.rb
|
64
|
+
- lib/gametime/helper/version.rb
|
65
|
+
homepage: http://gametime.co
|
66
|
+
licenses:
|
67
|
+
- MIT
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.4.6
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: Ruby CLI Gem to verify various key metrics before submitting
|
89
|
+
test_files: []
|