fastlane-plugin-appicon 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 91d35ab5b5403cd52129a5513c960cef2182b4b9
4
+ data.tar.gz: f25c0c5ed213413c46915bd1cad4d051fbd9df69
5
+ SHA512:
6
+ metadata.gz: 36bccd9c40ca9c9448a6ae5b4feff0b7054c1e57c8a7cb02fcfc8e59646c9fd8fe24faf125a00483da6687f27afa9f869d7767f88d1d49c3366cba3d6135782c
7
+ data.tar.gz: 76317b2cccd980e7bdcb3e9ec717eb77c0d0a1668585ca8252c59a02bf269f4c1ad86a2164875f6515d83b59ddd8ae169cb63cdee179286b14a5731a38fa15e0
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Boris Bügling <boris@icculus.org>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # appicon plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-appicon)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-appicon`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin appicon
11
+ ```
12
+
13
+ ## About appicon
14
+
15
+ Generate required icon sizes and iconset from a master application icon.
16
+
17
+ ## Example
18
+
19
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
20
+
21
+ ## Run tests for this plugin
22
+
23
+ To run both the tests, and code style validation, run
24
+
25
+ ````
26
+ rake
27
+ ```
28
+
29
+ To automatically fix many of the styling issues, use
30
+ ```
31
+ rubocop -a
32
+ ```
33
+
34
+ ## Issues and Feedback
35
+
36
+ For any other issues and feedback about this plugin, please submit it to this repository.
37
+
38
+ ## Troubleshooting
39
+
40
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/PluginsTroubleshooting.md) doc in the main `fastlane` repo.
41
+
42
+ ## Using `fastlane` Plugins
43
+
44
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Plugins.md).
45
+
46
+ ## About `fastlane`
47
+
48
+ `fastlane` is the easiest way to automate building and releasing your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/appicon/version'
2
+
3
+ module Fastlane
4
+ module Appicon
5
+ # Return all .rb files inside the "actions" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::Appicon.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,101 @@
1
+ module Fastlane
2
+ module Actions
3
+ class AppiconAction < Action
4
+ def self.needed_icons
5
+ {
6
+ iphone: {
7
+ '2x' => ['29x29', '40x40', '60x60'],
8
+ '3x' => ['29x29', '40x40', '60x60']
9
+ },
10
+ ipad: {
11
+ '1x' => ['29x29', '40x40', '76x76'],
12
+ '2x' => ['29x29', '40x40', '76x76', '83.5x83.5']
13
+ }
14
+ }
15
+ end
16
+
17
+ def self.run(params)
18
+ fname = params[:appicon_image_file]
19
+ basename = File.basename(fname, File.extname(fname))
20
+ basepath = Pathname.new("#{params[:appicon_path]}/AppIcon.appiconset")
21
+
22
+ require 'mini_magick'
23
+ image = MiniMagick::Image.open(fname)
24
+
25
+ UI.user_error! "Minimum width of input image should be 1024" if image.width < 1024
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
28
+
29
+ FileUtils.mkdir_p(basepath)
30
+
31
+ images = []
32
+
33
+ params[:appicon_devices].each do |device|
34
+ self.needed_icons[device].each do |scale, sizes|
35
+ sizes.each do |size|
36
+ width, height = size.split('x').map { |v| v.to_i * scale.to_i }
37
+ filename = "#{basename}-#{width}x#{height}.png"
38
+
39
+ image = MiniMagick::Image.open(fname)
40
+ image.format 'png'
41
+ image.resize "#{width}x#{height}"
42
+ image.write basepath + filename
43
+
44
+ images << {
45
+ 'size' => size,
46
+ 'idiom' => device,
47
+ 'filename' => filename,
48
+ 'scale' => scale
49
+ }
50
+ end
51
+ end
52
+ end
53
+
54
+ contents = {
55
+ 'images' => images,
56
+ 'info' => {
57
+ 'version' => 1,
58
+ 'author' => 'fastlane' # xcode?
59
+ }
60
+ }
61
+
62
+ require 'json'
63
+ File.write(basepath + 'Contents.json', JSON.dump(contents))
64
+ end
65
+
66
+ def self.description
67
+ "Generate required icon sizes and iconset from a master application icon"
68
+ end
69
+
70
+ def self.authors
71
+ ["@NeoNacho"]
72
+ end
73
+
74
+ def self.available_options
75
+ [
76
+ FastlaneCore::ConfigItem.new(key: :appicon_image_file,
77
+ env_name: "APPICON_IMAGE_FILE",
78
+ description: "Path to a square image file, at least 1024x1024",
79
+ optional: false,
80
+ type: String),
81
+ FastlaneCore::ConfigItem.new(key: :appicon_devices,
82
+ env_name: "APPICON_DEVICES",
83
+ default_value: [:iphone],
84
+ description: "Array of device idioms to generate icons for",
85
+ optional: true,
86
+ type: Array),
87
+ FastlaneCore::ConfigItem.new(key: :appicon_path,
88
+ env_name: "APPICON_PATH",
89
+ default_value: 'Assets.xcassets',
90
+ description: "Path to the Asset catalogue for the generated iconset",
91
+ optional: true,
92
+ type: String)
93
+ ]
94
+ end
95
+
96
+ def self.is_supported?(platform)
97
+ [:ios, :mac, :macos, :caros].include?(platform)
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module Appicon
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-appicon
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Boris Bügling
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mini_magick
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 4.5.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 4.5.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
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'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
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'
111
+ - !ruby/object:Gem::Dependency
112
+ name: fastlane
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.95.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.95.0
125
+ description:
126
+ email: boris@icculus.org
127
+ executables: []
128
+ extensions: []
129
+ extra_rdoc_files: []
130
+ files:
131
+ - lib/fastlane/plugin/appicon/actions/appicon_action.rb
132
+ - lib/fastlane/plugin/appicon/version.rb
133
+ - lib/fastlane/plugin/appicon.rb
134
+ - README.md
135
+ - LICENSE
136
+ homepage: https://github.com/neonichu/fastlane-plugin-appicon
137
+ licenses:
138
+ - MIT
139
+ metadata: {}
140
+ post_install_message:
141
+ rdoc_options: []
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - '>='
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ requirements: []
155
+ rubyforge_project:
156
+ rubygems_version: 2.0.14.1
157
+ signing_key:
158
+ specification_version: 4
159
+ summary: Generate required icon sizes and iconset from a master application icon.
160
+ test_files: []
161
+ has_rdoc: