appiconset 2.4.0 → 2.5.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: 31edc704c52144a5eefe2339052935d3d2e8ad7c4dc062c6f09c162a963e7c43
4
- data.tar.gz: 2d17094adebf34d345320a4144677a6bbb4c482b3c4e41f97f79c2f042008b04
3
+ metadata.gz: 2a7767388959af2163784bee32c1a70fc845eef093882f4fb26911fada88ef15
4
+ data.tar.gz: c2f1a80e9ea7a5d30928b3d157e1964eed726f26b2f7cb49b4c5dfc50637b856
5
5
  SHA512:
6
- metadata.gz: 5d0fdd192a4fa0a39eb6b0394801193c370332f945d532b0ada368f6761ae87a6749902b91cd71b39a3a28334f66cf351d5cd9646976172a3f0d257b1f87c69c
7
- data.tar.gz: e7392ae02c798e4f7a7f96d5891601db597e7a8ba1970a3f21d8402b5bce0fd6ed089928500057a6cd4c7e89f9da118f9bee37f23a4deb79f79f6ff7890dac2b
6
+ metadata.gz: 8b82c5fe7f7b5d61fadfb49a1126f0a1ab07bc4fb823803c1ce7f2ab513d437512ed97fff395d1b834fed33e493c8e968319bb3e3326e6df732822f7b26fb88a
7
+ data.tar.gz: 3e2f7a7443b136f3e3d7f5a14d268475c395eb5e7d6590e11ddb66e7c0ffc1ddac85e96d0b4b7e87799cdad4fb0a58674daedbf9e3e61a21fc638ae5167dd735
data/.rubocop_todo.yml CHANGED
@@ -20,7 +20,7 @@ Metrics/BlockLength:
20
20
  # Offense count: 1
21
21
  # Configuration parameters: CountComments, CountAsOne.
22
22
  Metrics/ClassLength:
23
- Max: 120
23
+ Max: 140
24
24
 
25
25
  # Offense count: 1
26
26
  # Configuration parameters: AllowedMethods, AllowedPatterns.
data/README.base.md CHANGED
@@ -23,9 +23,12 @@
23
23
  * watchOS
24
24
  * Android
25
25
  * tvOS
26
+ * icns.iconset
27
+ * icns(macOS only)
26
28
 
27
29
  # ガイド
28
30
 
31
+ ## 正方形アイコン
29
32
  正方形アイコンを生成するには、1024px x 1024px の画像からアプリアイコンを作成します。
30
33
 
31
34
  ```
@@ -78,6 +81,8 @@ Icon creation is supported for the following platforms.
78
81
  * watchOS
79
82
  * Android
80
83
  * tvOS
84
+ * icns.iconset
85
+ * icns(macOS only)
81
86
 
82
87
  # Guide
83
88
 
data/README.ja.md CHANGED
@@ -17,9 +17,12 @@
17
17
  * watchOS
18
18
  * Android
19
19
  * tvOS
20
+ * icns.iconset
21
+ * icns(macOS only)
20
22
 
21
23
  # ガイド
22
24
 
25
+ ## 正方形アイコン
23
26
  正方形アイコンを生成するには、1024px x 1024px の画像からアプリアイコンを作成します。
24
27
 
25
28
  ```
data/README.md CHANGED
@@ -17,6 +17,8 @@ Icon creation is supported for the following platforms.
17
17
  * watchOS
18
18
  * Android
19
19
  * tvOS
20
+ * icns.iconset
21
+ * icns(macOS only)
20
22
 
21
23
  # Guide
22
24
 
@@ -28,6 +28,7 @@ module Appiconset
28
28
  generator.square_platforms
29
29
  generator.tvos_platforms
30
30
  generator.universal_platforms
31
+ generator.icns_platforms
31
32
  rescue StandardError => e
32
33
  warn e.message
33
34
  exit(1)
@@ -154,8 +154,42 @@ module Appiconset
154
154
  end
155
155
  end
156
156
 
157
+ # icnsアイコン
158
+ def icns_platforms
159
+ return unless @width == 1024 && @height == 1024
160
+
161
+ show_info('icns.iconset')
162
+
163
+ output_dir = "#{@output}icns.iconset/"
164
+ FileUtils.mkdir_p(output_dir)
165
+
166
+ sizes = [512, 256, 128, 64, 32, 16]
167
+ sizes.each do |size|
168
+ [2, 1].each do |scale|
169
+ if scale == 2
170
+ name = "icon_#{size}x#{size}@2x.png"
171
+ new_size = size * scale
172
+ else
173
+ name = "icon_#{size}x#{size}.png"
174
+ new_size = size
175
+ end
176
+
177
+ image = Magick::ImageList.new(@input)
178
+ new_image = image.resize_to_fit(new_size, new_size)
179
+ new_image.format = 'PNG'
180
+ new_image.write(output_dir + name)
181
+ end
182
+ end
183
+
184
+ return unless RUBY_PLATFORM.match(/darwin/)
185
+
186
+ # macOSで実行可能
187
+ show_info('icns')
188
+ system("iconutil -c icns #{output_dir}")
189
+ end
190
+
157
191
  def show_info(platform_name)
158
- puts "Created #{platform_name} icons from #{@width} x #{@height} image."
192
+ puts "Created #{platform_name} icon(s) from #{@width} x #{@height} image."
159
193
  end
160
194
  end
161
195
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appiconset
4
- VERSION = '2.4.0'
4
+ VERSION = '2.5.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appiconset
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - arthur87