acbaker 0.0.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 +7 -0
- data/.gitignore +3 -0
- data/README.md +33 -0
- data/Rakefile +9 -0
- data/acbaker.gemspec +23 -0
- data/bin/acbaker +14 -0
- data/lib/acbaker/asset_pack.rb +102 -0
- data/lib/acbaker/commands/pack.rb +119 -0
- data/lib/acbaker/commands.rb +2 -0
- data/lib/acbaker/config/AppIcon.json +110 -0
- data/lib/acbaker/config/LaunchImage.json +162 -0
- data/lib/acbaker/version.rb +3 -0
- data/lib/acbaker.rb +6 -0
- data/test/assets/AppIcon.png +0 -0
- data/test/assets/LaunchImage.png +0 -0
- data/test/test_acbaker.rb +24 -0
- metadata +102 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 1b759222db16f3af1eb44448d91812d76ab1c69e
|
|
4
|
+
data.tar.gz: b691dcb923103b569450d709f5b1503f3673d73f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1f70abd07c2e3c19e00069530294820fb0ccb2ed1b7bf871ff0aaac7377fcebeffc64a7b7fe986ce942ce27e165e135c6fc10c703f9829d31d2a67f7dae268aa
|
|
7
|
+
data.tar.gz: 99e29709f2decbe047e2b345812e244b4c60f283f0ec4dd901413959ec22f136fb5467e3d3b8ac33b8ef28a1131e1570f993a9c7c5362440bd3b607f4d087d9b
|
data/.gitignore
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Asset Catalog Baker - Generate Asset Catalogs on the fly
|
|
2
|
+
========================================================
|
|
3
|
+
|
|
4
|
+
**Generate Asset Catalog Images from source files to use with XCode**
|
|
5
|
+
<http://www.magloft.com>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
INSTALLATION
|
|
9
|
+
------------
|
|
10
|
+
|
|
11
|
+
Install the gem for command line usage or inclusion in your ruby project:
|
|
12
|
+
|
|
13
|
+
gem install acbaker
|
|
14
|
+
|
|
15
|
+
USAGE
|
|
16
|
+
-----
|
|
17
|
+
|
|
18
|
+
acbaker --help
|
|
19
|
+
|
|
20
|
+
CHANGELOG
|
|
21
|
+
---------
|
|
22
|
+
|
|
23
|
+
* **0.0.2**
|
|
24
|
+
* Fix convert results
|
|
25
|
+
|
|
26
|
+
* **0.0.1**
|
|
27
|
+
* Initial release
|
|
28
|
+
|
|
29
|
+
LICENSE
|
|
30
|
+
-------
|
|
31
|
+
|
|
32
|
+
_Copyright (C) 2014, Tobias Strebitzer_
|
|
33
|
+
_Licensed under **BSD Opensource License** (free for personal and commercial use)_
|
data/Rakefile
ADDED
data/acbaker.gemspec
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'acbaker/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = "acbaker"
|
|
8
|
+
s.version = Acbaker::VERSION
|
|
9
|
+
s.licenses = ["BSD-3-Clause"]
|
|
10
|
+
s.platform = Gem::Platform::RUBY
|
|
11
|
+
s.authors = ["Tobias Strebitzer"]
|
|
12
|
+
s.email = ["tobias.strebitzer@magloft.com"]
|
|
13
|
+
s.homepage = "http://www.magloft.com"
|
|
14
|
+
s.summary = "Convert any source images into xcode asset catalogs."
|
|
15
|
+
s.description = "This gem allows easy conversion and management of xcode asset catalogs."
|
|
16
|
+
s.required_rubygems_version = '>= 1.3.6'
|
|
17
|
+
s.add_dependency "commander", '~> 4.1'
|
|
18
|
+
s.add_dependency 'json', '~> 1.8'
|
|
19
|
+
s.add_development_dependency "rake", '~> 10.0'
|
|
20
|
+
s.files = `git ls-files`.split("\n")
|
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
22
|
+
s.require_path = 'lib'
|
|
23
|
+
end
|
data/bin/acbaker
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'commander/import'
|
|
3
|
+
$:.push File.expand_path("../../lib", __FILE__)
|
|
4
|
+
require 'acbaker'
|
|
5
|
+
|
|
6
|
+
program :version, Acbaker::VERSION
|
|
7
|
+
program :description, 'Convert any source images into xcode asset catalogs.'
|
|
8
|
+
program :help, 'Author', 'Tobias Strebitzer <tobias.strebitzer@magloft.com>'
|
|
9
|
+
program :help, 'Website', 'http://www.magloft.com'
|
|
10
|
+
program :help_formatter, :compact
|
|
11
|
+
|
|
12
|
+
default_command :help
|
|
13
|
+
|
|
14
|
+
require 'acbaker/commands'
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
module Acbaker
|
|
4
|
+
class AssetPack
|
|
5
|
+
attr_reader :type, :images
|
|
6
|
+
|
|
7
|
+
def initialize(type, options={})
|
|
8
|
+
@type = type
|
|
9
|
+
if options[:json]
|
|
10
|
+
@json_data = options[:json]
|
|
11
|
+
else
|
|
12
|
+
@json_file = File.join(File.dirname(File.expand_path(__FILE__)), "config", "#{type}.json")
|
|
13
|
+
@json_data = JSON.parse(File.open(@json_file).read)
|
|
14
|
+
end
|
|
15
|
+
@images = @json_data['images']
|
|
16
|
+
@options = self.defaults().merge(options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def defaults
|
|
20
|
+
{json: false}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def process(source_image_file, target_directory, &block)
|
|
24
|
+
|
|
25
|
+
# Define variables
|
|
26
|
+
json_output_file = File.join(target_directory, "Contents.json")
|
|
27
|
+
|
|
28
|
+
# Loop through images
|
|
29
|
+
@json_data['images'].each_with_index do |image_spec, index|
|
|
30
|
+
|
|
31
|
+
# Get size
|
|
32
|
+
(width_str, height_str) = image_spec['size'].split('x')
|
|
33
|
+
scale = image_spec['scale'].gsub('x', '').to_i
|
|
34
|
+
width = width_str.to_i * scale
|
|
35
|
+
height = height_str.to_i * scale
|
|
36
|
+
size_max = [width, height].max
|
|
37
|
+
base_width = width / scale
|
|
38
|
+
base_height = height / scale
|
|
39
|
+
|
|
40
|
+
# Get version
|
|
41
|
+
if image_spec['minimum-system-version'].nil?
|
|
42
|
+
version = 'ios56'
|
|
43
|
+
elsif image_spec['minimum-system-version'] == '8.0'
|
|
44
|
+
version = 'ios8'
|
|
45
|
+
elsif image_spec['minimum-system-version'] == '7.0'
|
|
46
|
+
version = 'ios78'
|
|
47
|
+
else
|
|
48
|
+
version = 'ios56'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Generate filename
|
|
52
|
+
filename_array = []
|
|
53
|
+
filename_array.push(@type)
|
|
54
|
+
filename_array.push(image_spec['idiom']) if image_spec['idiom']
|
|
55
|
+
filename_array.push(image_spec['orientation']) if image_spec['orientation']
|
|
56
|
+
filename_array.push(version)
|
|
57
|
+
|
|
58
|
+
# Add subtype
|
|
59
|
+
if image_spec['subtype']
|
|
60
|
+
if image_spec['subtype'] == '736h'
|
|
61
|
+
filename_array.push('retina-hd-55')
|
|
62
|
+
elsif image_spec['subtype'] == '667h'
|
|
63
|
+
filename_array.push('retina-hd-47')
|
|
64
|
+
else
|
|
65
|
+
filename_array.push(image_spec['subtype'])
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Add extent
|
|
70
|
+
filename_array.push(image_spec['extent']) if image_spec['extent']
|
|
71
|
+
|
|
72
|
+
# Add size
|
|
73
|
+
filename_array.push(image_spec['size'])
|
|
74
|
+
|
|
75
|
+
if scale > 1
|
|
76
|
+
filename = "#{filename_array.join('-')}@#{scale}x.png"
|
|
77
|
+
else
|
|
78
|
+
filename = "#{filename_array.join('-')}.png"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Generate image
|
|
82
|
+
cmd = "convert #{source_image_file} -resize #{width}x#{height}^ -gravity Center -crop #{width}x#{height}+0+0 +repage #{target_directory}/#{filename}"
|
|
83
|
+
system(cmd)
|
|
84
|
+
|
|
85
|
+
# Trigger Callback proc
|
|
86
|
+
block.call("#{target_directory}/#{filename}", index+1) if not block.nil?
|
|
87
|
+
|
|
88
|
+
# Update json data
|
|
89
|
+
image_spec['filename'] = filename
|
|
90
|
+
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Save Contents.json
|
|
94
|
+
File.open(json_output_file,"w") do |f|
|
|
95
|
+
f.write(JSON.pretty_generate(@json_data))
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
true
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
command :'pack' do |c|
|
|
2
|
+
c.syntax = "acbaker pack [image] [output directory]"
|
|
3
|
+
c.summary = "Convert an image into a xcode asset catalogs"
|
|
4
|
+
c.description = "The type will be autodetected by filename, and can be overwritten using the --type option"
|
|
5
|
+
c.option '--type STRING', String, 'Specify asset pack type'
|
|
6
|
+
c.option '--json STRING', String, 'Specify custom json file path'
|
|
7
|
+
c.option '--force', String, 'Delete and recreate output directory (careful!)'
|
|
8
|
+
global_option '--force'
|
|
9
|
+
|
|
10
|
+
c.action do |args, options|
|
|
11
|
+
|
|
12
|
+
# Prepare arguments
|
|
13
|
+
@image = args[0]
|
|
14
|
+
@output_directory = args[1]
|
|
15
|
+
@type = options.type
|
|
16
|
+
@json = options.json
|
|
17
|
+
@force = options.force
|
|
18
|
+
|
|
19
|
+
# Validate
|
|
20
|
+
validate_image_magick!
|
|
21
|
+
validate_image!
|
|
22
|
+
validate_json!
|
|
23
|
+
validate_type!
|
|
24
|
+
validate_output_directory!
|
|
25
|
+
|
|
26
|
+
# Initialize packer
|
|
27
|
+
asset_pack = Acbaker::AssetPack.new(@type, {
|
|
28
|
+
json: JSON.parse(File.open(@json).read)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
# Pack assets
|
|
32
|
+
bar = ProgressBar.new(asset_pack.images.size)
|
|
33
|
+
bar.show
|
|
34
|
+
asset_pack.process(@image, @output_directory) do |path, progress|
|
|
35
|
+
bar.increment
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
say_ok 'Your assets were successfully packed!'
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def validate_image_magick!
|
|
45
|
+
abort('You need to install Image Magick! Check http://www.imagemagick.org for instructions.') unless system("which convert > /dev/null 2>&1")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def validate_image!
|
|
49
|
+
|
|
50
|
+
# validate image is set
|
|
51
|
+
abort("Error: no image specified.") if @image.nil?
|
|
52
|
+
|
|
53
|
+
# validate image exists
|
|
54
|
+
abort("Error: can't find the image you specified. #{@image}") unless File.exist?(@image) and File.file?(@image)
|
|
55
|
+
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def validate_type!
|
|
59
|
+
if not @type
|
|
60
|
+
# Detect from image
|
|
61
|
+
token = @image.split('/')[-1].split('.')[0].downcase.to_sym
|
|
62
|
+
@type = {
|
|
63
|
+
appicon: :AppIcon,
|
|
64
|
+
launchimage: :LaunchImage,
|
|
65
|
+
icon: :AppIcon,
|
|
66
|
+
launch: :LaunchImage
|
|
67
|
+
}[token]
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
if not @type and @output_directory
|
|
71
|
+
# Detect from directory
|
|
72
|
+
token = @output_directory.gsub('.', '').downcase.to_sym
|
|
73
|
+
@type = {
|
|
74
|
+
appiconappiconset: :AppIcon,
|
|
75
|
+
appicon: :AppIcon,
|
|
76
|
+
launchimagelaunchimage: :LaunchImage,
|
|
77
|
+
launchimage: :LaunchImage
|
|
78
|
+
}[token]
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
abort("error: Could not detect asset type.") if not @type
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def validate_json!
|
|
86
|
+
if @json
|
|
87
|
+
abort("error: JSON file not found.") if not File.exist?(@json) or not File.file?(@json)
|
|
88
|
+
begin
|
|
89
|
+
JSON.parse(File.open(@json).read)
|
|
90
|
+
rescue Exception => e
|
|
91
|
+
abort("error: invalid JSON file: #{@json}")
|
|
92
|
+
end
|
|
93
|
+
@type = :Custom if not @type
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def validate_output_directory!
|
|
98
|
+
if not @output_directory
|
|
99
|
+
@output_directory = {
|
|
100
|
+
AppIcon: "AppIcon.appiconset",
|
|
101
|
+
LaunchImage: "LaunchImage.launchimage"
|
|
102
|
+
}[@type]
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Create custom output directory if type is set
|
|
106
|
+
@output_directory = "#{@type}.imageset" if not @output_directory and @type
|
|
107
|
+
|
|
108
|
+
abort("Error: No output directory specified or detected.") if @output_directory.nil?
|
|
109
|
+
parent_directory = File.expand_path(@output_directory).split("/")[0..-2].join("/")
|
|
110
|
+
abort("Error: Parent directory '#{parent_directory}' does not exist.") unless File.exist?(parent_directory) and File.directory?(parent_directory)
|
|
111
|
+
|
|
112
|
+
# Prepare output directory
|
|
113
|
+
if @force
|
|
114
|
+
FileUtils.rm_rf(@output_directory) if File.directory?(@output_directory)
|
|
115
|
+
end
|
|
116
|
+
FileUtils.mkdir(@output_directory) if not File.directory?(@output_directory)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"images" : [
|
|
3
|
+
{
|
|
4
|
+
"size" : "29x29",
|
|
5
|
+
"idiom" : "iphone",
|
|
6
|
+
"filename" : "iPhoneSettings-29x29.png",
|
|
7
|
+
"scale" : "1x"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"size" : "29x29",
|
|
11
|
+
"idiom" : "iphone",
|
|
12
|
+
"filename" : "iPhoneSettings-29x29@2x.png",
|
|
13
|
+
"scale" : "2x"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"size" : "40x40",
|
|
17
|
+
"idiom" : "iphone",
|
|
18
|
+
"filename" : "iPhoneSpotlight-40x40@2x.png",
|
|
19
|
+
"scale" : "2x"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"size" : "57x57",
|
|
23
|
+
"idiom" : "iphone",
|
|
24
|
+
"filename" : "iPhoneApp-57x57.png",
|
|
25
|
+
"scale" : "1x"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"size" : "57x57",
|
|
29
|
+
"idiom" : "iphone",
|
|
30
|
+
"filename" : "iPhoneApp-57x57@2x.png",
|
|
31
|
+
"scale" : "2x"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"size" : "60x60",
|
|
35
|
+
"idiom" : "iphone",
|
|
36
|
+
"filename" : "iPhoneApp-60x60@2x.png",
|
|
37
|
+
"scale" : "2x"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"size" : "60x60",
|
|
41
|
+
"idiom" : "iphone",
|
|
42
|
+
"filename" : "iPhoneApp-60x60@3x.png",
|
|
43
|
+
"scale" : "3x"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"size" : "29x29",
|
|
47
|
+
"idiom" : "ipad",
|
|
48
|
+
"filename" : "iPadSettings-29x29.png",
|
|
49
|
+
"scale" : "1x"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"size" : "29x29",
|
|
53
|
+
"idiom" : "ipad",
|
|
54
|
+
"filename" : "iPadSettings-29x29@2x.png",
|
|
55
|
+
"scale" : "2x"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"size" : "40x40",
|
|
59
|
+
"idiom" : "ipad",
|
|
60
|
+
"filename" : "iPadSpotlight-40x40.png",
|
|
61
|
+
"scale" : "1x"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"size" : "40x40",
|
|
65
|
+
"idiom" : "ipad",
|
|
66
|
+
"filename" : "iPadSpotlight-40x40@2x.png",
|
|
67
|
+
"scale" : "2x"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"size" : "50x50",
|
|
71
|
+
"idiom" : "ipad",
|
|
72
|
+
"filename" : "iPadSpotlight-50x50.png",
|
|
73
|
+
"scale" : "1x"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"size" : "50x50",
|
|
77
|
+
"idiom" : "ipad",
|
|
78
|
+
"filename" : "iPadSpotlight-50x50@2x.png",
|
|
79
|
+
"scale" : "2x"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"size" : "72x72",
|
|
83
|
+
"idiom" : "ipad",
|
|
84
|
+
"filename" : "iPadApp-72x72.png",
|
|
85
|
+
"scale" : "1x"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"size" : "72x72",
|
|
89
|
+
"idiom" : "ipad",
|
|
90
|
+
"filename" : "iPadApp-72x72@2x.png",
|
|
91
|
+
"scale" : "2x"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"size" : "76x76",
|
|
95
|
+
"idiom" : "ipad",
|
|
96
|
+
"filename" : "iPadApp-76x76.png",
|
|
97
|
+
"scale" : "1x"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"size" : "76x76",
|
|
101
|
+
"idiom" : "ipad",
|
|
102
|
+
"filename" : "iPadApp-76x76@2x.png",
|
|
103
|
+
"scale" : "2x"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"info" : {
|
|
107
|
+
"version" : 1,
|
|
108
|
+
"author" : "xcode"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
{
|
|
2
|
+
"images" : [
|
|
3
|
+
{
|
|
4
|
+
"size" : "414x736",
|
|
5
|
+
"orientation" : "portrait",
|
|
6
|
+
"idiom" : "iphone",
|
|
7
|
+
"extent" : "full-screen",
|
|
8
|
+
"minimum-system-version" : "8.0",
|
|
9
|
+
"subtype" : "736h",
|
|
10
|
+
"scale" : "3x"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"size" : "736x414",
|
|
14
|
+
"extent" : "full-screen",
|
|
15
|
+
"idiom" : "iphone",
|
|
16
|
+
"subtype" : "736h",
|
|
17
|
+
"minimum-system-version" : "8.0",
|
|
18
|
+
"orientation" : "landscape",
|
|
19
|
+
"scale" : "3x"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"size" : "375x667",
|
|
23
|
+
"extent" : "full-screen",
|
|
24
|
+
"idiom" : "iphone",
|
|
25
|
+
"subtype" : "667h",
|
|
26
|
+
"minimum-system-version" : "8.0",
|
|
27
|
+
"orientation" : "portrait",
|
|
28
|
+
"scale" : "2x"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"size" : "320x480",
|
|
32
|
+
"orientation" : "portrait",
|
|
33
|
+
"idiom" : "iphone",
|
|
34
|
+
"extent" : "full-screen",
|
|
35
|
+
"minimum-system-version" : "7.0",
|
|
36
|
+
"scale" : "2x"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"size" : "320x568",
|
|
40
|
+
"extent" : "full-screen",
|
|
41
|
+
"idiom" : "iphone",
|
|
42
|
+
"subtype" : "retina4",
|
|
43
|
+
"minimum-system-version" : "7.0",
|
|
44
|
+
"orientation" : "portrait",
|
|
45
|
+
"scale" : "2x"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"size" : "768x1024",
|
|
49
|
+
"orientation" : "portrait",
|
|
50
|
+
"idiom" : "ipad",
|
|
51
|
+
"extent" : "full-screen",
|
|
52
|
+
"minimum-system-version" : "7.0",
|
|
53
|
+
"scale" : "1x"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"size" : "1024x768",
|
|
57
|
+
"orientation" : "landscape",
|
|
58
|
+
"idiom" : "ipad",
|
|
59
|
+
"extent" : "full-screen",
|
|
60
|
+
"minimum-system-version" : "7.0",
|
|
61
|
+
"scale" : "1x"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"size" : "768x1024",
|
|
65
|
+
"orientation" : "portrait",
|
|
66
|
+
"idiom" : "ipad",
|
|
67
|
+
"extent" : "full-screen",
|
|
68
|
+
"minimum-system-version" : "7.0",
|
|
69
|
+
"scale" : "2x"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"size" : "1024x768",
|
|
73
|
+
"orientation" : "landscape",
|
|
74
|
+
"idiom" : "ipad",
|
|
75
|
+
"extent" : "full-screen",
|
|
76
|
+
"minimum-system-version" : "7.0",
|
|
77
|
+
"scale" : "2x"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"size" : "320x480",
|
|
81
|
+
"orientation" : "portrait",
|
|
82
|
+
"idiom" : "iphone",
|
|
83
|
+
"extent" : "full-screen",
|
|
84
|
+
"scale" : "1x"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"size" : "320x480",
|
|
88
|
+
"orientation" : "portrait",
|
|
89
|
+
"idiom" : "iphone",
|
|
90
|
+
"extent" : "full-screen",
|
|
91
|
+
"scale" : "2x"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"size" : "320x568",
|
|
95
|
+
"orientation" : "portrait",
|
|
96
|
+
"idiom" : "iphone",
|
|
97
|
+
"extent" : "full-screen",
|
|
98
|
+
"subtype" : "retina4",
|
|
99
|
+
"scale" : "2x"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"size" : "768x1004",
|
|
103
|
+
"orientation" : "portrait",
|
|
104
|
+
"idiom" : "ipad",
|
|
105
|
+
"extent" : "to-status-bar",
|
|
106
|
+
"scale" : "1x"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"size" : "768x1024",
|
|
110
|
+
"orientation" : "portrait",
|
|
111
|
+
"idiom" : "ipad",
|
|
112
|
+
"extent" : "full-screen",
|
|
113
|
+
"scale" : "1x"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"size" : "1024x748",
|
|
117
|
+
"orientation" : "landscape",
|
|
118
|
+
"idiom" : "ipad",
|
|
119
|
+
"extent" : "to-status-bar",
|
|
120
|
+
"scale" : "1x"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"size" : "1024x768",
|
|
124
|
+
"orientation" : "landscape",
|
|
125
|
+
"idiom" : "ipad",
|
|
126
|
+
"extent" : "full-screen",
|
|
127
|
+
"scale" : "1x"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"size" : "768x1004",
|
|
131
|
+
"orientation" : "portrait",
|
|
132
|
+
"idiom" : "ipad",
|
|
133
|
+
"extent" : "to-status-bar",
|
|
134
|
+
"scale" : "2x"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"size" : "768x1024",
|
|
138
|
+
"orientation" : "portrait",
|
|
139
|
+
"idiom" : "ipad",
|
|
140
|
+
"extent" : "full-screen",
|
|
141
|
+
"scale" : "2x"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"size" : "1024x748",
|
|
145
|
+
"orientation" : "landscape",
|
|
146
|
+
"idiom" : "ipad",
|
|
147
|
+
"extent" : "to-status-bar",
|
|
148
|
+
"scale" : "2x"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"size" : "1024x768",
|
|
152
|
+
"orientation" : "landscape",
|
|
153
|
+
"idiom" : "ipad",
|
|
154
|
+
"extent" : "full-screen",
|
|
155
|
+
"scale" : "2x"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"info" : {
|
|
159
|
+
"version" : 1,
|
|
160
|
+
"author" : "xcode"
|
|
161
|
+
}
|
|
162
|
+
}
|
data/lib/acbaker.rb
ADDED
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require 'acbaker'
|
|
3
|
+
|
|
4
|
+
class AcbakerTest < Minitest::Test
|
|
5
|
+
|
|
6
|
+
def test_initialize
|
|
7
|
+
FileUtils.mkdir("tmp") if not File.directory?("tmp")
|
|
8
|
+
asset_pack = Acbaker::AssetPack.new(:AppIcon)
|
|
9
|
+
assert_equal :AppIcon, asset_pack.type
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_appicon
|
|
13
|
+
FileUtils.mkdir_p("tmp/AppIcon.appiconset") if not File.directory?("tmp/AppIcon.appiconset")
|
|
14
|
+
asset_pack = Acbaker::AssetPack.new(:AppIcon)
|
|
15
|
+
asset_pack.process("test/assets/AppIcon.png", "tmp/AppIcon.appiconset")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_launchimage
|
|
19
|
+
FileUtils.mkdir_p("tmp/LaunchImage.launchimage") if not File.directory?("tmp/LaunchImage.launchimage")
|
|
20
|
+
asset_pack = Acbaker::AssetPack.new(:LaunchImage)
|
|
21
|
+
asset_pack.process("test/assets/LaunchImage.png", "tmp/LaunchImage.launchimage")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: acbaker
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Tobias Strebitzer
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: commander
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '4.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.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: '1.8'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ~>
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1.8'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ~>
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '10.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ~>
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '10.0'
|
|
55
|
+
description: This gem allows easy conversion and management of xcode asset catalogs.
|
|
56
|
+
email:
|
|
57
|
+
- tobias.strebitzer@magloft.com
|
|
58
|
+
executables:
|
|
59
|
+
- acbaker
|
|
60
|
+
extensions: []
|
|
61
|
+
extra_rdoc_files: []
|
|
62
|
+
files:
|
|
63
|
+
- .gitignore
|
|
64
|
+
- README.md
|
|
65
|
+
- Rakefile
|
|
66
|
+
- acbaker.gemspec
|
|
67
|
+
- bin/acbaker
|
|
68
|
+
- lib/acbaker.rb
|
|
69
|
+
- lib/acbaker/asset_pack.rb
|
|
70
|
+
- lib/acbaker/commands.rb
|
|
71
|
+
- lib/acbaker/commands/pack.rb
|
|
72
|
+
- lib/acbaker/config/AppIcon.json
|
|
73
|
+
- lib/acbaker/config/LaunchImage.json
|
|
74
|
+
- lib/acbaker/version.rb
|
|
75
|
+
- test/assets/AppIcon.png
|
|
76
|
+
- test/assets/LaunchImage.png
|
|
77
|
+
- test/test_acbaker.rb
|
|
78
|
+
homepage: http://www.magloft.com
|
|
79
|
+
licenses:
|
|
80
|
+
- BSD-3-Clause
|
|
81
|
+
metadata: {}
|
|
82
|
+
post_install_message:
|
|
83
|
+
rdoc_options: []
|
|
84
|
+
require_paths:
|
|
85
|
+
- lib
|
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - '>='
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: '0'
|
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - '>='
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: 1.3.6
|
|
96
|
+
requirements: []
|
|
97
|
+
rubyforge_project:
|
|
98
|
+
rubygems_version: 2.4.5
|
|
99
|
+
signing_key:
|
|
100
|
+
specification_version: 4
|
|
101
|
+
summary: Convert any source images into xcode asset catalogs.
|
|
102
|
+
test_files: []
|