appiconset 2.3.0 → 2.4.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: 16b9b06d04e6b8eb8f913c15624877438471e47de476c412c802b591b8e208a8
4
- data.tar.gz: a321a318090c7408277a017112c4a9bc52a8fea7b05ef85eb9664890bedf7710
3
+ metadata.gz: 31edc704c52144a5eefe2339052935d3d2e8ad7c4dc062c6f09c162a963e7c43
4
+ data.tar.gz: 2d17094adebf34d345320a4144677a6bbb4c482b3c4e41f97f79c2f042008b04
5
5
  SHA512:
6
- metadata.gz: 83a41586042832889063e5e448ee0066a2ec070a3f6ce132776d949828880db6cd276b13c08cd5cbbcce2302b75a91f2271c5682f3e3469da6b39a1434a018dd
7
- data.tar.gz: 25494f65f26f2705386e2eb2ff4f29406a19b12ffd292f2aeac3bf88c76284e44cac3a7c994024d51e2a1ee7c855f8aff960331cec0ec01664fdeaed905ac60b
6
+ metadata.gz: 5d0fdd192a4fa0a39eb6b0394801193c370332f945d532b0ada368f6761ae87a6749902b91cd71b39a3a28334f66cf351d5cd9646976172a3f0d257b1f87c69c
7
+ data.tar.gz: e7392ae02c798e4f7a7f96d5891601db597e7a8ba1970a3f21d8402b5bce0fd6ed089928500057a6cd4c7e89f9da118f9bee37f23a4deb79f79f6ff7890dac2b
data/.rubocop_todo.yml CHANGED
@@ -9,7 +9,7 @@
9
9
  # Offense count: 3
10
10
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
11
11
  Metrics/AbcSize:
12
- Max: 32
12
+ Max: 40
13
13
 
14
14
  # Offense count: 1
15
15
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
@@ -20,7 +20,7 @@ Metrics/BlockLength:
20
20
  # Offense count: 1
21
21
  # Configuration parameters: CountComments, CountAsOne.
22
22
  Metrics/ClassLength:
23
- Max: 102
23
+ Max: 120
24
24
 
25
25
  # Offense count: 1
26
26
  # Configuration parameters: AllowedMethods, AllowedPatterns.
@@ -30,4 +30,4 @@ Metrics/CyclomaticComplexity:
30
30
  # Offense count: 3
31
31
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
32
32
  Metrics/MethodLength:
33
- Max: 38
33
+ Max: 64
data/README.base.md CHANGED
@@ -26,12 +26,10 @@
26
26
 
27
27
  # ガイド
28
28
 
29
- ## 正方形アイコン
30
-
31
- 1024px x 1024px の画像からアプリアイコンを作成します。
29
+ 正方形アイコンを生成するには、1024px x 1024px の画像からアプリアイコンを作成します。
32
30
 
33
31
  ```
34
- $ appiconset square -i='sample.jpg' -o='output'
32
+ $ appiconset g -i='sample.jpg' -o='output'
35
33
  ```
36
34
 
37
35
  Contents.jsonと複数のpngファイルが作成されます。
@@ -51,7 +49,7 @@ tvOSアプリ向けのアイコンを作成するには。4640px x 1440px の画
51
49
  | tv-top-shelf-wide | 4640x1440 |![tv-top-shelf-wide](sample/tv-top-shelf-wide/Icon@2x.png) |
52
50
 
53
51
  ```
54
- $ appiconset tvos -i='sample.jpg' -o='output'
52
+ $ appiconset g -i='sample.jpg' -o='output'
55
53
  ```
56
54
 
57
55
  ## 任意のサイズのアイコン
@@ -59,7 +57,7 @@ $ appiconset tvos -i='sample.jpg' -o='output'
59
57
  任意のサイズの画像から、1倍、2/3倍、1/3倍のアイコンを作成します。
60
58
 
61
59
  ```
62
- $ appiconset universal -i='sample.jpg' -o='output'
60
+ $ appiconset g -i='sample.jpg' -o='output'
63
61
  ```
64
62
 
65
63
  <!-- [en] -->
@@ -88,7 +86,7 @@ Icon creation is supported for the following platforms.
88
86
  Create an app icon from a 1024px x 1024px image.
89
87
 
90
88
  ```
91
- $ appiconset square -i='sample.jpg' -o='output'
89
+ $ appiconset g -i='sample.jpg' -o='output'
92
90
  ```
93
91
 
94
92
  A Contents.json and several png files will be created.
@@ -108,7 +106,7 @@ The input image is the same as tv-top-shelf-wide, tv-top-shelf is the image from
108
106
  | tv-top-shelf-wide | 4640x1440 |![tv-top-shelf-wide](sample/tv-top-shelf-wide/Icon@2x.png) |
109
107
 
110
108
  ```
111
- $ appiconset tvos -i='sample.jpg' -o='output'
109
+ $ appiconset g -i='sample.jpg' -o='output'
112
110
  ```
113
111
 
114
112
  ## Icons of any size
@@ -116,5 +114,5 @@ $ appiconset tvos -i='sample.jpg' -o='output'
116
114
  Create 1x, 2/3x, and 1/3x icons from any size image.
117
115
 
118
116
  ```
119
- $ appiconset universal -i='sample.jpg' -o='output'
117
+ $ appiconset g -i='sample.jpg' -o='output'
120
118
  ```
data/README.ja.md CHANGED
@@ -20,12 +20,10 @@
20
20
 
21
21
  # ガイド
22
22
 
23
- ## 正方形アイコン
24
-
25
- 1024px x 1024px の画像からアプリアイコンを作成します。
23
+ 正方形アイコンを生成するには、1024px x 1024px の画像からアプリアイコンを作成します。
26
24
 
27
25
  ```
28
- $ appiconset square -i='sample.jpg' -o='output'
26
+ $ appiconset g -i='sample.jpg' -o='output'
29
27
  ```
30
28
 
31
29
  Contents.jsonと複数のpngファイルが作成されます。
@@ -45,7 +43,7 @@ tvOSアプリ向けのアイコンを作成するには。4640px x 1440px の画
45
43
  | tv-top-shelf-wide | 4640x1440 |![tv-top-shelf-wide](sample/tv-top-shelf-wide/Icon@2x.png) |
46
44
 
47
45
  ```
48
- $ appiconset tvos -i='sample.jpg' -o='output'
46
+ $ appiconset g -i='sample.jpg' -o='output'
49
47
  ```
50
48
 
51
49
  ## 任意のサイズのアイコン
@@ -53,5 +51,5 @@ $ appiconset tvos -i='sample.jpg' -o='output'
53
51
  任意のサイズの画像から、1倍、2/3倍、1/3倍のアイコンを作成します。
54
52
 
55
53
  ```
56
- $ appiconset universal -i='sample.jpg' -o='output'
54
+ $ appiconset g -i='sample.jpg' -o='output'
57
55
  ```
data/README.md CHANGED
@@ -25,7 +25,7 @@ Icon creation is supported for the following platforms.
25
25
  Create an app icon from a 1024px x 1024px image.
26
26
 
27
27
  ```
28
- $ appiconset square -i='sample.jpg' -o='output'
28
+ $ appiconset g -i='sample.jpg' -o='output'
29
29
  ```
30
30
 
31
31
  A Contents.json and several png files will be created.
@@ -45,7 +45,7 @@ The input image is the same as tv-top-shelf-wide, tv-top-shelf is the image from
45
45
  | tv-top-shelf-wide | 4640x1440 |![tv-top-shelf-wide](sample/tv-top-shelf-wide/Icon@2x.png) |
46
46
 
47
47
  ```
48
- $ appiconset tvos -i='sample.jpg' -o='output'
48
+ $ appiconset g -i='sample.jpg' -o='output'
49
49
  ```
50
50
 
51
51
  ## Icons of any size
@@ -53,5 +53,5 @@ $ appiconset tvos -i='sample.jpg' -o='output'
53
53
  Create 1x, 2/3x, and 1/3x icons from any size image.
54
54
 
55
55
  ```
56
- $ appiconset universal -i='sample.jpg' -o='output'
56
+ $ appiconset g -i='sample.jpg' -o='output'
57
57
  ```
@@ -17,44 +17,16 @@ module Appiconset
17
17
  puts(Appiconset::VERSION)
18
18
  end
19
19
 
20
- desc 'square', 'Create icons from a square image'
21
- method_option :input, desc: 'Input image(1024px x 1024px)', aliases: '-i'
20
+ desc 'g', 'Create icons from any size image'
21
+ method_option :input, desc: 'Input image', aliases: '-i'
22
22
  method_option :output, desc: 'Write output to <dir>', aliases: '-o'
23
- def square
23
+ def generator
24
24
  generator = Appiconset::Generator.new
25
25
 
26
26
  begin
27
27
  generator.config(options[:input].to_s, options[:output].to_s)
28
28
  generator.square_platforms
29
- rescue StandardError => e
30
- warn e.message
31
- exit(1)
32
- end
33
- end
34
-
35
- desc 'tvos', 'Create tvOS icons'
36
- method_option :input, desc: 'Input image(4640px x 1440px)', aliases: '-i'
37
- method_option :output, desc: 'Write output to <dir>', aliases: '-o'
38
- def tvos
39
- generator = Appiconset::Generator.new
40
-
41
- begin
42
- generator.config(options[:input].to_s, options[:output].to_s, 4640, 1440)
43
29
  generator.tvos_platforms
44
- rescue StandardError => e
45
- warn e.message
46
- exit(1)
47
- end
48
- end
49
-
50
- desc 'icons', 'Create Universal icons'
51
- method_option :input, desc: 'Input any size image', aliases: '-i'
52
- method_option :output, desc: 'Write output to <dir>', aliases: '-o'
53
- def icons
54
- generator = Appiconset::Generator.new
55
-
56
- begin
57
- generator.config(options[:input].to_s, options[:output].to_s, 0, 0)
58
30
  generator.universal_platforms
59
31
  rescue StandardError => e
60
32
  warn e.message
@@ -9,11 +9,15 @@ module Appiconset
9
9
  class Generator
10
10
  def initialize; end
11
11
 
12
- def config(input, output, width = 1024, height = 1024)
12
+ def config(input, output)
13
13
  raise 'no input file.' unless File.exist?(input)
14
+ raise 'no output <dir>.' if output == ''
14
15
 
15
16
  size = FastImage.size(input)
16
- raise 'unsupported size.' if width != 0 && height != 0 && (size[0].to_i != width || size[1].to_i != height)
17
+ raise 'Unsupported file.' if size.nil?
18
+
19
+ @width = size[0]
20
+ @height = size[1]
17
21
 
18
22
  output += '/' unless output.end_with?('/')
19
23
 
@@ -25,6 +29,10 @@ module Appiconset
25
29
 
26
30
  # 正方形アイコン
27
31
  def square_platforms
32
+ return unless @width == 1024 && @height == 1024
33
+
34
+ show_info('square')
35
+
28
36
  json_dir = "#{__dir__}/settings/*.json"
29
37
 
30
38
  Dir.glob(json_dir).each do |path|
@@ -62,15 +70,15 @@ module Appiconset
62
70
 
63
71
  # ユニバーサルアイコン
64
72
  def universal_platforms
65
- size = FastImage.size(@input)
73
+ show_info('universal')
74
+
66
75
  platforms = [
67
76
  {
68
77
  name: 'universal',
69
78
  contents: [
70
- { width: size[0], height: size[1], scale: 3 },
71
- { width: size[0] / 3 * 2, height: size[1] / 3 * 2, scale: 2 },
72
- { width: size[0] / 3, height: size[1] / 3, scale: 1 }
73
-
79
+ { width: @width, height: @height, scale: 3 },
80
+ { width: @width / 3 * 2, height: @height / 3 * 2, scale: 2 },
81
+ { width: @width / 3, height: @height / 3, scale: 1 }
74
82
  ]
75
83
  }
76
84
  ]
@@ -95,9 +103,13 @@ module Appiconset
95
103
  end
96
104
 
97
105
  # tvOSアイコン
106
+ # Input 4640x1440
107
+ # Output 2400x1440, 3840x1440, 4640x1440
98
108
  def tvos_platforms
99
- # Input 4640x1440
100
- # Output 2400x1440, 3840x1440, 4640x1440
109
+ return unless @width == 4640 && @height == 1440
110
+
111
+ show_info('tvOS')
112
+
101
113
  platforms = [
102
114
  {
103
115
  name: 'tv',
@@ -141,5 +153,9 @@ module Appiconset
141
153
  end
142
154
  end
143
155
  end
156
+
157
+ def show_info(platform_name)
158
+ puts "Created #{platform_name} icons from #{@width} x #{@height} image."
159
+ end
144
160
  end
145
161
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appiconset
4
- VERSION = '2.3.0'
4
+ VERSION = '2.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appiconset
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - arthur87
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-05 00:00:00.000000000 Z
11
+ date: 2025-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop