fastlane-plugin-appicon 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/appicon.rb +1 -1
- data/lib/fastlane/plugin/appicon/actions/android_appicon_action.rb +13 -16
- data/lib/fastlane/plugin/appicon/actions/appicon_action.rb +19 -20
- data/lib/fastlane/plugin/appicon/helper/appicon_helper.rb +35 -0
- data/lib/fastlane/plugin/appicon/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9ea554d75a2c7d5d1d2dce585ba23d52b166756
|
4
|
+
data.tar.gz: 6e8971f28291224730c19ea9d460a4257e15f5b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15f8271515484214a574753a08611d21c5c11ce4554abd7276768bb29894039453945eba33e7232b97a3a3ef603bf37392226b8ebec2ac23f7847b729a1f1d4e
|
7
|
+
data.tar.gz: 1cb9392d6e07cd8652666094bbe9023f54e0ca7351413555397e39a8720b5cc920e72f8434e116a2ba87d227ab81c7727a6e533c9db04f5656a292ac15b41da0
|
@@ -4,7 +4,7 @@ module Fastlane
|
|
4
4
|
module Appicon
|
5
5
|
# Return all .rb files inside the "actions" directory
|
6
6
|
def self.all_classes
|
7
|
-
Dir[File.expand_path('**/{actions}/*.rb', File.dirname(__FILE__))]
|
7
|
+
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -22,25 +22,22 @@ module Fastlane
|
|
22
22
|
require 'mini_magick'
|
23
23
|
image = MiniMagick::Image.open(fname)
|
24
24
|
|
25
|
-
|
26
|
-
UI.user_error!("Minimum height of input image should be 512") if image.height < 512
|
27
|
-
UI.user_error!("Input image should be square") if image.width != image.height
|
25
|
+
Helper::AppiconHelper.check_input_image_size(image, 512)
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
sizes.each do |size|
|
32
|
-
width, height = size.split('x').map { |v| v.to_f }
|
27
|
+
# Convert image to png
|
28
|
+
image.format 'png'
|
33
29
|
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
icons = Helper::AppiconHelper.get_needed_icons(params[:appicon_devices], self.needed_icons, true)
|
31
|
+
icons.each do |icon|
|
32
|
+
width = icon['width']
|
33
|
+
height = icon['height']
|
37
34
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
basepath = Pathname.new("#{params[:appicon_path]}-#{icon['scale']}")
|
36
|
+
FileUtils.mkdir_p(basepath)
|
37
|
+
filename = "#{params[:appicon_filename]}.png"
|
38
|
+
|
39
|
+
image.resize "#{width}x#{height}"
|
40
|
+
image.write basepath + filename
|
44
41
|
end
|
45
42
|
|
46
43
|
UI.success("Successfully stored launcher icons at '#{params[:appicon_path]}'")
|
@@ -22,33 +22,32 @@ module Fastlane
|
|
22
22
|
require 'mini_magick'
|
23
23
|
image = MiniMagick::Image.open(fname)
|
24
24
|
|
25
|
-
|
26
|
-
UI.user_error!("Minimum height of input image should be 1024") if image.height < 1024
|
27
|
-
UI.user_error!("Input image should be square") if image.width != image.height
|
25
|
+
Helper::AppiconHelper.check_input_image_size(image, 1024)
|
28
26
|
|
27
|
+
# Convert image to png
|
28
|
+
image.format 'png'
|
29
|
+
|
30
|
+
# Create the base path
|
29
31
|
FileUtils.mkdir_p(basepath)
|
30
32
|
|
31
33
|
images = []
|
32
34
|
|
33
|
-
params[:appicon_devices].
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
icons = Helper::AppiconHelper.get_needed_icons(params[:appicon_devices], self.needed_icons, false)
|
36
|
+
icons.each do |icon|
|
37
|
+
width = icon['width']
|
38
|
+
height = icon['height']
|
39
|
+
filename = "#{basename}-#{width.to_i}x#{height.to_i}.png"
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
image.write basepath + filename
|
41
|
+
# downsize icon
|
42
|
+
image.resize "#{width}x#{height}"
|
43
|
+
image.write basepath + filename
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
45
|
+
images << {
|
46
|
+
'size' => icon['size'],
|
47
|
+
'idiom' => icon['device'],
|
48
|
+
'filename' => filename,
|
49
|
+
'scale' => icon['scale']
|
50
|
+
}
|
52
51
|
end
|
53
52
|
|
54
53
|
contents = {
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Helper
|
3
|
+
class AppiconHelper
|
4
|
+
def self.check_input_image_size(image, size)
|
5
|
+
UI.user_error!("Minimum width of input image should be #{size}") if image.width < size
|
6
|
+
UI.user_error!("Minimum height of input image should be #{size}") if image.height < size
|
7
|
+
UI.user_error!("Input image should be square") if image.width != image.height
|
8
|
+
end
|
9
|
+
def self.get_needed_icons(devices, needed_icons, is_android = false)
|
10
|
+
icons = []
|
11
|
+
devices.each do |device|
|
12
|
+
needed_icons[device].each do |scale, sizes|
|
13
|
+
sizes.each do |size|
|
14
|
+
if is_android
|
15
|
+
width, height = size.split('x').map { |v| v.to_f }
|
16
|
+
else
|
17
|
+
width, height = size.split('x').map { |v| v.to_f * scale.to_i }
|
18
|
+
end
|
19
|
+
|
20
|
+
icons << {
|
21
|
+
'width' => width,
|
22
|
+
'height' => height,
|
23
|
+
'size' => size,
|
24
|
+
'device' => device,
|
25
|
+
'scale' => scale
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
# Sort from the largest to the smallest needed icon
|
31
|
+
icons = icons.sort_by {|value| value['width']} .reverse
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-appicon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Bügling
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_magick
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- lib/fastlane/plugin/appicon.rb
|
134
134
|
- lib/fastlane/plugin/appicon/actions/android_appicon_action.rb
|
135
135
|
- lib/fastlane/plugin/appicon/actions/appicon_action.rb
|
136
|
+
- lib/fastlane/plugin/appicon/helper/appicon_helper.rb
|
136
137
|
- lib/fastlane/plugin/appicon/version.rb
|
137
138
|
homepage: https://github.com/neonichu/fastlane-plugin-appicon
|
138
139
|
licenses:
|
@@ -154,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
155
|
version: '0'
|
155
156
|
requirements: []
|
156
157
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.6.
|
158
|
+
rubygems_version: 2.6.8
|
158
159
|
signing_key:
|
159
160
|
specification_version: 4
|
160
161
|
summary: Generate required icon sizes and iconset from a master application icon.
|