headdesk 0.8.0 → 0.9.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 +4 -4
- data/Gemfile.lock +5 -1
- data/docs/teak/api21_icon.md +13 -0
- data/headdesk.gemspec +1 -0
- data/lib/headdesk/apk/resources.rb +8 -0
- data/lib/headdesk/apk.rb +2 -1
- data/lib/headdesk/checks/teak/api21_icon.rb +14 -1
- data/lib/headdesk/descriptionator/resources.rb +17 -0
- data/lib/headdesk/descriptionator.rb +6 -0
- data/lib/headdesk/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e812c6195d207316fbcb2e365a7ad4828d12667586ffec08c40d9a61f0c92714
|
4
|
+
data.tar.gz: 817934245dfea92c9b7b05f961272c9286031d18e9861170fe042ca39d5e50ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74b4a8e37fa5a3003158611c50cf66687af8f6444c945524beec638baebb2f2e1a1779b61b4602a6325cf6ce31a1d9346e72665cbf6d87a6a725ac3ae9682c70
|
7
|
+
data.tar.gz: 4a9e4b8a17c9fe03e9aa98d9b2a0cba3f3dd67a80157ee153e85256a9e5f8ff91688801c845d86e01ccc85900705c056fb1166711e18da6b36e44ab8e1580b22
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
headdesk (0.
|
4
|
+
headdesk (0.9.0)
|
5
5
|
awesome_print (~> 1.8)
|
6
6
|
nokogiri (~> 1.10)
|
7
|
+
oily_png (~> 1.2)
|
7
8
|
thor (~> 0.20)
|
8
9
|
|
9
10
|
GEM
|
@@ -15,6 +16,7 @@ GEM
|
|
15
16
|
descendants_tracker (~> 0.0.4)
|
16
17
|
ice_nine (~> 0.11.0)
|
17
18
|
thread_safe (~> 0.3, >= 0.3.1)
|
19
|
+
chunky_png (1.3.11)
|
18
20
|
codeclimate-engine-rb (0.4.1)
|
19
21
|
virtus (~> 1.0)
|
20
22
|
coercible (1.0.0)
|
@@ -29,6 +31,8 @@ GEM
|
|
29
31
|
mini_portile2 (2.4.0)
|
30
32
|
nokogiri (1.10.1)
|
31
33
|
mini_portile2 (~> 2.4.0)
|
34
|
+
oily_png (1.2.1)
|
35
|
+
chunky_png (~> 1.3.7)
|
32
36
|
parallel (1.12.1)
|
33
37
|
parser (2.5.3.0)
|
34
38
|
ast (~> 2.4.0)
|
data/docs/teak/api21_icon.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# teak/api21_icon
|
2
2
|
Ensures that the APK contains a notification icon for both Android 5+ (API 21+) as well as pre-Android 5, and that these are different icons.
|
3
3
|
|
4
|
+
Also verifies following files have the specified image dimensions:
|
5
|
+
* drawable-mdpi/[icon_v21].png 24x24
|
6
|
+
* drawable-hdpi/[icon_v21].png 36x36
|
7
|
+
* drawable-xhdpi/[icon_v21].png 48x48
|
8
|
+
* drawable-xxhdpi/[icon_v21].png 72x72
|
9
|
+
* drawable-xxxhdpi/[icon_v21].png 96x96
|
10
|
+
|
4
11
|
## Will Skip If
|
5
12
|
* The Teak SDK is not present.
|
6
13
|
|
@@ -8,6 +15,12 @@ Ensures that the APK contains a notification icon for both Android 5+ (API 21+)
|
|
8
15
|
* There is no drawable resource for `io_teak_small_notification_icon`.
|
9
16
|
* There is no v21 drawable resource for `io_teak_small_notification_icon`
|
10
17
|
* The drawable resources point to the same image.
|
18
|
+
* The v21 drawable resources do not exist, or are the incorrect size
|
19
|
+
* `drawable-mdpi/[icon_v21].png` does not exist, or is not 24x24
|
20
|
+
* `drawable-hdpi/[icon_v21].png` does not exist, or is not 36x36
|
21
|
+
* `drawable-xhdpi/[icon_v21].png` does not exist, or is not 48x48
|
22
|
+
* `drawable-xxhdpi/[icon_v21].png` does not exist, or is not 72x72
|
23
|
+
* `drawable-xxxhdpi/[icon_v21].png` does not exist, or is not 96x96
|
11
24
|
|
12
25
|
## Exports
|
13
26
|
The values for `io_teak_small_notification_icon` for less than v21, and v21+.
|
data/headdesk.gemspec
CHANGED
@@ -16,6 +16,14 @@ module Headdesk
|
|
16
16
|
XmlCollection.new(@path, 'values', modifiers)
|
17
17
|
end
|
18
18
|
|
19
|
+
def file?(file_name)
|
20
|
+
File.exist? path_for(file_name)
|
21
|
+
end
|
22
|
+
|
23
|
+
def path_for(file_name)
|
24
|
+
"#{@path}/#{file_name.sub(%r{^\/}, '')}"
|
25
|
+
end
|
26
|
+
|
19
27
|
#
|
20
28
|
# Collection of XML values for specific locale/api/etc
|
21
29
|
#
|
data/lib/headdesk/apk.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'oily_png'
|
4
|
+
|
3
5
|
module Headdesk
|
4
6
|
module Checks
|
5
7
|
module Teak
|
@@ -24,10 +26,21 @@ module Headdesk
|
|
24
26
|
export icon: icon, icon_v21: icon_v21
|
25
27
|
|
26
28
|
describe "APK contains a drawable for 'io_teak_small_notification_icon'"
|
27
|
-
fail_check
|
29
|
+
fail_check if: -> { icon.nil? || icon_v21.nil? }
|
28
30
|
|
29
31
|
describe "'io_teak_small_notification_icon' for v21 is different from < v21"
|
30
32
|
fail_check unless: -> { icon != icon_v21 }
|
33
|
+
|
34
|
+
resolutions = [['drawable-mdpi', 24], ['drawable-hdpi', 36], ['drawable-xhdpi', 48],
|
35
|
+
['drawable-xxhdpi', 72], ['drawable-xxxhdpi', 96]]
|
36
|
+
resolutions.each do |rname, size|
|
37
|
+
resource_file = icon_v21.sub('@drawable', "res/#{rname}") + '.png'
|
38
|
+
fail_check unless: -> { apk.resources.file?(resource_file) }
|
39
|
+
|
40
|
+
describe "'#{resource_file}' is #{size}x#{size}"
|
41
|
+
image = ChunkyPNG::Image.from_file(apk.resources.path_for(resource_file))
|
42
|
+
fail_check unless: -> { size == image.width && size == image.height }
|
43
|
+
end
|
31
44
|
end
|
32
45
|
end
|
33
46
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Headdesk
|
4
|
+
#
|
5
|
+
# Descriptions for APK methods
|
6
|
+
#
|
7
|
+
# :reek:RepeatedConditional
|
8
|
+
class APKResourcesDescriber
|
9
|
+
def initialize(mode_unless)
|
10
|
+
@unless = mode_unless
|
11
|
+
end
|
12
|
+
|
13
|
+
def file?(file_name)
|
14
|
+
"APK #{@unless ? 'contains' : 'does not contain'} resource file '#{file_name}'"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'headdesk/descriptionator/resources'
|
4
|
+
|
3
5
|
module Headdesk
|
4
6
|
#
|
5
7
|
# Descriptions for APK methods
|
@@ -21,6 +23,10 @@ module Headdesk
|
|
21
23
|
def min_sdk(gt_eq)
|
22
24
|
"APK requires #{@unless ? 'at least' : 'less than'} API #{gt_eq}"
|
23
25
|
end
|
26
|
+
|
27
|
+
def resources
|
28
|
+
@resources ||= APKResourcesDescriber.new(@unless)
|
29
|
+
end
|
24
30
|
end
|
25
31
|
|
26
32
|
#
|
data/lib/headdesk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: headdesk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.10'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: oily_png
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.2'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.2'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: thor
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,6 +170,7 @@ files:
|
|
156
170
|
- lib/headdesk/cli.rb
|
157
171
|
- lib/headdesk/data/facebook_sdk_versions.yaml
|
158
172
|
- lib/headdesk/descriptionator.rb
|
173
|
+
- lib/headdesk/descriptionator/resources.rb
|
159
174
|
- lib/headdesk/report.rb
|
160
175
|
- lib/headdesk/version.rb
|
161
176
|
homepage: https://github.com/GoCarrot/headdesk
|