danger-apkstats 0.0.2 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc1a0db0fe161e8b61abb00fd8a12a7040af81ef0b525d3c5a2a06267e2e0d9f
4
- data.tar.gz: 36c1d0ab4947c4fae224f5f35d8449415c73de6981f01a1f49602597acae8724
3
+ metadata.gz: 206a4a16c43f2e18507ab485cce2947c1e932fbee471db57e4f43b20b9e4aa02
4
+ data.tar.gz: f38876905c1095c7da969bbb6d6e43ea5a09ab0cce2941544263137c2ffa3a1e
5
5
  SHA512:
6
- metadata.gz: 965a9ddd9979aef4ad646489d10402695686d8260d3a86fb4c666370f491d1b5cc76ece977db67d6216408ba87ccaf15e1ab29322ddab9ac85e6273a99b23531
7
- data.tar.gz: 71130099a63a8f8d347c647e4ecff86cc8964600118e9bdd30ed771e5441372de7f1acd270b53247d54d29558b1422676d879eb8a303893681b21daa72c328c7
6
+ metadata.gz: a9490b757975f4ed708ce6e2df907cea5594cd1fdd8bd338cd6eff111f8d75148c41ad442c1756af7aca9f78992d908fb76905bbcd7cddb0fb3f4ea4e6ab4d04
7
+ data.tar.gz: 73c01476155e698d19655affd292bbdebfffad6e4615bb96257280a57deced379b7a4fedc3bcd43d049460a8d0f2da6925d9fae7e08c048e4fd0b7eb6e3fbbd8
@@ -0,0 +1,3 @@
1
+
2
+ d56f5187479451eabf01fb78af6dfcb131a6481e
3
+ 24333f8a63b6825ea9c5514f83c2829b004d1fee
@@ -0,0 +1,104 @@
1
+ version: 2.1
2
+
3
+ executors:
4
+ base:
5
+ docker:
6
+ - image: circleci/android:api-29
7
+ working_directory: ~/workspace
8
+ environment:
9
+ ANDROID_SDK_ROOT: /home/circleci/sdk
10
+ APKANALYZER_PATH: /home/circleci/sdk/cmdline-tools/tools/bin/apkanalyzer
11
+
12
+ ruby:
13
+ docker:
14
+ - image: circleci/ruby:2.7.1
15
+ working_directory: ~/workspace
16
+
17
+ commands:
18
+ install-android-sdk:
19
+ parameters:
20
+ zip-version:
21
+ type: string
22
+ description: the version of the zip archive
23
+ build-tools:
24
+ type: string
25
+ steps:
26
+ - restore_cache:
27
+ key: v1-android-sdk-{{ arch }}-<< parameters.zip-version >>-<< parameters.build-tools >>
28
+ - run: |
29
+ version="<< parameters.zip-version >>"
30
+ if [ "$(cat $ANDROID_SDK_ROOT/.sdk_tools_version || echo)" != "$version" ]; then
31
+ rm -fr $ANDROID_SDK_ROOT || :
32
+ mkdir -p $ANDROID_SDK_ROOT/licenses $ANDROID_SDK_ROOT/cmdline-tools
33
+ curl -o sdk-tools-linux.zip "https://dl.google.com/android/repository/commandlinetools-linux-${version}_latest.zip"
34
+ unzip "sdk-tools-linux.zip" -d $ANDROID_SDK_ROOT/cmdline-tools
35
+ echo "$version" > $ANDROID_SDK_ROOT/.sdk_tools_version
36
+ fi
37
+ mkdir -p $ANDROID_SDK_ROOT/licenses
38
+ cp .circleci/android-sdk-license $ANDROID_SDK_ROOT/licenses/
39
+ $ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager "build-tools;<< parameters.build-tools >>"
40
+ - save_cache:
41
+ key: v1-android-sdk-{{ arch }}-<< parameters.zip-version >>-<< parameters.build-tools >>
42
+ paths:
43
+ - ~/sdk
44
+ install-ruby:
45
+ parameters:
46
+ ruby-version:
47
+ type: string
48
+ steps:
49
+ - run: |
50
+ sudo apt-get update && \
51
+ cd /tmp && wget -O ruby-install-0.6.1.tar.gz https://github.com/postmodern/ruby-install/archive/v0.6.1.tar.gz && \
52
+ tar -xzvf ruby-install-0.6.1.tar.gz && \
53
+ cd ruby-install-0.6.1 && \
54
+ sudo make install && \
55
+ ruby-install --cleanup ruby << parameters.ruby-version >> && \
56
+ rm -r /tmp/ruby-install-* && \
57
+ sudo rm -rf /var/lib/apt/lists/*
58
+
59
+ echo "export PATH=${HOME}/.rubies/ruby-<< parameters.ruby-version >>/bin:\${PATH}" >> $BASH_ENV
60
+ - run: ruby --version
61
+ bundle-install:
62
+ steps:
63
+ - restore_cache:
64
+ key: v1-bundle-{{ arch }}-{{ checksum "./Gemfile.lock" }}
65
+ - run: gem install bundler -v 2.1.4
66
+ - run: bundle install --path=vendor/bundle
67
+ - save_cache:
68
+ key: v1-bundle-{{ arch }}-{{ checksum "./Gemfile.lock" }}
69
+ paths:
70
+ - vendor/bundle
71
+
72
+ jobs:
73
+ lint:
74
+ executor: ruby
75
+ steps:
76
+ - checkout
77
+ - bundle-install
78
+ - run: bundle exec rake rubocop
79
+
80
+ test:
81
+ parameters:
82
+ ruby_version:
83
+ type: string
84
+ description: 'Ruby version to be used'
85
+ executor: base
86
+
87
+ steps:
88
+ - checkout
89
+ - install-ruby:
90
+ ruby-version: << parameters.ruby_version >>
91
+ - install-android-sdk:
92
+ zip-version: "6514223"
93
+ build-tools: 29.0.2
94
+ - bundle-install
95
+ - run: bundle exec rake specs spec_docs
96
+
97
+ workflows:
98
+ materix_test:
99
+ jobs:
100
+ - lint
101
+ - test:
102
+ matrix:
103
+ parameters:
104
+ ruby_version: [2.5.8, 2.6.6, 2.7.1]
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ pkg
4
4
  .yardoc
5
5
  **/vendor/bundle/
6
6
  *.gem
7
+ .bundle/
@@ -3,7 +3,16 @@
3
3
  # If you don't like these settings, just delete this file :)
4
4
 
5
5
  AllCops:
6
- TargetRubyVersion: 2.0
6
+ Exclude:
7
+ - 'vendor/**/*'
8
+ - 'spec/fixtures/**/*'
9
+ - 'tmp/**/*'
10
+ TargetRubyVersion: 2.7.1
11
+
12
+ Metrics/ModuleLength:
13
+ Exclude:
14
+ - 'spec/**/*'
15
+ Enabled: true
7
16
 
8
17
  Style/StringLiterals:
9
18
  EnforcedStyle: double_quotes
@@ -13,20 +22,16 @@ Style/StringLiterals:
13
22
  Style/ClassCheck:
14
23
  EnforcedStyle: kind_of?
15
24
 
16
- # It's better to be more explicit about the type
17
- Style/BracesAroundHashParameters:
18
- Enabled: false
19
-
20
25
  # specs sometimes have useless assignments, which is fine
21
26
  Lint/UselessAssignment:
22
27
  Exclude:
23
28
  - '**/spec/**/*'
24
29
 
25
30
  # We could potentially enable the 2 below:
26
- Layout/IndentHash:
31
+ Layout/FirstHashElementIndentation:
27
32
  Enabled: false
28
33
 
29
- Layout/AlignHash:
34
+ Layout/HashAlignment:
30
35
  Enabled: false
31
36
 
32
37
  # HoundCI doesn't like this rule
@@ -76,7 +81,7 @@ Metrics/CyclomaticComplexity:
76
81
  Max: 17
77
82
 
78
83
  # Configuration parameters: AllowURI, URISchemes.
79
- Metrics/LineLength:
84
+ Layout/LineLength:
80
85
  Max: 370
81
86
 
82
87
  # Configuration parameters: CountKeywordArgs.
@@ -127,16 +132,16 @@ Metrics/BlockLength:
127
132
  Style/MixinGrouping:
128
133
  Enabled: false
129
134
 
130
- Style/FileName:
135
+ Naming/FileName:
131
136
  Enabled: false
132
137
 
133
- Layout/IndentHeredoc:
138
+ Layout/HeredocIndentation:
134
139
  Enabled: false
135
140
 
136
141
  Style/SpecialGlobalVars:
137
142
  Enabled: false
138
143
 
139
- PercentLiteralDelimiters:
144
+ Department/PercentLiteralDelimiters:
140
145
  PreferredDelimiters:
141
146
  "%": ()
142
147
  "%i": ()
@@ -150,3 +155,51 @@ PercentLiteralDelimiters:
150
155
 
151
156
  Security/YAMLLoad:
152
157
  Enabled: false
158
+
159
+ Style/TrailingCommaInArguments:
160
+ Enabled: true
161
+
162
+ Style/TrailingCommaInArrayLiteral:
163
+ Enabled: false
164
+
165
+ Style/TrailingCommaInHashLiteral:
166
+ Enabled: false
167
+
168
+ Layout/EmptyLinesAroundAttributeAccessor:
169
+ Enabled: true
170
+
171
+ Layout/SpaceAroundMethodCallOperator:
172
+ Enabled: false
173
+
174
+ Lint/DeprecatedOpenSSLConstant:
175
+ Enabled: false
176
+
177
+ Lint/MixedRegexpCaptureTypes:
178
+ Enabled: false
179
+
180
+ Lint/RaiseException:
181
+ Enabled: true
182
+
183
+ Lint/StructNewOverride:
184
+ Enabled: true
185
+
186
+ Style/ExponentialNotation:
187
+ Enabled: false
188
+
189
+ Style/HashEachMethods:
190
+ Enabled: true
191
+
192
+ Style/HashTransformKeys:
193
+ Enabled: true
194
+
195
+ Style/HashTransformValues:
196
+ Enabled: true
197
+
198
+ Style/RedundantRegexpCharacterClass:
199
+ Enabled: true
200
+
201
+ Style/RedundantRegexpEscape:
202
+ Enabled: true
203
+
204
+ Style/SlicingWithRange:
205
+ Enabled: true
@@ -0,0 +1,17 @@
1
+ apkstats.command_type=:apk_analyzer
2
+ apkstats.apk_filepath='./spec/fixture/app-base.apk'
3
+
4
+ # custom command path
5
+ # apkstats.command_path='/path/to/analysis_command'
6
+
7
+ message(apkstats.file_size)
8
+ message(apkstats.download_size)
9
+ message(apkstats.required_features)
10
+ message(apkstats.non_required_features)
11
+ message(apkstats.permissions)
12
+ message(apkstats.min_sdk)
13
+ message(apkstats.target_sdk)
14
+ message("#{apkstats.reference_count}")
15
+ message("#{apkstats.dex_count}")
16
+
17
+ apkstats.compare_with('/spec/fixture/app-other5.apk', do_report: true)
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in danger-apkstats.gemspec
4
6
  gemspec
@@ -0,0 +1,145 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ danger-apkstats (0.3.0)
5
+ danger-plugin-api (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.7.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.1)
13
+ claide (1.0.3)
14
+ claide-plugins (0.9.2)
15
+ cork
16
+ nap
17
+ open4 (~> 1.3)
18
+ coderay (1.1.3)
19
+ colored2 (3.1.2)
20
+ cork (0.3.0)
21
+ colored2 (~> 3.1)
22
+ danger (8.0.1)
23
+ claide (~> 1.0)
24
+ claide-plugins (>= 0.9.2)
25
+ colored2 (~> 3.1)
26
+ cork (~> 0.1)
27
+ faraday (>= 0.9.0, < 2.0)
28
+ faraday-http-cache (~> 2.0)
29
+ git (~> 1.7)
30
+ kramdown (~> 2.0)
31
+ kramdown-parser-gfm (~> 1.0)
32
+ no_proxy_fix
33
+ octokit (~> 4.7)
34
+ terminal-table (~> 1)
35
+ danger-plugin-api (1.0.0)
36
+ danger (> 2.0)
37
+ diff-lcs (1.3)
38
+ faraday (1.0.1)
39
+ multipart-post (>= 1.2, < 3)
40
+ faraday-http-cache (2.2.0)
41
+ faraday (>= 0.8)
42
+ ffi (1.13.1)
43
+ formatador (0.2.5)
44
+ git (1.7.0)
45
+ rchardet (~> 1.8)
46
+ guard (2.16.2)
47
+ formatador (>= 0.2.4)
48
+ listen (>= 2.7, < 4.0)
49
+ lumberjack (>= 1.0.12, < 2.0)
50
+ nenv (~> 0.1)
51
+ notiffany (~> 0.0)
52
+ pry (>= 0.9.12)
53
+ shellany (~> 0.0)
54
+ thor (>= 0.18.1)
55
+ guard-compat (1.2.1)
56
+ guard-rspec (4.7.3)
57
+ guard (~> 2.1)
58
+ guard-compat (~> 1.1)
59
+ rspec (>= 2.99.0, < 4.0)
60
+ kramdown (2.2.1)
61
+ rexml
62
+ kramdown-parser-gfm (1.1.0)
63
+ kramdown (~> 2.0)
64
+ listen (3.0.7)
65
+ rb-fsevent (>= 0.9.3)
66
+ rb-inotify (>= 0.9.7)
67
+ lumberjack (1.2.5)
68
+ method_source (1.0.0)
69
+ multipart-post (2.1.1)
70
+ nap (1.1.0)
71
+ nenv (0.3.0)
72
+ no_proxy_fix (0.1.2)
73
+ notiffany (0.1.3)
74
+ nenv (~> 0.1)
75
+ shellany (~> 0.0)
76
+ octokit (4.18.0)
77
+ faraday (>= 0.9)
78
+ sawyer (~> 0.8.0, >= 0.5.3)
79
+ open4 (1.3.4)
80
+ parallel (1.19.1)
81
+ parser (2.7.1.3)
82
+ ast (~> 2.4.0)
83
+ pry (0.13.1)
84
+ coderay (~> 1.1)
85
+ method_source (~> 1.0)
86
+ public_suffix (4.0.5)
87
+ rainbow (3.0.0)
88
+ rake (13.0.1)
89
+ rb-fsevent (0.10.4)
90
+ rb-inotify (0.10.1)
91
+ ffi (~> 1.0)
92
+ rchardet (1.8.0)
93
+ regexp_parser (1.7.1)
94
+ rexml (3.2.4)
95
+ rspec (3.9.0)
96
+ rspec-core (~> 3.9.0)
97
+ rspec-expectations (~> 3.9.0)
98
+ rspec-mocks (~> 3.9.0)
99
+ rspec-core (3.9.2)
100
+ rspec-support (~> 3.9.3)
101
+ rspec-expectations (3.9.2)
102
+ diff-lcs (>= 1.2.0, < 2.0)
103
+ rspec-support (~> 3.9.0)
104
+ rspec-mocks (3.9.1)
105
+ diff-lcs (>= 1.2.0, < 2.0)
106
+ rspec-support (~> 3.9.0)
107
+ rspec-support (3.9.3)
108
+ rubocop (0.85.1)
109
+ parallel (~> 1.10)
110
+ parser (>= 2.7.0.1)
111
+ rainbow (>= 2.2.2, < 4.0)
112
+ regexp_parser (>= 1.7)
113
+ rexml
114
+ rubocop-ast (>= 0.0.3)
115
+ ruby-progressbar (~> 1.7)
116
+ unicode-display_width (>= 1.4.0, < 2.0)
117
+ rubocop-ast (0.0.3)
118
+ parser (>= 2.7.0.1)
119
+ ruby-progressbar (1.10.1)
120
+ sawyer (0.8.2)
121
+ addressable (>= 2.3.5)
122
+ faraday (> 0.8, < 2.0)
123
+ shellany (0.0.1)
124
+ terminal-table (1.8.0)
125
+ unicode-display_width (~> 1.1, >= 1.1.1)
126
+ thor (1.0.1)
127
+ unicode-display_width (1.7.0)
128
+ yard (0.9.25)
129
+
130
+ PLATFORMS
131
+ ruby
132
+
133
+ DEPENDENCIES
134
+ danger-apkstats!
135
+ guard (~> 2.14)
136
+ guard-rspec (~> 4.7)
137
+ listen (= 3.0.7)
138
+ pry
139
+ rake (~> 13.0)
140
+ rspec (~> 3.4)
141
+ rubocop
142
+ yard
143
+
144
+ BUNDLED WITH
145
+ 2.1.4
data/Guardfile CHANGED
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A guardfile for making Danger Plugins
2
4
  # For more info see https://github.com/guard/guard#readme
3
5
 
4
6
  # To run, use `bundle exec guard`.
5
7
 
6
- guard :rspec, cmd: 'bundle exec rspec' do
7
- require 'guard/rspec/dsl'
8
+ guard :rspec, cmd: "bundle exec rspec" do
9
+ require "guard/rspec/dsl"
8
10
  dsl = Guard::RSpec::Dsl.new(self)
9
11
 
10
12
  # RSpec files
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018 Jumpei Matsuda <jmatsu.drm@gmail.com>
1
+ Copyright (c) 2018-2020 Jumpei Matsuda <jmatsu.drm@gmail.com>
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,26 +1,65 @@
1
+ [![jmatsu](https://circleci.com/gh/jmatsu/danger-apkstats.svg?style=shield)](https://circleci.com/gh/jmatsu/danger-apkstats) [![Gem Version](https://badge.fury.io/rb/danger-apkstats.svg)](https://badge.fury.io/rb/danger-apkstats)
2
+
1
3
  # danger-apkstats
2
4
 
3
- A description of danger-apkstats.
5
+ This is a plugin of [Danger](https://github.com/danger/danger) for Android projects.
6
+ This allows you to get attributes of your application file (apk) and report a summary of comparison between two application files.
4
7
 
5
8
  ## Installation
6
9
 
7
- $ gem install danger-apkstats
10
+ `gem install danger-apkstats` or add `danger-apkstats` to your Gemfile.
11
+
12
+ Please specify the path of apkanalyzer in your Dangerfile.
13
+
14
+ ```ruby
15
+ apkstats.apkanalyzer_path='/path/to/apkanalyzer'
16
+ ```
17
+
18
+ `ANDROID_HOME` has been officially deprecated. `ANDROID_SDK_ROOT` is similar to `ANDROID_HOME` but differs actually. And also, the change indicated the possibility of further deprecations and/or breaking changes in the Android SDK structure.
8
19
 
9
20
  ## Usage
10
21
 
11
- Methods and attributes from this plugin are available in
12
- your `Dangerfile` under the `apkstats` namespace.
22
+ `apkstats` namespace is available under Dangerfile.
23
+
24
+ ### Required preparation
13
25
 
14
- # Sample
26
+ ```
27
+ apkstats.apk_filepath='app-debug.apk' # required.
28
+ ```
29
+
30
+ ### Show attributes
15
31
 
16
32
  ```
17
- apkstats.command_type=:apk_analyzer # required
18
- apkstats.apk_filepath='app-debug.apk' # required
19
- apkstats.compare_with('app-other.apk', do_report: true)
20
- apkstats.filesize
21
- apkstats.downloadsize
33
+ apkstats.file_size #=> Fixnum
34
+ apkstats.download_size #=> Fixnum
35
+ apkstats.required_features #=> Array<String> | Nil
36
+ apkstats.non_required_features #=> Array<String> | Nil
37
+ apkstats.permissions #=> Array<String> | Nil
38
+ apkstats.min_sdk #=> String | Nil
39
+ apkstats.target_sdk #=> String | Nils
40
+ apkstats.reference_count #=> Fixnum
41
+ apkstats.dex_count #=> Fixnum
22
42
  ```
23
43
 
44
+ ### Get a comparison report
45
+
46
+ ```
47
+ apkstats.compare_with(String, do_report: Boolean)
48
+ ```
49
+
50
+ For example, the report will be like below.
51
+
52
+ Property | Summary
53
+ :--- | :---
54
+ New File Size | 1621248 Bytes. (1.55 MB)
55
+ File Size Change | -13352 Bytes. (-13.04 KB)
56
+ Download Size Change | +41141 Bytes. (+40.18 KB)
57
+ Removed Required Features | - android.hardware.camera
58
+ Removed Non-required Features | - android.hardware.camera.front (not-required)
59
+ Removed Permissions | - android.permission.INTERNET<br>- android.permission.CAMERA
60
+ New Number of dex file(s) | 15720
61
+ Number of dex file(s) Change | 1
62
+
24
63
  ## Development
25
64
 
26
65
  1. Clone this repo
@@ -28,3 +67,9 @@ apkstats.downloadsize
28
67
  3. Run `bundle exec rake spec` to run the tests.
29
68
  4. Use `bundle exec guard` to automatically have tests run as you make changes.
30
69
  5. Make your changes.
70
+
71
+ ### Supported ruby versions
72
+
73
+ Support only versions which are in normal and/or security maintenance.
74
+
75
+ ref: https://www.ruby-lang.org/en/downloads/branches/