makeicon 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: d578c21762b7232d31475a85d1ef2503f47671cf
4
- data.tar.gz: 7e715b1e66b328b5b794770e91bf88873a0ca0e2
3
+ metadata.gz: 1be1286b0f0d383514b8e5cd1d862a397015c2f6
4
+ data.tar.gz: 0d29691cd9bb44be8ad5994a2a65af996e080a7b
5
5
  SHA512:
6
- metadata.gz: 510439a9bbbeb019dfb31088fe61c88c67898a33ff85081b770b26ec83efc3a4ba580ff2bda58ed6173b19c6da4ba83b91acdfc11fd4915ead9fd84b32c8f09e
7
- data.tar.gz: 95e00da0afc8c78bf1b57e23f73b9ce8bb8a86c1b7595d2891ae36b09c28cf232029c257645ef41bb4d1be5291bee75a689763db6a2b6c3ddd5be28d9a3c7392
6
+ metadata.gz: bae1c17dc6ffa0e1d7a6af2ae924697522feffa3514b57c2fa26df360bf13d6836ab89702ad273e03f7329d411c18e376808ab6954e16694d932233ba2e2a132
7
+ data.tar.gz: d1466b86d34d335094b82c849838c92664992d96b9ab4dd6f4576144d663e80cfbc8beec5f77a26ad2c0fca060d9142fbd80c3085a295dd64c7242fa35ed5eea
data/bin/makeicon CHANGED
@@ -1,209 +1,3 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'commander'
5
-
6
- module MakeIcon
7
- module Helper
8
- class AppiconHelper
9
- def self.check_input_image_size(image, size)
10
- puts "Minimum width of input image should be #{size}" if image.width < size
11
- puts "Minimum height of input image should be #{size}" if image.height < size
12
- puts "Input image should be square" if image.width != image.height
13
- # UI.user_error!("Minimum width of input image should be #{size}") if image.width < size
14
- # UI.user_error!("Minimum height of input image should be #{size}") if image.height < size
15
- # UI.user_error!("Input image should be square") if image.width != image.height
16
- end
17
- end
18
- end
19
-
20
- class SocialAction
21
- def self.get_needed_icons(device, needed_icons, is_android = false, custom_sizes = {})
22
- icons = []
23
- puts device
24
- needed_icons[device].each do |scale, sizes|
25
- sizes.each do |size|
26
- if size.kind_of?(Array)
27
- size, role, subtype = size
28
- end
29
-
30
- if is_android
31
- width, height = size.split('x').map { |v| v.to_f }
32
- else
33
- width, height = size.split('x').map { |v| v.to_f * scale.to_i }
34
- end
35
-
36
- icons << {
37
- 'width' => width,
38
- 'height' => height,
39
- 'size' => size,
40
- 'device' => device.to_s.gsub('_', '-'),
41
- 'scale' => scale,
42
- 'role' => role,
43
- 'subtype' => subtype
44
- }
45
- end
46
- end
47
-
48
- # Add custom icon sizes (probably for notifications)
49
- custom_sizes.each do |path, size|
50
- path = path.to_s
51
- width, height = size.split('x').map { |v| v.to_f }
52
-
53
- icons << {
54
- 'width' => width,
55
- 'height' => height,
56
- 'size' => size,
57
- 'basepath' => File.dirname(path),
58
- 'filename' => File.basename(path)
59
- }
60
- end
61
-
62
- # Sort from the largest to the smallest needed icon
63
- icons = icons.sort_by {|value| value['width']} .reverse
64
- end
65
-
66
- def self.needed_icons
67
- {
68
- social: {
69
- 'weixin' => ['28x28','108x108'],
70
- 'weibo' => ['16x16','80x80','120x120'],
71
- 'qq' => ['16x16','512x512'],
72
- },
73
- }
74
- end
75
-
76
- def self.notification_icons(path, filename)
77
- return {} if !path || !filename
78
-
79
- {
80
- "#{path}-ldpi/#{filename}" => '36x36',
81
- "#{path}-mdpi/#{filename}" => '24x24',
82
- "#{path}-hdpi/#{filename}" => '36x36',
83
- "#{path}-xhdpi/#{filename}" => '48x48',
84
- "#{path}-xxhdpi/#{filename}" => '72x72',
85
- "#{path}-xxxhdpi/#{filename}" => '96x96',
86
- }
87
- end
88
-
89
- def self.run(params)
90
- fname = params[:appicon_image_file]
91
-
92
- require 'mini_magick'
93
- image = MiniMagick::Image.open(fname)
94
-
95
- Helper::AppiconHelper.check_input_image_size(image, 512)
96
-
97
- # Convert image to png
98
- image.format 'png'
99
-
100
- # Merge notification icons into customer sizes as they are handled thes same way
101
-
102
- icons = get_needed_icons(:social, self.needed_icons, true)
103
- icons.each do |icon|
104
- width = icon['width']
105
- height = icon['height']
106
-
107
- # Custom icons will have basepath and filename already defined
108
- if icon.has_key?('basepath') && icon.has_key?('filename')
109
- basepath = Pathname.new(icon['basepath'])
110
- filename = icon['filename']
111
- else
112
- basepath = Pathname.new("#{params[:appicon_path]}-#{icon['scale']}")
113
- filename = "#{params[:appicon_filename]}_#{width}x#{height}.png"
114
- end
115
- FileUtils.mkdir_p(basepath)
116
-
117
- image.resize "#{width}x#{height}"
118
- image.write basepath + filename
119
- end
120
-
121
- puts "Successfully stored launcher icons at '#{params[:appicon_path]}'"
122
- end
123
-
124
- def self.get_custom_sizes(image, custom_sizes)
125
-
126
- end
127
-
128
- def self.description
129
- "Generate required icon sizes from a master application icon"
130
- end
131
-
132
- def self.authors
133
- ["@adrum"]
134
- end
135
-
136
- def self.available_options
137
- [
138
- FastlaneCore::ConfigItem.new(key: :appicon_image_file,
139
- env_name: "APPICON_IMAGE_FILE",
140
- description: "Path to a square image file, at least 512x512",
141
- optional: false,
142
- type: String),
143
- FastlaneCore::ConfigItem.new(key: :appicon_devices,
144
- env_name: "APPICON_DEVICES",
145
- default_value: [:phone],
146
- description: "Array of device types to generate icons for",
147
- optional: true,
148
- type: Array),
149
- FastlaneCore::ConfigItem.new(key: :appicon_path,
150
- env_name: "APPICON_PATH",
151
- default_value: 'app/res/mipmap/',
152
- description: "Path to res subfolder",
153
- optional: true,
154
- type: String),
155
- FastlaneCore::ConfigItem.new(key: :appicon_filename,
156
- env_name: "APPICON_FILENAME",
157
- default_value: 'ic_launcher',
158
- description: "The output filename of each image",
159
- optional: true,
160
- type: String),
161
- FastlaneCore::ConfigItem.new(key: :appicon_notification_icon_path,
162
- env_name: "APPICON_NOTIFICATION_ICON_PATH",
163
- default_value: 'app/res/drawable/',
164
- description: "Path to res subfolder",
165
- optional: true,
166
- type: String),
167
- FastlaneCore::ConfigItem.new(key: :appicon_notification_icon_filename,
168
- env_name: "APPICON_NOTIFICATION_ICON_FILENAME",
169
- default_value: 'ic_stat_onesignal_default',
170
- description: "File name for notification icons",
171
- optional: true,
172
- type: String),
173
- FastlaneCore::ConfigItem.new(key: :appicon_custom_sizes,
174
- description: "Hash of custom sizes - {'path/icon.png' => '256x256'}",
175
- optional: true,
176
- type: Hash)
177
- ]
178
- end
179
-
180
- def self.is_supported?(platform)
181
- [:android].include?(platform)
182
- end
183
- end
184
-
185
- class MyApplication
186
- include Commander::Methods
187
-
188
- def run
189
- program :name, 'makeicon'
190
- program :version, '0.0.1'
191
- program :description, 'makeicon'
192
-
193
- command :makeicon do |c|
194
- c.syntax = 'foobar foo'
195
- c.description = 'Displays foo'
196
- c.action do |args, options|
197
- puts args
198
- params = Hash[:appicon_image_file => args[0], :appicon_path => "icon",:appicon_filename=>"icon"]
199
- SocialAction::run(params)
200
- say 'foo'
201
- end
202
- end
203
- run!
204
- end
205
- end
206
- end
207
-
208
-
209
- MakeIcon::MyApplication.new.run if $0 == __FILE__
1
+ #!/usr/bin/env ruby
2
+
3
+ puts 'ddddd'
@@ -1,3 +1,3 @@
1
1
  module Makeicon
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makeicon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - marekchen
@@ -85,9 +85,6 @@ files:
85
85
  - bin/makeicon
86
86
  - lib/makeicon.rb
87
87
  - lib/makeicon/version.rb
88
- - makeicon-0.1.0.gem
89
- - makeicon-0.1.1.gem
90
- - makeicon-0.1.2.gem
91
88
  - makeicon.gemspec
92
89
  homepage: http://www.droi.com
93
90
  licenses:
@@ -109,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
106
  version: '0'
110
107
  requirements: []
111
108
  rubyforge_project:
112
- rubygems_version: 2.6.13
109
+ rubygems_version: 2.6.11
113
110
  signing_key:
114
111
  specification_version: 4
115
112
  summary: makeicon
data/makeicon-0.1.0.gem DELETED
Binary file
data/makeicon-0.1.1.gem DELETED
Binary file
data/makeicon-0.1.2.gem DELETED
Binary file