danger-apkstats 0.2.0 → 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 +5 -5
- data/.circleci/android-sdk-license +3 -0
- data/.circleci/config.yml +104 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +47 -12
- data/Gemfile.lock +70 -61
- data/LICENSE.txt +1 -1
- data/README.md +15 -3
- data/danger-apkstats.gemspec +2 -3
- data/lib/apkstats/command/apk_analyzer.rb +3 -2
- data/lib/apkstats/entity/feature.rb +1 -0
- data/lib/apkstats/entity/permission.rb +1 -0
- data/lib/apkstats/gem_version.rb +1 -1
- data/lib/apkstats/plugin.rb +56 -25
- data/spec/apkstats_spec.rb +54 -9
- data/spec/command/apk_analyzer_spec.rb +2 -3
- metadata +8 -23
- data/.bundle/config +0 -3
- data/.travis.yml +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 206a4a16c43f2e18507ab485cce2947c1e932fbee471db57e4f43b20b9e4aa02
|
|
4
|
+
data.tar.gz: f38876905c1095c7da969bbb6d6e43ea5a09ab0cce2941544263137c2ffa3a1e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a9490b757975f4ed708ce6e2df907cea5594cd1fdd8bd338cd6eff111f8d75148c41ad442c1756af7aca9f78992d908fb76905bbcd7cddb0fb3f4ea4e6ab4d04
|
|
7
|
+
data.tar.gz: 73c01476155e698d19655affd292bbdebfffad6e4615bb96257280a57deced379b7a4fedc3bcd43d049460a8d0f2da6925d9fae7e08c048e4fd0b7eb6e3fbbd8
|
|
@@ -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
data/.rubocop.yml
CHANGED
|
@@ -7,7 +7,7 @@ AllCops:
|
|
|
7
7
|
- 'vendor/**/*'
|
|
8
8
|
- 'spec/fixtures/**/*'
|
|
9
9
|
- 'tmp/**/*'
|
|
10
|
-
TargetRubyVersion: 2.
|
|
10
|
+
TargetRubyVersion: 2.7.1
|
|
11
11
|
|
|
12
12
|
Metrics/ModuleLength:
|
|
13
13
|
Exclude:
|
|
@@ -22,20 +22,16 @@ Style/StringLiterals:
|
|
|
22
22
|
Style/ClassCheck:
|
|
23
23
|
EnforcedStyle: kind_of?
|
|
24
24
|
|
|
25
|
-
# It's better to be more explicit about the type
|
|
26
|
-
Style/BracesAroundHashParameters:
|
|
27
|
-
Enabled: false
|
|
28
|
-
|
|
29
25
|
# specs sometimes have useless assignments, which is fine
|
|
30
26
|
Lint/UselessAssignment:
|
|
31
27
|
Exclude:
|
|
32
28
|
- '**/spec/**/*'
|
|
33
29
|
|
|
34
30
|
# We could potentially enable the 2 below:
|
|
35
|
-
Layout/
|
|
31
|
+
Layout/FirstHashElementIndentation:
|
|
36
32
|
Enabled: false
|
|
37
33
|
|
|
38
|
-
Layout/
|
|
34
|
+
Layout/HashAlignment:
|
|
39
35
|
Enabled: false
|
|
40
36
|
|
|
41
37
|
# HoundCI doesn't like this rule
|
|
@@ -85,7 +81,7 @@ Metrics/CyclomaticComplexity:
|
|
|
85
81
|
Max: 17
|
|
86
82
|
|
|
87
83
|
# Configuration parameters: AllowURI, URISchemes.
|
|
88
|
-
|
|
84
|
+
Layout/LineLength:
|
|
89
85
|
Max: 370
|
|
90
86
|
|
|
91
87
|
# Configuration parameters: CountKeywordArgs.
|
|
@@ -136,16 +132,16 @@ Metrics/BlockLength:
|
|
|
136
132
|
Style/MixinGrouping:
|
|
137
133
|
Enabled: false
|
|
138
134
|
|
|
139
|
-
|
|
135
|
+
Naming/FileName:
|
|
140
136
|
Enabled: false
|
|
141
137
|
|
|
142
|
-
Layout/
|
|
138
|
+
Layout/HeredocIndentation:
|
|
143
139
|
Enabled: false
|
|
144
140
|
|
|
145
141
|
Style/SpecialGlobalVars:
|
|
146
142
|
Enabled: false
|
|
147
143
|
|
|
148
|
-
PercentLiteralDelimiters:
|
|
144
|
+
Department/PercentLiteralDelimiters:
|
|
149
145
|
PreferredDelimiters:
|
|
150
146
|
"%": ()
|
|
151
147
|
"%i": ()
|
|
@@ -167,4 +163,43 @@ Style/TrailingCommaInArrayLiteral:
|
|
|
167
163
|
Enabled: false
|
|
168
164
|
|
|
169
165
|
Style/TrailingCommaInHashLiteral:
|
|
170
|
-
Enabled: false
|
|
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
|
data/Gemfile.lock
CHANGED
|
@@ -1,47 +1,49 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
danger-apkstats (0.
|
|
4
|
+
danger-apkstats (0.3.0)
|
|
5
5
|
danger-plugin-api (~> 1.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
addressable (2.
|
|
11
|
-
public_suffix (>= 2.0.2, <
|
|
12
|
-
ast (2.4.
|
|
13
|
-
claide (1.0.
|
|
10
|
+
addressable (2.7.0)
|
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
12
|
+
ast (2.4.1)
|
|
13
|
+
claide (1.0.3)
|
|
14
14
|
claide-plugins (0.9.2)
|
|
15
15
|
cork
|
|
16
16
|
nap
|
|
17
17
|
open4 (~> 1.3)
|
|
18
|
-
coderay (1.1.
|
|
18
|
+
coderay (1.1.3)
|
|
19
19
|
colored2 (3.1.2)
|
|
20
20
|
cork (0.3.0)
|
|
21
21
|
colored2 (~> 3.1)
|
|
22
|
-
danger (
|
|
22
|
+
danger (8.0.1)
|
|
23
23
|
claide (~> 1.0)
|
|
24
24
|
claide-plugins (>= 0.9.2)
|
|
25
25
|
colored2 (~> 3.1)
|
|
26
26
|
cork (~> 0.1)
|
|
27
|
-
faraday (
|
|
28
|
-
faraday-http-cache (~>
|
|
29
|
-
git (~> 1)
|
|
30
|
-
kramdown (~>
|
|
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)
|
|
31
32
|
no_proxy_fix
|
|
32
33
|
octokit (~> 4.7)
|
|
33
34
|
terminal-table (~> 1)
|
|
34
35
|
danger-plugin-api (1.0.0)
|
|
35
36
|
danger (> 2.0)
|
|
36
37
|
diff-lcs (1.3)
|
|
37
|
-
faraday (0.
|
|
38
|
+
faraday (1.0.1)
|
|
38
39
|
multipart-post (>= 1.2, < 3)
|
|
39
|
-
faraday-http-cache (
|
|
40
|
-
faraday (
|
|
41
|
-
ffi (1.
|
|
40
|
+
faraday-http-cache (2.2.0)
|
|
41
|
+
faraday (>= 0.8)
|
|
42
|
+
ffi (1.13.1)
|
|
42
43
|
formatador (0.2.5)
|
|
43
|
-
git (1.
|
|
44
|
-
|
|
44
|
+
git (1.7.0)
|
|
45
|
+
rchardet (~> 1.8)
|
|
46
|
+
guard (2.16.2)
|
|
45
47
|
formatador (>= 0.2.4)
|
|
46
48
|
listen (>= 2.7, < 4.0)
|
|
47
49
|
lumberjack (>= 1.0.12, < 2.0)
|
|
@@ -55,82 +57,89 @@ GEM
|
|
|
55
57
|
guard (~> 2.1)
|
|
56
58
|
guard-compat (~> 1.1)
|
|
57
59
|
rspec (>= 2.99.0, < 4.0)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
kramdown (2.2.1)
|
|
61
|
+
rexml
|
|
62
|
+
kramdown-parser-gfm (1.1.0)
|
|
63
|
+
kramdown (~> 2.0)
|
|
60
64
|
listen (3.0.7)
|
|
61
65
|
rb-fsevent (>= 0.9.3)
|
|
62
66
|
rb-inotify (>= 0.9.7)
|
|
63
|
-
lumberjack (1.
|
|
64
|
-
method_source (0.
|
|
65
|
-
multipart-post (2.
|
|
67
|
+
lumberjack (1.2.5)
|
|
68
|
+
method_source (1.0.0)
|
|
69
|
+
multipart-post (2.1.1)
|
|
66
70
|
nap (1.1.0)
|
|
67
71
|
nenv (0.3.0)
|
|
68
72
|
no_proxy_fix (0.1.2)
|
|
69
|
-
notiffany (0.1.
|
|
73
|
+
notiffany (0.1.3)
|
|
70
74
|
nenv (~> 0.1)
|
|
71
75
|
shellany (~> 0.0)
|
|
72
|
-
octokit (4.
|
|
76
|
+
octokit (4.18.0)
|
|
77
|
+
faraday (>= 0.9)
|
|
73
78
|
sawyer (~> 0.8.0, >= 0.5.3)
|
|
74
79
|
open4 (1.3.4)
|
|
75
|
-
parallel (1.
|
|
76
|
-
parser (2.
|
|
80
|
+
parallel (1.19.1)
|
|
81
|
+
parser (2.7.1.3)
|
|
77
82
|
ast (~> 2.4.0)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
public_suffix (3.0.3)
|
|
83
|
+
pry (0.13.1)
|
|
84
|
+
coderay (~> 1.1)
|
|
85
|
+
method_source (~> 1.0)
|
|
86
|
+
public_suffix (4.0.5)
|
|
83
87
|
rainbow (3.0.0)
|
|
84
|
-
rake (
|
|
85
|
-
rb-fsevent (0.10.
|
|
86
|
-
rb-inotify (0.
|
|
87
|
-
ffi (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
rspec-
|
|
94
|
-
|
|
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)
|
|
95
102
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
96
|
-
rspec-support (~> 3.
|
|
97
|
-
rspec-mocks (3.
|
|
103
|
+
rspec-support (~> 3.9.0)
|
|
104
|
+
rspec-mocks (3.9.1)
|
|
98
105
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
99
|
-
rspec-support (~> 3.
|
|
100
|
-
rspec-support (3.
|
|
101
|
-
rubocop (0.
|
|
102
|
-
jaro_winkler (~> 1.5.1)
|
|
106
|
+
rspec-support (~> 3.9.0)
|
|
107
|
+
rspec-support (3.9.3)
|
|
108
|
+
rubocop (0.85.1)
|
|
103
109
|
parallel (~> 1.10)
|
|
104
|
-
parser (>= 2.
|
|
105
|
-
powerpack (~> 0.1)
|
|
110
|
+
parser (>= 2.7.0.1)
|
|
106
111
|
rainbow (>= 2.2.2, < 4.0)
|
|
112
|
+
regexp_parser (>= 1.7)
|
|
113
|
+
rexml
|
|
114
|
+
rubocop-ast (>= 0.0.3)
|
|
107
115
|
ruby-progressbar (~> 1.7)
|
|
108
|
-
unicode-display_width (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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)
|
|
113
123
|
shellany (0.0.1)
|
|
114
124
|
terminal-table (1.8.0)
|
|
115
125
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
116
|
-
thor (0.
|
|
117
|
-
unicode-display_width (1.
|
|
118
|
-
yard (0.9.
|
|
126
|
+
thor (1.0.1)
|
|
127
|
+
unicode-display_width (1.7.0)
|
|
128
|
+
yard (0.9.25)
|
|
119
129
|
|
|
120
130
|
PLATFORMS
|
|
121
131
|
ruby
|
|
122
132
|
|
|
123
133
|
DEPENDENCIES
|
|
124
|
-
bundler (~> 1.3)
|
|
125
134
|
danger-apkstats!
|
|
126
135
|
guard (~> 2.14)
|
|
127
136
|
guard-rspec (~> 4.7)
|
|
128
137
|
listen (= 3.0.7)
|
|
129
138
|
pry
|
|
130
|
-
rake (~>
|
|
139
|
+
rake (~> 13.0)
|
|
131
140
|
rspec (~> 3.4)
|
|
132
141
|
rubocop
|
|
133
142
|
yard
|
|
134
143
|
|
|
135
144
|
BUNDLED WITH
|
|
136
|
-
1.
|
|
145
|
+
2.1.4
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://circleci.com/gh/jmatsu/danger-apkstats) [](https://badge.fury.io/rb/danger-apkstats)
|
|
2
2
|
|
|
3
3
|
# danger-apkstats
|
|
4
4
|
|
|
@@ -7,9 +7,15 @@ This allows you to get attributes of your application file (apk) and report a su
|
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
|
-
`gem install danger-apkstats`
|
|
10
|
+
`gem install danger-apkstats` or add `danger-apkstats` to your Gemfile.
|
|
11
11
|
|
|
12
|
-
|
|
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.
|
|
13
19
|
|
|
14
20
|
## Usage
|
|
15
21
|
|
|
@@ -61,3 +67,9 @@ Number of dex file(s) Change | 1
|
|
|
61
67
|
3. Run `bundle exec rake spec` to run the tests.
|
|
62
68
|
4. Use `bundle exec guard` to automatically have tests run as you make changes.
|
|
63
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/
|
data/danger-apkstats.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
|
9
9
|
spec.version = Apkstats::VERSION
|
|
10
10
|
spec.authors = ["Jumpei Matsuda"]
|
|
11
11
|
spec.email = ["jmatsu.drm@gmail.com"]
|
|
12
|
-
spec.description = "To
|
|
12
|
+
spec.description = "To inspect android application file with danger."
|
|
13
13
|
spec.summary = "This is a danger plugin to inspect android application file."
|
|
14
14
|
spec.homepage = "https://github.com/jmatsu/danger-apkstats"
|
|
15
15
|
spec.license = "MIT"
|
|
@@ -22,8 +22,7 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.add_runtime_dependency "danger-plugin-api", "~> 1.0"
|
|
23
23
|
|
|
24
24
|
# General ruby development
|
|
25
|
-
spec.add_development_dependency "
|
|
26
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
|
25
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
27
26
|
|
|
28
27
|
# Testing support
|
|
29
28
|
spec.add_development_dependency "rspec", "~> 3.4"
|
|
@@ -5,7 +5,7 @@ module Apkstats::Command
|
|
|
5
5
|
include Apkstats::Command::Executable
|
|
6
6
|
|
|
7
7
|
def initialize(opts)
|
|
8
|
-
@command_path = opts
|
|
8
|
+
@command_path = opts.fetch(:command_path)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def file_size(apk_filepath)
|
|
@@ -80,8 +80,9 @@ module Apkstats::Command
|
|
|
80
80
|
private
|
|
81
81
|
|
|
82
82
|
def run_command(*args)
|
|
83
|
-
out, err, status = Open3.capture3(
|
|
83
|
+
out, err, status = Open3.capture3(command_path, *args)
|
|
84
84
|
raise err unless status.success?
|
|
85
|
+
|
|
85
86
|
out.rstrip
|
|
86
87
|
end
|
|
87
88
|
end
|
data/lib/apkstats/gem_version.rb
CHANGED
data/lib/apkstats/plugin.rb
CHANGED
|
@@ -64,24 +64,34 @@ module Danger
|
|
|
64
64
|
# @tags android, apk_stats
|
|
65
65
|
#
|
|
66
66
|
class DangerApkstats < Plugin
|
|
67
|
+
class Error < StandardError; end
|
|
68
|
+
|
|
69
|
+
# @deprecated this field have no effect
|
|
67
70
|
COMMAND_TYPE_MAP = {
|
|
68
71
|
apk_analyzer: Apkstats::Command::ApkAnalyzer,
|
|
69
72
|
}.freeze
|
|
70
73
|
|
|
71
74
|
private_constant(:COMMAND_TYPE_MAP)
|
|
72
75
|
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
# One of keys of COMMAND_TYPE_MAP
|
|
76
|
+
# @deprecated this field have no effect
|
|
77
|
+
# This will be removed in further versions
|
|
76
78
|
#
|
|
77
|
-
# @return [
|
|
79
|
+
# @return [String] _
|
|
78
80
|
attr_accessor :command_type
|
|
79
81
|
|
|
80
|
-
# *
|
|
81
|
-
# A
|
|
82
|
+
# *Required*
|
|
83
|
+
# A path of apkanalyzer command
|
|
82
84
|
#
|
|
83
|
-
# @return [
|
|
84
|
-
attr_accessor :
|
|
85
|
+
# @return [String] _
|
|
86
|
+
attr_accessor :apkanalyzer_path
|
|
87
|
+
|
|
88
|
+
# @deprecated Use apkanalyzer_path instead
|
|
89
|
+
# @return [String] _
|
|
90
|
+
alias command_path apkanalyzer_path
|
|
91
|
+
|
|
92
|
+
# @deprecated Use apkanalyzer_path= instead
|
|
93
|
+
# @return [String] _
|
|
94
|
+
alias command_path= apkanalyzer_path=
|
|
85
95
|
|
|
86
96
|
# *Required*
|
|
87
97
|
# Your target apk filepath.
|
|
@@ -111,7 +121,7 @@ module Danger
|
|
|
111
121
|
|
|
112
122
|
diff = result[:diff]
|
|
113
123
|
|
|
114
|
-
md = +"### Apk
|
|
124
|
+
md = +"### Apk comparison results" << "\n\n"
|
|
115
125
|
md << "Property | Summary" << "\n"
|
|
116
126
|
md << ":--- | :---" << "\n"
|
|
117
127
|
|
|
@@ -183,7 +193,7 @@ module Danger
|
|
|
183
193
|
rescue StandardError => e
|
|
184
194
|
warn("apkstats failed to execute the command due to #{e.message}")
|
|
185
195
|
|
|
186
|
-
e
|
|
196
|
+
on_error(e)
|
|
187
197
|
end
|
|
188
198
|
|
|
189
199
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
|
@@ -192,7 +202,7 @@ module Danger
|
|
|
192
202
|
#
|
|
193
203
|
# @return [Fixnum] return positive value if exists, otherwise -1.
|
|
194
204
|
def file_size(_opts = {})
|
|
195
|
-
result = run_command(__method__)
|
|
205
|
+
result = run_command(apkanalyzer_command, __method__)
|
|
196
206
|
result ? result.to_i : -1
|
|
197
207
|
end
|
|
198
208
|
|
|
@@ -200,7 +210,7 @@ module Danger
|
|
|
200
210
|
#
|
|
201
211
|
# @return [Fixnum] return positive value if exists, otherwise -1.
|
|
202
212
|
def download_size(_opts = {})
|
|
203
|
-
result = run_command(__method__)
|
|
213
|
+
result = run_command(apkanalyzer_command, __method__)
|
|
204
214
|
result ? result.to_i : -1
|
|
205
215
|
end
|
|
206
216
|
|
|
@@ -209,7 +219,7 @@ module Danger
|
|
|
209
219
|
#
|
|
210
220
|
# @return [Array<String>, Nil] return nil unless retrieved.
|
|
211
221
|
def required_features(_opts = {})
|
|
212
|
-
result = run_command(__method__)
|
|
222
|
+
result = run_command(apkanalyzer_command, __method__)
|
|
213
223
|
result ? result.to_a : nil
|
|
214
224
|
end
|
|
215
225
|
|
|
@@ -218,7 +228,7 @@ module Danger
|
|
|
218
228
|
#
|
|
219
229
|
# @return [Array<String>, Nil] return nil unless retrieved.
|
|
220
230
|
def non_required_features(_opts = {})
|
|
221
|
-
result = run_command(__method__)
|
|
231
|
+
result = run_command(apkanalyzer_command, __method__)
|
|
222
232
|
result ? result.to_a : nil
|
|
223
233
|
end
|
|
224
234
|
|
|
@@ -226,7 +236,7 @@ module Danger
|
|
|
226
236
|
#
|
|
227
237
|
# @return [Array<String>, Nil] return nil unless retrieved.
|
|
228
238
|
def permissions(_opts = {})
|
|
229
|
-
result = run_command(__method__)
|
|
239
|
+
result = run_command(apkanalyzer_command, __method__)
|
|
230
240
|
result ? result.to_a : nil
|
|
231
241
|
end
|
|
232
242
|
|
|
@@ -234,21 +244,21 @@ module Danger
|
|
|
234
244
|
#
|
|
235
245
|
# @return [String, Nil] return nil unless retrieved.
|
|
236
246
|
def min_sdk(_opts = {})
|
|
237
|
-
run_command(__method__)
|
|
247
|
+
run_command(apkanalyzer_command, __method__)
|
|
238
248
|
end
|
|
239
249
|
|
|
240
250
|
# Show the target sdk version of your apk file.
|
|
241
251
|
#
|
|
242
252
|
# @return [String, Nil] return nil unless retrieved.
|
|
243
253
|
def target_sdk(_opts = {})
|
|
244
|
-
run_command(__method__)
|
|
254
|
+
run_command(apkanalyzer_command, __method__)
|
|
245
255
|
end
|
|
246
256
|
|
|
247
257
|
# Show the methods reference count of your apk file.
|
|
248
258
|
#
|
|
249
259
|
# @return [Fixnum] return positive value if exists, otherwise -1.
|
|
250
260
|
def method_reference_count(_opts = {})
|
|
251
|
-
result = run_command(__method__)
|
|
261
|
+
result = run_command(apkanalyzer_command, __method__)
|
|
252
262
|
result || -1
|
|
253
263
|
end
|
|
254
264
|
|
|
@@ -256,27 +266,48 @@ module Danger
|
|
|
256
266
|
#
|
|
257
267
|
# @return [Fixnum] return positive value if exists, otherwise -1.
|
|
258
268
|
def dex_count(_opts = {})
|
|
259
|
-
result = run_command(__method__)
|
|
269
|
+
result = run_command(apkanalyzer_command, __method__)
|
|
260
270
|
result || -1
|
|
261
271
|
end
|
|
262
272
|
|
|
263
273
|
private
|
|
264
274
|
|
|
265
|
-
|
|
275
|
+
# @param [Apkstats::Command::Executable] command a wrapper class of a command
|
|
276
|
+
# @param [String] name an attribute name
|
|
277
|
+
def run_command(command, name)
|
|
266
278
|
raise "#{command.command_path} is not found or is not executable" unless command.executable?
|
|
267
279
|
|
|
268
280
|
return command.send(name, apk_filepath)
|
|
269
281
|
rescue StandardError => e
|
|
270
282
|
warn("apkstats failed to execute the command #{name} due to #{e.message}")
|
|
271
283
|
|
|
272
|
-
e
|
|
284
|
+
on_error(e)
|
|
285
|
+
end
|
|
273
286
|
|
|
274
|
-
|
|
287
|
+
def apkanalyzer_command
|
|
288
|
+
return @apkanalyzer_command if defined?(@apkanalyzer_command)
|
|
289
|
+
|
|
290
|
+
command_path = apkanalyzer_path || begin
|
|
291
|
+
android_home = ENV["ANDROID_HOME"]
|
|
292
|
+
|
|
293
|
+
if android_home
|
|
294
|
+
warn("apkstats will not use ANDROID_HOME in further versions because ANDROID_HOME has been officially deprecated.")
|
|
295
|
+
else
|
|
296
|
+
raise Error, "Please specify apkanalyzer_path to execute apkstats"
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
"#{android_home}/tools/bin/apkanalyzer"
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
@apkanalyzer_command = Apkstats::Command::ApkAnalyzer.new(command_path: command_path)
|
|
275
303
|
end
|
|
276
304
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
305
|
+
# @param [StandardError] err a happened error
|
|
306
|
+
# @return [NilClass]
|
|
307
|
+
def on_error(err)
|
|
308
|
+
warn err.message
|
|
309
|
+
err.backtrace&.each { |line| warn line }
|
|
310
|
+
nil
|
|
280
311
|
end
|
|
281
312
|
end
|
|
282
313
|
end
|
data/spec/apkstats_spec.rb
CHANGED
|
@@ -4,22 +4,67 @@ require File.expand_path("spec_helper", __dir__)
|
|
|
4
4
|
|
|
5
5
|
module Danger
|
|
6
6
|
describe Danger::DangerApkstats do
|
|
7
|
+
before do
|
|
8
|
+
ENV.delete("ANDROID_HOME")
|
|
9
|
+
ENV.delete("ANDROID_SDK_ROOT")
|
|
10
|
+
end
|
|
11
|
+
|
|
7
12
|
it "should be a plugin" do
|
|
8
13
|
expect(Danger::DangerApkstats.new(nil)).to be_a Danger::Plugin
|
|
9
14
|
end
|
|
10
15
|
|
|
11
|
-
#
|
|
12
|
-
# You should test your custom attributes and methods here
|
|
13
|
-
#
|
|
14
16
|
describe "with Dangerfile" do
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@my_plugin = @dangerfile.apkstats
|
|
17
|
+
let(:dangerfile) { testing_dangerfile }
|
|
18
|
+
let(:apkstats) { dangerfile.apkstats }
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
# you can then use this, eg. github.pr_author, later in the spec
|
|
20
|
+
before do
|
|
21
21
|
json = File.read(fixture_path + "github_pr.json")
|
|
22
|
-
allow(
|
|
22
|
+
allow(apkstats.github).to receive(:pr_json).and_return(json)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# compatibility
|
|
26
|
+
describe "#command_path=" do
|
|
27
|
+
context "unless command_path is given" do
|
|
28
|
+
it { expect { apkstats.send(:apkanalyzer_command) }.to raise_error(Danger::DangerApkstats::Error) }
|
|
29
|
+
|
|
30
|
+
context "with ANDROID_HOME" do
|
|
31
|
+
before do
|
|
32
|
+
ENV["ANDROID_HOME"] = "dummy"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it { expect(apkstats.send(:apkanalyzer_command)).to be_kind_of(Apkstats::Command::ApkAnalyzer) }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
context "if command_path is given" do
|
|
40
|
+
before do
|
|
41
|
+
apkstats.command_path = "dummy"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it { expect(apkstats.send(:apkanalyzer_command)).to be_kind_of(Apkstats::Command::ApkAnalyzer) }
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe "#apkanalyzer_path=" do
|
|
49
|
+
context "unless analyzer_path is given" do
|
|
50
|
+
it { expect { apkstats.send(:apkanalyzer_command) }.to raise_error(Danger::DangerApkstats::Error) }
|
|
51
|
+
|
|
52
|
+
context "with ANDROID_HOME" do
|
|
53
|
+
before do
|
|
54
|
+
ENV["ANDROID_HOME"] = "dummy"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it { expect(apkstats.send(:apkanalyzer_command)).to be_kind_of(Apkstats::Command::ApkAnalyzer) }
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
context "if analyzer_path is given" do
|
|
62
|
+
before do
|
|
63
|
+
apkstats.apkanalyzer_path = "dummy"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it { expect(apkstats.send(:apkanalyzer_command)).to be_kind_of(Apkstats::Command::ApkAnalyzer) }
|
|
67
|
+
end
|
|
23
68
|
end
|
|
24
69
|
end
|
|
25
70
|
end
|
|
@@ -12,13 +12,12 @@ module Apkstats::Command
|
|
|
12
12
|
let(:apk_other5) { fixture_path + "app-other5.apk" }
|
|
13
13
|
let(:apk_method64k) { fixture_path + "app-method64k.apk" }
|
|
14
14
|
|
|
15
|
-
it "should use
|
|
16
|
-
expect(ApkAnalyzer.new({}).command_path).to eq("#{ENV.fetch('ANDROID_HOME')}/tools/bin/apkanalyzer")
|
|
15
|
+
it "should use command_path" do
|
|
17
16
|
expect(ApkAnalyzer.new(command_path: "/y/z").command_path).to eq("/y/z")
|
|
18
17
|
end
|
|
19
18
|
|
|
20
19
|
context "command" do
|
|
21
|
-
let(:command) { ApkAnalyzer.new(
|
|
20
|
+
let(:command) { ApkAnalyzer.new(command_path: ENV.fetch("APKANALYZER_PATH")) }
|
|
22
21
|
|
|
23
22
|
it "file_size should return apk size" do
|
|
24
23
|
expect(command.file_size(apk_base)).to eq(1_621_248.to_s)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: danger-apkstats
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jumpei Matsuda
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-06-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: danger-plugin-api
|
|
@@ -24,34 +24,20 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '1.0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: bundler
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '1.3'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '1.3'
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
28
|
name: rake
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
44
30
|
requirements:
|
|
45
31
|
- - "~>"
|
|
46
32
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
33
|
+
version: '13.0'
|
|
48
34
|
type: :development
|
|
49
35
|
prerelease: false
|
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
37
|
requirements:
|
|
52
38
|
- - "~>"
|
|
53
39
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
40
|
+
version: '13.0'
|
|
55
41
|
- !ruby/object:Gem::Dependency
|
|
56
42
|
name: rspec
|
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -150,17 +136,17 @@ dependencies:
|
|
|
150
136
|
- - ">="
|
|
151
137
|
- !ruby/object:Gem::Version
|
|
152
138
|
version: '0'
|
|
153
|
-
description: To
|
|
139
|
+
description: To inspect android application file with danger.
|
|
154
140
|
email:
|
|
155
141
|
- jmatsu.drm@gmail.com
|
|
156
142
|
executables: []
|
|
157
143
|
extensions: []
|
|
158
144
|
extra_rdoc_files: []
|
|
159
145
|
files:
|
|
160
|
-
- ".
|
|
146
|
+
- ".circleci/android-sdk-license"
|
|
147
|
+
- ".circleci/config.yml"
|
|
161
148
|
- ".gitignore"
|
|
162
149
|
- ".rubocop.yml"
|
|
163
|
-
- ".travis.yml"
|
|
164
150
|
- Dangerfile.sample
|
|
165
151
|
- Gemfile
|
|
166
152
|
- Gemfile.lock
|
|
@@ -208,8 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
208
194
|
- !ruby/object:Gem::Version
|
|
209
195
|
version: '0'
|
|
210
196
|
requirements: []
|
|
211
|
-
|
|
212
|
-
rubygems_version: 2.4.5
|
|
197
|
+
rubygems_version: 3.1.2
|
|
213
198
|
signing_key:
|
|
214
199
|
specification_version: 4
|
|
215
200
|
summary: This is a danger plugin to inspect android application file.
|
data/.bundle/config
DELETED
data/.travis.yml
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
cache:
|
|
3
|
-
directories:
|
|
4
|
-
- vendor/bundle
|
|
5
|
-
- sdk
|
|
6
|
-
|
|
7
|
-
rvm:
|
|
8
|
-
- 2.3.7
|
|
9
|
-
- 2.4.4
|
|
10
|
-
- 2.5.1
|
|
11
|
-
|
|
12
|
-
script:
|
|
13
|
-
- |
|
|
14
|
-
version='4333796'
|
|
15
|
-
|
|
16
|
-
if [ "$(cat sdk/.sdk_tools_version || echo)" != "$version" ]; then
|
|
17
|
-
rm -fr sdk || :
|
|
18
|
-
mkdir -p sdk/licenses
|
|
19
|
-
curl -o sdk-tools-linux.zip "https://dl.google.com/android/repository/sdk-tools-linux-$version.zip"
|
|
20
|
-
unzip "sdk-tools-linux.zip" -d sdk
|
|
21
|
-
fi
|
|
22
|
-
|
|
23
|
-
echo "d56f5187479451eabf01fb78af6dfcb131a6481e" > sdk/licenses/android-sdk-license
|
|
24
|
-
sdk/tools/bin/sdkmanager "build-tools;27.0.3"
|
|
25
|
-
- ANDROID_HOME="$PWD/sdk" bundle exec rake spec
|