iconset 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: 23efbe8ce41b58f040314c0bf7c60f2ae71ecd1c
4
+ data.tar.gz: 1d7328cc9dc0dfaba95435e0ab71e32bf4005fcc
5
+ SHA512:
6
+ metadata.gz: 372677831bb6388d184957e6707560a32c034dbdecb1950d01decf610bcd3bec4838ab1c6ec594e3bd5b83a4793d704a1c3f4a93a9f4319dd9f29dee954494ca
7
+ data.tar.gz: a84977ee2f8cd2c05bb906b7fe3f5e5a2063f07c953704ed764e740468bfca1c146bb88dc349a319c2107cda3d56e950474aa35f032783a3e6395d63fdd3e2d4
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ .DS_STORE
2
+ *.gem
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
19
+ *.bundle
20
+ *.so
21
+ *.o
22
+ *.a
23
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in icon-set.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Dan Williams
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Icon::Set
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'icon-set'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install icon-set
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/icon-set/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/iconset ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+ require 'iconset'
3
+ require 'commander/import'
4
+ require 'fileutils'
5
+
6
+ HighLine.track_eof = false # Fix for built-in Ruby
7
+ Signal.trap("INT") {} # Suppress backtrace when exiting command
8
+
9
+ program :name, "iconset"
10
+ program :version, IconSet::VERSION
11
+ program :description, 'A command-line interface for quickly creating the necessary icon sizes for iPhone and iPad apps. Full support for iOS 8.'
12
+
13
+ program :help, 'Author', 'Dan Williams <dan@danwilliams.co>'
14
+ program :help, 'Website', 'https://github.com/danwilliams64/iconset'
15
+ program :help_formatter, :compact
16
+
17
+ default_command :make_icons
18
+
19
+ command :make_icons do |c|
20
+ c.syntax = 'iconset ICON_PATH --phone --pad'
21
+ c.summary = 'Produces all the correct icon sizes using the source image ICON_PATH for the devices specified.'
22
+ c.description = 'Iconset automatically creates the correct sized app icons for the specified devices.'
23
+ c.option '--phone', 'Produce icons for iPhone.'
24
+ c.option '--pad', 'Produce icons for iPad.'
25
+ c.option '--dest DESTINATION', 'Desination directory for the new icons output.'
26
+
27
+ c.example 'make_icons', 'iconset make_icons icon1024.png --phone --pad'
28
+
29
+ c.action do |args, options|
30
+ say_error "Missing icon path" and abort unless icon_path = args.first
31
+
32
+ begin
33
+ devices = []
34
+ devices << IconSet::PHONE if options.phone
35
+ devices << IconSet::PAD if options.pad
36
+ devices << IconSet::PHONE if devices.empty?
37
+
38
+ options.dest = 'iconset' unless options.dest
39
+ FileUtils.mkdir_p(options.dest).first
40
+
41
+ image_processor.generate_icons(source_path: icon_path, destination_path: options.dest, devices: devices)
42
+ end
43
+ end
44
+ end
45
+
46
+ private
47
+ def image_processor
48
+ @image_processor ||= IconSet::IconProcessor.new
49
+ end
data/iconset.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'iconset/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "iconset"
8
+ spec.version = IconSet::VERSION
9
+ spec.authors = ["Dan Williams"]
10
+ spec.email = ["dan@danwilliams.co"]
11
+ spec.summary = %q{A command-line interface for quickly creating the necessary icon sizes for iPhone and iPad apps. Full support for iOS 8.}
12
+ spec.homepage = "http://github.com/danwilliams64/iconset"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency 'colored', "~>1.2"
21
+ spec.add_dependency 'commander', "~>4.3.0"
22
+ spec.add_dependency 'mini_magick', "~>4.1.0"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.6"
25
+ spec.add_development_dependency "rake"
26
+ end
data/lib/.DS_Store ADDED
Binary file
Binary file
@@ -0,0 +1,49 @@
1
+ require 'colored'
2
+ require 'mini_magick'
3
+
4
+ module IconSet
5
+
6
+ PHONE = [ {120 => "iPhoneApp60@2x"},
7
+ {180 => "iPhoneApp60@3x"},
8
+ {80 => "iPhoneSpotlight40@2x"},
9
+ {120 => "iPhoneSpotlight40@3x"},
10
+ {58 => "iPhoneSettings29@2x"},
11
+ {87 => "iPhoneSettings29@3x"} ]
12
+
13
+ PAD = [ {76 => "iPadApp76"},
14
+ {152 => "iPadApp76@2x"},
15
+ {40 => "iPadSpotlight40"},
16
+ {80 => "iPadSpotlight40@2x"},
17
+ {29 => "iPadSettings29"},
18
+ {58 => "iPadSettings29@2x"} ]
19
+
20
+ class IconProcessor
21
+
22
+ def generate_icons(source_path:, destination_path:, devices:)
23
+ puts "Creating icons..."
24
+
25
+ @source_path = source_path
26
+ @destination_path = destination_path
27
+
28
+ devices.each do |device|
29
+ generate_icons_for_sizes device
30
+ end
31
+
32
+ puts "Success! Finished creating icons.".green
33
+ end
34
+
35
+ private
36
+ def generate_icons_for_sizes(sizes)
37
+ sizes.each do |hash|
38
+ size = hash.keys.first
39
+ file_name = hash.values.first
40
+
41
+ image = MiniMagick::Image.open(@source_path)
42
+ image.resize "#{size}x#{size}"
43
+ image.format "png"
44
+ image.write "#{@destination_path}/#{file_name}.png"
45
+ end
46
+ end
47
+
48
+ end
49
+ end
@@ -0,0 +1,3 @@
1
+ module IconSet
2
+ VERSION = "0.1.0"
3
+ end
data/lib/iconset.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'iconset/version'
2
+ require 'iconset/icon_processor'
3
+
4
+ # Third party libraries
5
+ require 'colored'
6
+ require 'mini_magick'
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iconset
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dan Williams
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colored
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: commander
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 4.3.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 4.3.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: mini_magick
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 4.1.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 4.1.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: '1.6'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
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
+ description:
84
+ email:
85
+ - dan@danwilliams.co
86
+ executables:
87
+ - iconset
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/iconset
97
+ - iconset.gemspec
98
+ - lib/.DS_Store
99
+ - lib/iconset.rb
100
+ - lib/iconset/.DS_Store
101
+ - lib/iconset/icon_processor.rb
102
+ - lib/iconset/version.rb
103
+ homepage: http://github.com/danwilliams64/iconset
104
+ licenses:
105
+ - MIT
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.2.2
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: A command-line interface for quickly creating the necessary icon sizes for
127
+ iPhone and iPad apps. Full support for iOS 8.
128
+ test_files: []