ios_icon_generator 0.1.1 → 0.1.2

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: 0b46b6ba358fea7257956c5b604814fab0e6357d
4
- data.tar.gz: ff34cdecebb146b1a0bd77785a42128181587d44
3
+ metadata.gz: 4243f84a51081da8c4e3e7213d4c68afb325fc34
4
+ data.tar.gz: c88f2035019f517cf3c38efa734d1093278202fa
5
5
  SHA512:
6
- metadata.gz: 4ee3aa9f28014df742b90153ab9920f47d92c0f5eefbb90ff33a27e13a5774feed4a769c8ec17e67ab58487ca52096b8546479c2ce3a2184a19688b4c4527782
7
- data.tar.gz: 592077858ad24fff1f632c2aab47022f55e86d9ec97e660021f8be11d60af33811aafd95d7dd55e773afc2971f9d834bedb227e648cce71d43b6b1e224221ae2
6
+ metadata.gz: 73a7463196407d741a49bf87004d5e2d046a233d90f8fd94db3d7e274962fb5ae2e2c0c11497d6de43816104bcd7fcafe227ae4504321991520f6b304c261556
7
+ data.tar.gz: 6985de411ffb1ba85d985de1a2c4add3feb6afd6677bb45d54e0a044bfc37a253fbd1a1de54983cc01300d1e2359a0f619382caac65292236758009c8993ba80
data/README.md CHANGED
@@ -4,6 +4,8 @@ iOS Icon Generator
4
4
  [![Build Status](https://app.bitrise.io/app/b23ec2cde834230f/status.svg?token=IBOm9v8claU8aEpmnLMWig)](https://app.bitrise.io/app/b23ec2cde834230f)
5
5
  [![Documentation](https://img.shields.io/badge/docs-available-success.svg)](https://fueled.github.io/ios-icon-generator/)
6
6
  [![LICENSE](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)
7
+ [![Version](https://img.shields.io/gem/v/ios_icon_generator.svg)](https://rubygems.org/gems/ios_icon_generator)
8
+ [![codecov](https://codecov.io/gh/Fueled/ios-icon-generator/branch/master/graph/badge.svg)](https://codecov.io/gh/Fueled/ios-icon-generator)
7
9
 
8
10
  ## Usage
9
11
 
@@ -23,6 +25,12 @@ sudo gem install ios_icon_generator
23
25
 
24
26
  If you wish not to use `sudo` permissions to RubyGems, you can follow the instructions of the `CocoaPods` guys [here](https://guides.cocoapods.org/using/getting-started.html#getting-started), by replacing all `cocoapods` with `ios_icon_generator` in the shell commands.
25
27
 
28
+ It requires both [`imagemagick`](http://www.imagemagick.org/) and [`ghostscript`](https://www.ghostscript.com/), both can be installed using Homebrew:
29
+
30
+ ```bash
31
+ brew install imagemagick ghostscript
32
+ ```
33
+
26
34
  ### Generate App Icon Sets
27
35
 
28
36
  For now, the CLI supports generating app icon sets for all supported platforms:
@@ -138,7 +146,12 @@ All you'll be all set!
138
146
  To run the development version of `icongen` from anywhere, just run `icongen-dev` rather than `icongen`.
139
147
  You can then proceed on developing locally on the ios-icon-generator repository, and create a PR whenever a new piece of code is ready to be reviewed and integrated!
140
148
 
141
- To run the test suite, you may run the following command from the root folder:
149
+ To be able to run the test suite, the dependencies `libpng` and `libjpeg` are required (on top of `imagemagick`) to be installed. You can install them via `homebrew`:
150
+ ```bash
151
+ brew install libpng libjpeg
152
+ ```
153
+
154
+ You may then execute the following command to run the test suite:
142
155
  ```bash
143
- bundler exec ruby bin/rspec -I .
156
+ bundler exec rake
144
157
  ```
data/bin/icongen CHANGED
@@ -1,16 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'ios_icon_generator'
4
+ require 'ios_icon_generator/cli/runner'
5
5
 
6
- arguments = ARGV
7
- trace_enabled = arguments.include?('--trace')
8
- arguments.reject! { |v| v == '--trace' }
9
-
10
- begin
11
- Hanami::CLI.new(IOSIconGenerator::CLI::Commands).call(arguments: arguments)
12
- rescue StandardError => e
13
- raise if trace_enabled
14
-
15
- puts "ERROR: #{e.message}".red
16
- end
6
+ IOSIconGenerator::CLI::Runner.new(ARGV.dup).execute!
@@ -18,7 +18,7 @@ require 'colored2'
18
18
  require 'parallel'
19
19
  require 'ruby-progressbar'
20
20
  require 'ios_icon_generator/helpers/generate_icon'
21
- require 'ios_icon_generator/helpers/which'
21
+ require 'ios_icon_generator/helpers/check_dependencies'
22
22
  require 'hanami/cli'
23
23
 
24
24
  module IOSIconGenerator
@@ -33,7 +33,10 @@ module IOSIconGenerator
33
33
  option :parallel_processes, type: :integer, default: -1, desc: 'Number of processes to use to process the files. Defaults to -1, meaning the number of cores the machine. \
34
34
  Set to 0 to disable parallel processing.'
35
35
  def call(icon_path:, xcasset_folder:, type:, **options)
36
+ Helpers.check_dependencies
37
+
36
38
  raise "#{'ImageMagick'.blue.bold} is required. It can be installed via #{'homebrew'.bold.underlined} using #{'brew install imagemagick'.blue.bold.underlined}" unless Helpers.which('magick')
39
+ raise "#{'GhostScript'.blue.bold} is required. It can be installed via #{'homebrew'.bold.underlined} using #{'brew install ghostscript'.blue.bold.underlined}" unless Helpers.which('gs')
37
40
 
38
41
  types = type.map(&:to_sym)
39
42
 
@@ -51,7 +54,7 @@ module IOSIconGenerator
51
54
  progress_bar.increment if progress
52
55
  end
53
56
  )
54
- puts "\nCompleted!".green
57
+ puts 'Completed!'.green
55
58
  end
56
59
  end
57
60
 
@@ -20,6 +20,7 @@ require 'colored2'
20
20
  require 'parallel'
21
21
  require 'ruby-progressbar'
22
22
  require 'ios_icon_generator/helpers/mask_icon'
23
+ require 'ios_icon_generator/helpers/check_dependencies'
23
24
  require 'hanami/cli'
24
25
 
25
26
  module IOSIconGenerator
@@ -48,7 +49,7 @@ module IOSIconGenerator
48
49
  option :parallel_processes, type: :integer, default: -1, desc: 'Number of processes to use to process the files. Defaults to -1, meaning the number of cores the machine. \
49
50
  Set to 0 to disable parallel processing.'
50
51
  def call(appiconset_path:, output_path:, **options)
51
- raise "#{'ImageMagick'.blue.bold} is required. It can be installed via #{'homebrew'.bold.underlined} using #{'brew install imagemagick'.blue.bold.underlined}" unless Helpers.which('magick')
52
+ Helpers.check_dependencies
52
53
 
53
54
  raise 'There is no App icon set at the path specified.' unless Dir.exist?(appiconset_path)
54
55
 
@@ -18,7 +18,7 @@ require 'colored2'
18
18
  require 'parallel'
19
19
  require 'ruby-progressbar'
20
20
  require 'ios_icon_generator/helpers/generate_icon'
21
- require 'ios_icon_generator/helpers/which'
21
+ require 'ios_icon_generator/helpers/check_dependencies'
22
22
  require 'hanami/cli'
23
23
 
24
24
  module IOSIconGenerator
@@ -42,7 +42,7 @@ module IOSIconGenerator
42
42
  option :parallel_processes, type: :integer, default: -1, desc: 'Number of processes to use to process the files. Defaults to -1, meaning the number of cores the machine. \
43
43
  Set to 0 to disable parallel processing.'
44
44
  def call(text:, xcasset_folder:, type:, **options)
45
- raise "#{'ImageMagick'.blue.bold} is required. It can be installed via #{'homebrew'.bold.underlined} using #{'brew install imagemagick'.blue.bold.underlined}" unless Helpers.which('magick')
45
+ Helpers.check_dependencies
46
46
 
47
47
  types = type.map(&:to_sym)
48
48
 
@@ -84,7 +84,7 @@ module IOSIconGenerator
84
84
  progress_bar.increment if progress
85
85
  end
86
86
  )
87
- puts "\nCompleted!".green
87
+ puts 'Completed!'.green
88
88
  end
89
89
  end
90
90
 
@@ -26,7 +26,7 @@ module IOSIconGenerator
26
26
  end
27
27
  end
28
28
 
29
- register 'version', Version, aliases: ['v', '-v', '--version']
29
+ register 'version', Commands::Version, aliases: ['v', '-v', '--version']
30
30
  end
31
31
  end
32
32
  end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2019 Fueled Digital Media, LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'ios_icon_generator'
18
+
19
+ module IOSIconGenerator
20
+ module CLI
21
+ class Runner
22
+ def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
23
+ @argv = argv
24
+ @trace_enabled = argv.include?('--trace')
25
+ @argv.reject! { |v| v == '--trace' }
26
+ @argv = argv
27
+ @stdin = stdin
28
+ @stdout = stdout
29
+ @stderr = stderr
30
+ @kernel = kernel
31
+ end
32
+
33
+ def execute!
34
+ exit_code =
35
+ begin
36
+ $stderr = @stderr
37
+ $stdin = @stdin
38
+ $stdout = @stdout
39
+
40
+ Hanami::CLI.new(IOSIconGenerator::CLI::Commands).call(arguments: @argv)
41
+
42
+ 0
43
+ rescue StandardError => e
44
+ if @trace_enabled
45
+ @stderr.puts "ERROR: #{e.message}".red
46
+ else
47
+ @stderr.puts("#{e.backtrace.shift}: #{e.message} (#{e.class})")
48
+ @stderr.puts(e.backtrace.map { |s| "\tfrom #{s}" }.join("\n"))
49
+ end
50
+ 1
51
+ rescue SystemExit => e
52
+ e.status
53
+ ensure
54
+ $stderr = STDERR
55
+ $stdin = STDIN
56
+ $stdout = STDOUT
57
+ end
58
+
59
+ # Proxy our exit code back to the injected kernel.
60
+ @kernel.exit(exit_code)
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2019 Fueled Digital Media, LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'ios_icon_generator/helpers/which'
18
+
19
+ module IOSIconGenerator
20
+ module Helpers
21
+ def self.check_dependencies
22
+ raise "#{'ImageMagick'.blue.bold} is required. It can be installed via #{'homebrew'.bold.underlined} using #{'brew install imagemagick'.blue.bold.underlined}" unless Helpers.which('magick')
23
+ raise "#{'GhostScript'.blue.bold} is required. It can be installed via #{'homebrew'.bold.underlined} using #{'brew install ghostscript'.blue.bold.underlined}" unless Helpers.which('gs')
24
+ end
25
+ end
26
+ end
@@ -48,7 +48,7 @@ module IOSIconGenerator
48
48
  # @return [String] Return the path to the generated app icon set.
49
49
  def self.generate_icon(icon_path:, output_folder:, types:, parallel_processes: nil, generate_icon: nil, progress: nil)
50
50
  if icon_path
51
- raise 'There is no icon at the path specified.' unless File.exist?(icon_path)
51
+ raise "There is no icon at #{icon_path}." unless File.exist?(icon_path)
52
52
 
53
53
  raise 'The icon specified must be .pdf.' if File.extname(icon_path) != '.pdf'
54
54
 
@@ -18,5 +18,5 @@ module IOSIconGenerator
18
18
  ##
19
19
  # The current version of the gem.
20
20
  #
21
- VERSION = '0.1.1'
21
+ VERSION = '0.1.2'
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ios_icon_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stéphane Copin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-21 00:00:00.000000000 Z
11
+ date: 2019-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored2
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: aruba
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +94,20 @@ dependencies:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
96
  version: '2.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: codecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: danger
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +150,20 @@ dependencies:
122
150
  - - ">="
123
151
  - !ruby/object:Gem::Version
124
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: phashion
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
125
167
  - !ruby/object:Gem::Dependency
126
168
  name: pry
127
169
  requirement: !ruby/object:Gem::Requirement
@@ -192,6 +234,34 @@ dependencies:
192
234
  - - ">="
193
235
  - !ruby/object:Gem::Version
194
236
  version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: simplecov
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ - !ruby/object:Gem::Dependency
252
+ name: simplecov-console
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ version: '0'
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: '0'
195
265
  description:
196
266
  email:
197
267
  - stephane@fueled.com
@@ -209,6 +279,8 @@ files:
209
279
  - lib/ios_icon_generator/cli/commands/mask.rb
210
280
  - lib/ios_icon_generator/cli/commands/stub.rb
211
281
  - lib/ios_icon_generator/cli/commands/version.rb
282
+ - lib/ios_icon_generator/cli/runner.rb
283
+ - lib/ios_icon_generator/helpers/check_dependencies.rb
212
284
  - lib/ios_icon_generator/helpers/generate_icon.rb
213
285
  - lib/ios_icon_generator/helpers/image_sets_definition.rb
214
286
  - lib/ios_icon_generator/helpers/mask_icon.rb