flavours 0.0.1
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/Gemfile +4 -0
- data/Gemfile.lock +33 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +9 -0
- data/bin/flavours +21 -0
- data/lib/flavours.rb +9 -0
- data/lib/flavours/colors.rb +23 -0
- data/lib/flavours/commands.rb +4 -0
- data/lib/flavours/commands/create.rb +58 -0
- data/lib/flavours/commands/install.rb +29 -0
- data/lib/flavours/gradle.rb +12 -0
- data/lib/flavours/images.rb +365 -0
- data/lib/flavours/json.rb +76 -0
- data/lib/flavours/version.rb +9 -0
- metadata +173 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eff92d118fd473cd645dc970ad03af135c32000c
|
4
|
+
data.tar.gz: c54b498fb3019205df630cf08017b44af1584f41
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d553d98b6b6d4ebef44ec40033bb42dd928fd199179db3d58aa1f240d0ba33adfd9d49e6afcd0855e0adfd1436336892357eae49232b7351ee4e8e4fe94b53c0
|
7
|
+
data.tar.gz: ccef20ef3c239c924bda529d91a0065028940d6469671ac950767a0acd07ad0f4825b6f957f92a9c283d5593854e1271313e3b3b081a0e8ec73e73b773d2e096
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
flavours (0.0.1)
|
5
|
+
bundler (~> 1.3)
|
6
|
+
commander (~> 4.2)
|
7
|
+
dotenv (~> 0.11)
|
8
|
+
fileutils
|
9
|
+
json
|
10
|
+
rmagick (~> 2.13.2)
|
11
|
+
|
12
|
+
GEM
|
13
|
+
remote: https://rubygems.org/
|
14
|
+
specs:
|
15
|
+
commander (4.2.0)
|
16
|
+
highline (~> 1.6.11)
|
17
|
+
dotenv (0.11.1)
|
18
|
+
dotenv-deployment (~> 0.0.2)
|
19
|
+
dotenv-deployment (0.0.2)
|
20
|
+
fileutils (0.7)
|
21
|
+
rmagick (>= 2.13.1)
|
22
|
+
highline (1.6.20)
|
23
|
+
json (1.8.1)
|
24
|
+
rake (10.3.1)
|
25
|
+
rmagick (2.13.2)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
bundler (~> 1.3)
|
32
|
+
flavours!
|
33
|
+
rake
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Ben Gordon
|
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
|
+
# Flavours
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'flavours'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install flavours
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
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 new Pull Request
|
data/Rakefile
ADDED
data/bin/flavours
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'dotenv'
|
4
|
+
Dotenv.load
|
5
|
+
|
6
|
+
require 'commander/import'
|
7
|
+
|
8
|
+
$:.push File.expand_path("../../lib", __FILE__)
|
9
|
+
require 'flavours'
|
10
|
+
|
11
|
+
HighLine.track_eof = false # Fix for built-in Ruby
|
12
|
+
program :version, Flavours::VERSION
|
13
|
+
program :description, 'One codebase. Multiple Google Play Store submission APKs with different buildConfigs, package names, icons, etc.'
|
14
|
+
|
15
|
+
program :help, 'Author', 'Benjamin Gordon (@bennyguitar) for Intermark Group <interactive@intermarkgroup.com>'
|
16
|
+
program :help, 'Website', 'https://github.com/intermark'
|
17
|
+
program :help_formatter, :compact
|
18
|
+
|
19
|
+
global_option('--dontlog') { $nolog = true }
|
20
|
+
|
21
|
+
default_command :help
|
data/lib/flavours.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Flavours
|
2
|
+
# Main Colorize Functions
|
3
|
+
def self.colorize(text, color_code)
|
4
|
+
puts "\e[#{color_code}m#{text}\e[0m"
|
5
|
+
end
|
6
|
+
|
7
|
+
# Specific Colors
|
8
|
+
def self.red(text)
|
9
|
+
colorize(text, 31)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.green(text)
|
13
|
+
colorize(text, 32)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.blue(text)
|
17
|
+
colorize(text, 36)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.purple(text)
|
21
|
+
colorize(text, 35)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
$:.push File.expand_path('../../', __FILE__)
|
2
|
+
require 'fileutils'
|
3
|
+
require 'flavours/colors'
|
4
|
+
require 'flavours/images'
|
5
|
+
require 'flavours/json'
|
6
|
+
require 'flavours/gradle'
|
7
|
+
require 'json'
|
8
|
+
|
9
|
+
command :create do |c|
|
10
|
+
c.syntax = 'flavours create [options]'
|
11
|
+
c.summary = 'Creates/updates a target or all targets in your workspace or project.'
|
12
|
+
c.description = ''
|
13
|
+
c.option '-m', '--module MODULE', 'Name of the module to edit.'
|
14
|
+
c.option '-d', '--directory DIRECTORY', 'Path where the module lives.'
|
15
|
+
c.option '-u', '--url URL', 'URL of a Flavours formatted JSON file.'
|
16
|
+
|
17
|
+
c.action do |args, options|
|
18
|
+
# Check for newer version
|
19
|
+
Flavours::check_for_newer_version unless $nolog
|
20
|
+
|
21
|
+
# Set Up
|
22
|
+
@module = options.module ? options.module : nil
|
23
|
+
@directory = options.directory ? options.directory : Dir.pwd
|
24
|
+
@url = options.url ? options.url : nil
|
25
|
+
@flavours = []
|
26
|
+
|
27
|
+
# Create JSON object
|
28
|
+
if @url
|
29
|
+
obj = Flavours::json_object_from_url @url
|
30
|
+
else
|
31
|
+
obj = Flavours::json_object_from_directory @directory
|
32
|
+
end
|
33
|
+
|
34
|
+
# Break if Bad
|
35
|
+
unless obj || Flavours::lint_json_object(obj)
|
36
|
+
Flavours::red "\n Invalid JSON. Please lint the file, and try again.\n"
|
37
|
+
next
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
# Check for Target Name
|
42
|
+
if @module
|
43
|
+
obj['flavours'].each do |t|
|
44
|
+
@flavours << t
|
45
|
+
end
|
46
|
+
|
47
|
+
if @flavours.length == 0
|
48
|
+
Flavours::red "\n No flavours found in the flavours.json file.\n"
|
49
|
+
next
|
50
|
+
end
|
51
|
+
|
52
|
+
# Create Them
|
53
|
+
Flavours::create @flavours
|
54
|
+
else
|
55
|
+
Flavours::red "\n Module must be specified using the -m or --module option.\n"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
$:.push File.expand_path('../../', __FILE__)
|
2
|
+
require 'fileutils'
|
3
|
+
require 'flavours'
|
4
|
+
|
5
|
+
command :install do |c|
|
6
|
+
c.syntax = 'flavours install [options]'
|
7
|
+
c.summary = 'Creates the required files in your directory.'
|
8
|
+
c.description = ''
|
9
|
+
c.option '-d', '--directory DIRECTORY', 'Path where the .xcproj or .xcworkspace file && the longbow.json file live.'
|
10
|
+
|
11
|
+
c.action do |args, options|
|
12
|
+
# Check for newer version
|
13
|
+
# Longbow::check_for_newer_version unless $nolog
|
14
|
+
|
15
|
+
# Set Up
|
16
|
+
@directory = options.directory ? options.directory : Dir.pwd
|
17
|
+
@json_path = @directory + '/flavours.json'
|
18
|
+
|
19
|
+
# Install
|
20
|
+
if File.exist?(@json_path)
|
21
|
+
Flavours::red ' flavours.json already exists at ' + @json_path
|
22
|
+
else
|
23
|
+
File.open(@json_path, 'w') do |f|
|
24
|
+
f.write(Flavours::base_json_file_string)
|
25
|
+
end
|
26
|
+
Flavours::green ' flavours.json created' unless $nolog
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,365 @@
|
|
1
|
+
$:.push File.expand_path('../', __FILE__)
|
2
|
+
# require 'mini_magick'
|
3
|
+
require 'RMagick'
|
4
|
+
include Magick
|
5
|
+
require 'colors'
|
6
|
+
require 'open-uri'
|
7
|
+
|
8
|
+
module Flavours
|
9
|
+
|
10
|
+
# Images
|
11
|
+
def self.create_images directory, t, obj
|
12
|
+
# Bad Params
|
13
|
+
if !directory || !t || !obj
|
14
|
+
return false
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get Device Information
|
18
|
+
iPhone = obj['devices'].include? 'iPhone'
|
19
|
+
iPad = obj['devices'].include? 'iPad'
|
20
|
+
|
21
|
+
# Resize Icons
|
22
|
+
resize_icons directory, t, iPhone, iPad
|
23
|
+
|
24
|
+
# Resize Launch Images
|
25
|
+
resize_launch_images directory, t
|
26
|
+
|
27
|
+
# Write JSON for Icon Assets
|
28
|
+
write_json_for_icons directory, t, iPhone, iPad
|
29
|
+
|
30
|
+
# Write JSON for Launch Assets
|
31
|
+
write_json_for_launch_images directory, t
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
# Create & Resize Icons
|
37
|
+
def self.resize_icons directory, t, iPhone, iPad
|
38
|
+
# Set Up
|
39
|
+
target = t['name']
|
40
|
+
|
41
|
+
# Get Image Information
|
42
|
+
img_path = ''
|
43
|
+
if t['icon_url']
|
44
|
+
img_path = self.path_for_downloaded_image_from_url directory, target, t['icon_url'], 'icons'
|
45
|
+
elsif t['icon_path']
|
46
|
+
img_path = directory + '/' + t['icon_path']
|
47
|
+
end
|
48
|
+
|
49
|
+
# Make directory
|
50
|
+
img_dir = make_asset_directory directory, target, '.appiconset/'
|
51
|
+
|
52
|
+
# Resize
|
53
|
+
image_sizes = []
|
54
|
+
image_sizes += ['120x120', '114x114', '80x80', '58x58', '57x57', '29x29'] if iPhone
|
55
|
+
image_sizes += ['152x152', '144x144', '100x100', '80x80', '76x76', '72x72', '58x58', '50x50', '40x40', '29x29'] if iPad
|
56
|
+
image_sizes.uniq.each do |size|
|
57
|
+
image = Image.read(img_path).first
|
58
|
+
next unless image
|
59
|
+
resize_image_to_directory img_dir, image, size, 'icon'
|
60
|
+
end
|
61
|
+
|
62
|
+
Flavours::green (' - Created Icon images for ' + target) unless $nolog
|
63
|
+
return true
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
# Create & Resize Launch Images
|
68
|
+
def self.resize_launch_images directory, t
|
69
|
+
# Set Up
|
70
|
+
target = t['name']
|
71
|
+
|
72
|
+
['launch_phone_p', 'launch_phone_l', 'launch_tablet_p', 'launch_tablet_l'].each do |key|
|
73
|
+
if t[key + '_url']
|
74
|
+
img_path = self.path_for_downloaded_image_from_url directory, key + '_' + target, t[key + '_url'], 'launch'
|
75
|
+
elsif t[key + '_path']
|
76
|
+
img_path = directory + '/' + t[key + '_path']
|
77
|
+
else
|
78
|
+
next
|
79
|
+
end
|
80
|
+
|
81
|
+
# Make directory
|
82
|
+
img_dir = make_asset_directory directory, target, '.launchimage/'
|
83
|
+
|
84
|
+
# Make resize sizes
|
85
|
+
sizes = []
|
86
|
+
if key == 'launch_phone_p'
|
87
|
+
sizes = ['640x1136','640x960','320x480']
|
88
|
+
elsif key == 'launch_phone_l'
|
89
|
+
sizes = ['1136x640','960x640','480x320']
|
90
|
+
elsif key == 'launch_tablet_p'
|
91
|
+
sizes = ['1536x2048','768x1024','1536x2008','768x1004']
|
92
|
+
elsif key == 'launch_tablet_l'
|
93
|
+
sizes = ['2048x1536','1024x768','2048x1496','1024x748']
|
94
|
+
end
|
95
|
+
|
96
|
+
# Resize Images
|
97
|
+
sizes.each do |size|
|
98
|
+
image = Image.read(img_path).first
|
99
|
+
return false unless image
|
100
|
+
resize_image_to_directory img_dir, image, size, key + '_'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
Flavours::green (' - Created Launch images for ' + target) unless $nolog
|
105
|
+
return true
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
# Resize Image to Directory
|
110
|
+
def self.resize_image_to_directory directory, image, size, tag
|
111
|
+
sizes = size.split('x')
|
112
|
+
new_w = Integer(sizes[0])
|
113
|
+
new_h = Integer(sizes[1])
|
114
|
+
image.resize_to_fill! new_w, new_h
|
115
|
+
image.write directory + '/' + tag + size + '.png'
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
# Create JSON
|
120
|
+
def self.write_json_for_icons directory, t, iPhone, iPad
|
121
|
+
# Set Up
|
122
|
+
target = t['name']
|
123
|
+
|
124
|
+
# Make directory
|
125
|
+
img_dir = make_asset_directory directory, target, '.appiconset/'
|
126
|
+
|
127
|
+
# Write the JSON file
|
128
|
+
File.open(img_dir + '/Contents.json', 'w') do |f|
|
129
|
+
f.write('{ "images" : [ ')
|
130
|
+
|
131
|
+
if iPhone
|
132
|
+
f.write( '{ "size" : "29x29", "idiom" : "iphone", "filename" : "icon58x58.png", "scale" : "2x" }, { "size" : "40x40", "idiom" : "iphone", "filename" : "icon80x80.png", "scale" : "2x" }, { "size" : "60x60", "idiom" : "iphone", "filename" : "icon120x120.png", "scale" : "2x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "icon29x29.png", "scale" : "1x" }, { "size" : "57x57", "idiom" : "iphone", "filename" : "icon57x57.png", "scale" : "1x" }, { "size" : "57x57", "idiom" : "iphone", "filename" : "icon114x114.png", "scale" : "2x" }' + (iPad ? ',' : ''))
|
133
|
+
end
|
134
|
+
|
135
|
+
if iPad
|
136
|
+
f.write( '{ "idiom" : "ipad", "size" : "29x29", "scale" : "1x", "filename" : "icon29x29.png" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "2x", "filename" : "icon58x58.png" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "1x", "filename" : "icon40x40.png" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "2x", "filename" : "icon80x80.png" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "1x", "filename" : "icon76x76.png" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "2x", "filename" : "icon152x152.png" }, { "idiom" : "ipad", "size" : "50x50", "scale" : "1x", "filename" : "icon50x50.png" }, { "idiom" : "ipad", "size" : "50x50", "scale" : "2x", "filename" : "icon100x100.png" }, { "idiom" : "ipad", "size" : "72x72", "scale" : "1x", "filename" : "icon72x72.png" }, { "idiom" : "ipad", "size" : "72x72", "scale" : "2x", "filename" : "icon144x144.png" }')
|
137
|
+
end
|
138
|
+
|
139
|
+
f.write(' ], "info" : { "version" : 1, "author" : "xcode" }, "properties" : { "pre-rendered" : true } }')
|
140
|
+
end
|
141
|
+
|
142
|
+
# Return true
|
143
|
+
Flavours::green (' - Created Images.xcassets icon set for ' + target) unless $nolog
|
144
|
+
return true
|
145
|
+
end
|
146
|
+
|
147
|
+
|
148
|
+
# JSON for Launch Images
|
149
|
+
def self.write_json_for_launch_images directory, t
|
150
|
+
# Set Up
|
151
|
+
target = t['name']
|
152
|
+
phone_portrait = t['launch_phone_p_url'] || t['launch_phone_p_path']
|
153
|
+
phone_landscape = t['launch_phone_l_url'] || t['launch_phone_l_path']
|
154
|
+
tablet_portrait = t['launch_tablet_p_url'] || t['launch_tablet_p_path']
|
155
|
+
tablet_landscape = t['launch_tablet_l_url'] || t['launch_tablet_l_path']
|
156
|
+
return false unless phone_portrait || phone_landscape || tablet_landscape || tablet_portrait
|
157
|
+
|
158
|
+
# Make Directory
|
159
|
+
img_dir = make_asset_directory directory, target, '.launchimage/'
|
160
|
+
|
161
|
+
File.open(img_dir + '/Contents.json', 'w') do |f|
|
162
|
+
f.write('{"images" : [')
|
163
|
+
|
164
|
+
if phone_portrait
|
165
|
+
f.write('{
|
166
|
+
"orientation" : "portrait",
|
167
|
+
"idiom" : "iphone",
|
168
|
+
"extent" : "full-screen",
|
169
|
+
"minimum-system-version" : "7.0",
|
170
|
+
"filename" : "launch_phone_p_640x960.png",
|
171
|
+
"scale" : "2x"
|
172
|
+
},
|
173
|
+
{
|
174
|
+
"extent" : "full-screen",
|
175
|
+
"idiom" : "iphone",
|
176
|
+
"subtype" : "retina4",
|
177
|
+
"filename" : "launch_phone_p_640x1136.png",
|
178
|
+
"minimum-system-version" : "7.0",
|
179
|
+
"orientation" : "portrait",
|
180
|
+
"scale" : "2x"
|
181
|
+
},
|
182
|
+
{
|
183
|
+
"orientation" : "portrait",
|
184
|
+
"idiom" : "iphone",
|
185
|
+
"extent" : "full-screen",
|
186
|
+
"filename" : "launch_phone_p_320x480.png",
|
187
|
+
"scale" : "1x"
|
188
|
+
},
|
189
|
+
{
|
190
|
+
"orientation" : "portrait",
|
191
|
+
"idiom" : "iphone",
|
192
|
+
"extent" : "full-screen",
|
193
|
+
"filename" : "launch_phone_p_640x960.png",
|
194
|
+
"scale" : "2x"
|
195
|
+
},
|
196
|
+
{
|
197
|
+
"orientation" : "portrait",
|
198
|
+
"idiom" : "iphone",
|
199
|
+
"extent" : "full-screen",
|
200
|
+
"subtype" : "retina4",
|
201
|
+
"filename" : "launch_phone_p_640x1136.png",
|
202
|
+
"scale" : "2x"
|
203
|
+
}')
|
204
|
+
f.write ',' if phone_landscape || tablet_portrait || tablet_landscape
|
205
|
+
end
|
206
|
+
|
207
|
+
if phone_landscape
|
208
|
+
f.write('{
|
209
|
+
"orientation" : "landscape",
|
210
|
+
"idiom" : "iphone",
|
211
|
+
"extent" : "full-screen",
|
212
|
+
"minimum-system-version" : "7.0",
|
213
|
+
"filename" : "launch_phone_l_960x640.png",
|
214
|
+
"scale" : "2x"
|
215
|
+
},
|
216
|
+
{
|
217
|
+
"extent" : "full-screen",
|
218
|
+
"idiom" : "iphone",
|
219
|
+
"subtype" : "retina4",
|
220
|
+
"filename" : "launch_phone_l_1136x640.png",
|
221
|
+
"minimum-system-version" : "7.0",
|
222
|
+
"orientation" : "landscape",
|
223
|
+
"scale" : "2x"
|
224
|
+
},
|
225
|
+
{
|
226
|
+
"orientation" : "landscape",
|
227
|
+
"idiom" : "iphone",
|
228
|
+
"extent" : "full-screen",
|
229
|
+
"filename" : "launch_phone_l_480x320.png",
|
230
|
+
"scale" : "1x"
|
231
|
+
},
|
232
|
+
{
|
233
|
+
"orientation" : "landscape",
|
234
|
+
"idiom" : "iphone",
|
235
|
+
"extent" : "full-screen",
|
236
|
+
"filename" : "launch_phone_l_960x640.png",
|
237
|
+
"scale" : "2x"
|
238
|
+
},
|
239
|
+
{
|
240
|
+
"orientation" : "landscape",
|
241
|
+
"idiom" : "iphone",
|
242
|
+
"extent" : "full-screen",
|
243
|
+
"subtype" : "retina4",
|
244
|
+
"filename" : "launch_phone_l_1136x640.png",
|
245
|
+
"scale" : "2x"
|
246
|
+
}')
|
247
|
+
f.write ',' if tablet_portrait || tablet_landscape
|
248
|
+
end
|
249
|
+
|
250
|
+
if tablet_portrait
|
251
|
+
f.write('{
|
252
|
+
"orientation" : "portrait",
|
253
|
+
"idiom" : "ipad",
|
254
|
+
"extent" : "full-screen",
|
255
|
+
"filename" : "launch_tablet_p_768x1024.png",
|
256
|
+
"minimum-system-version" : "7.0",
|
257
|
+
"scale" : "1x"
|
258
|
+
},
|
259
|
+
{
|
260
|
+
"orientation" : "portrait",
|
261
|
+
"idiom" : "ipad",
|
262
|
+
"extent" : "full-screen",
|
263
|
+
"filename" : "launch_tablet_p_1536x2048.png",
|
264
|
+
"minimum-system-version" : "7.0",
|
265
|
+
"scale" : "2x"
|
266
|
+
},
|
267
|
+
{
|
268
|
+
"orientation" : "portrait",
|
269
|
+
"idiom" : "ipad",
|
270
|
+
"extent" : "to-status-bar",
|
271
|
+
"scale" : "1x",
|
272
|
+
"filename" : "launch_tablet_p_768x1004.png"
|
273
|
+
},
|
274
|
+
{
|
275
|
+
"orientation" : "portrait",
|
276
|
+
"idiom" : "ipad",
|
277
|
+
"extent" : "full-screen",
|
278
|
+
"scale" : "1x",
|
279
|
+
"filename" : "launch_tablet_p_768x1024.png"
|
280
|
+
},
|
281
|
+
{
|
282
|
+
"orientation" : "portrait",
|
283
|
+
"idiom" : "ipad",
|
284
|
+
"extent" : "to-status-bar",
|
285
|
+
"scale" : "2x",
|
286
|
+
"filename" : "launch_tablet_p_1536x2008.png"
|
287
|
+
},
|
288
|
+
{
|
289
|
+
"orientation" : "portrait",
|
290
|
+
"idiom" : "ipad",
|
291
|
+
"extent" : "full-screen",
|
292
|
+
"scale" : "2x",
|
293
|
+
"filename" : "launch_tablet_p_1536x2048.png"
|
294
|
+
}')
|
295
|
+
f.write ',' if tablet_landscape
|
296
|
+
end
|
297
|
+
|
298
|
+
if tablet_landscape
|
299
|
+
f.write('{
|
300
|
+
"orientation" : "landscape",
|
301
|
+
"idiom" : "ipad",
|
302
|
+
"extent" : "full-screen",
|
303
|
+
"filename" : "launch_tablet_l_1024x768.png",
|
304
|
+
"minimum-system-version" : "7.0",
|
305
|
+
"scale" : "1x"
|
306
|
+
},
|
307
|
+
{
|
308
|
+
"orientation" : "landscape",
|
309
|
+
"idiom" : "ipad",
|
310
|
+
"extent" : "full-screen",
|
311
|
+
"filename" : "launch_tablet_l_2048x1536.png",
|
312
|
+
"minimum-system-version" : "7.0",
|
313
|
+
"scale" : "2x"
|
314
|
+
},
|
315
|
+
{
|
316
|
+
"orientation" : "landscape",
|
317
|
+
"idiom" : "ipad",
|
318
|
+
"extent" : "to-status-bar",
|
319
|
+
"scale" : "1x",
|
320
|
+
"filename" : "launch_tablet_l_1024x748.png"
|
321
|
+
},
|
322
|
+
{
|
323
|
+
"orientation" : "landscape",
|
324
|
+
"idiom" : "ipad",
|
325
|
+
"extent" : "full-screen",
|
326
|
+
"scale" : "1x",
|
327
|
+
"filename" : "launch_tablet_l_1024x768.png"
|
328
|
+
},
|
329
|
+
{
|
330
|
+
"orientation" : "landscape",
|
331
|
+
"idiom" : "ipad",
|
332
|
+
"extent" : "to-status-bar",
|
333
|
+
"scale" : "2x",
|
334
|
+
"filename" : "launch_tablet_l_2048x1496.png"
|
335
|
+
},
|
336
|
+
{
|
337
|
+
"orientation" : "landscape",
|
338
|
+
"idiom" : "ipad",
|
339
|
+
"extent" : "full-screen",
|
340
|
+
"scale" : "2x",
|
341
|
+
"filename" : "launch_tablet_l_2048x1536.png"
|
342
|
+
}')
|
343
|
+
end
|
344
|
+
|
345
|
+
f.write('],"info" : {"version" : 1,"author" : "xcode"}}')
|
346
|
+
end
|
347
|
+
|
348
|
+
# Return true
|
349
|
+
Flavours::green (' - Created Images.xcassets launch image set for ' + target) unless $nolog
|
350
|
+
return true
|
351
|
+
end
|
352
|
+
|
353
|
+
# Download Image from URL
|
354
|
+
def self.path_for_downloaded_image_from_url directory, filename, url, folder
|
355
|
+
img_path = directory + '/resources/'+ folder + '/'
|
356
|
+
img_file_name = filename + '.png'
|
357
|
+
FileUtils::mkdir_p img_path
|
358
|
+
File.open(img_path + img_file_name, 'wb') do |f|
|
359
|
+
f.write open(url).read
|
360
|
+
end
|
361
|
+
|
362
|
+
return img_path + img_file_name
|
363
|
+
end
|
364
|
+
|
365
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
$:.push File.expand_path('../', __FILE__)
|
2
|
+
require 'colors'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module Flavours
|
7
|
+
|
8
|
+
def self.json_object_from_directory directory
|
9
|
+
return nil unless directory
|
10
|
+
|
11
|
+
# Check for longbow.json
|
12
|
+
@json_path = directory + '/flavours.json'
|
13
|
+
unless File.exists?(@json_path)
|
14
|
+
Flavours::red "\n Couldn't find flavours.json at #{@json_path}\n"
|
15
|
+
puts " Run this command to install the correct files:\n longbow install\n"
|
16
|
+
return nil
|
17
|
+
end
|
18
|
+
|
19
|
+
# Create hash from longbow.json
|
20
|
+
json_contents = File.open(@json_path).read
|
21
|
+
return json_object_from_string json_contents
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def self.json_object_from_url url
|
26
|
+
return nil unless url
|
27
|
+
contents = ''
|
28
|
+
open(url) {|io| contents = io.read}
|
29
|
+
return json_object_from_string contents
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
def self.json_object_from_string contents
|
34
|
+
begin
|
35
|
+
!!JSON.parse(contents)
|
36
|
+
rescue
|
37
|
+
return nil
|
38
|
+
end
|
39
|
+
|
40
|
+
return JSON.parse(contents)
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def self.lint_json_object obj
|
45
|
+
return false unless obj
|
46
|
+
return false unless obj['flavours']
|
47
|
+
return true
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
def self.base_json_file_string
|
52
|
+
return '{
|
53
|
+
"flavours" : [
|
54
|
+
{
|
55
|
+
"flavourName" : "YourFlavor",
|
56
|
+
"packageName" : "somePackageName",
|
57
|
+
"buildConfig" : {
|
58
|
+
"API_KEY" : "someApiKey",
|
59
|
+
"DEALER_COLOR" : "#E51919"
|
60
|
+
},
|
61
|
+
"iconUrl" : "https://someurl.com/image.png"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"flavourName" : "YourFlavor",
|
65
|
+
"packageName" : "somePackageName",
|
66
|
+
"buildConfig" : {
|
67
|
+
"API_KEY" : "someApiKey",
|
68
|
+
"DEALER_COLOR" : "#E51919"
|
69
|
+
},
|
70
|
+
"iconUrl" : "https://someurl.com/image.png"
|
71
|
+
}
|
72
|
+
]
|
73
|
+
}'
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
metadata
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flavours
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Gordon
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
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: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fileutils
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
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: commander
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.2'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: dotenv
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.11'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.11'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rmagick
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.13.2
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.13.2
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: json
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: One codebase. Multiple Google Play Store submission APKs with different
|
126
|
+
buildConfigs, package names, icons, etc.
|
127
|
+
email:
|
128
|
+
- brgordon@ua.edu
|
129
|
+
executables:
|
130
|
+
- flavours
|
131
|
+
extensions: []
|
132
|
+
extra_rdoc_files: []
|
133
|
+
files:
|
134
|
+
- ./Gemfile
|
135
|
+
- ./Gemfile.lock
|
136
|
+
- ./lib/flavours/colors.rb
|
137
|
+
- ./lib/flavours/commands/create.rb
|
138
|
+
- ./lib/flavours/commands/install.rb
|
139
|
+
- ./lib/flavours/commands.rb
|
140
|
+
- ./lib/flavours/gradle.rb
|
141
|
+
- ./lib/flavours/images.rb
|
142
|
+
- ./lib/flavours/json.rb
|
143
|
+
- ./lib/flavours/version.rb
|
144
|
+
- ./lib/flavours.rb
|
145
|
+
- ./LICENSE.txt
|
146
|
+
- ./Rakefile
|
147
|
+
- ./README.md
|
148
|
+
- bin/flavours
|
149
|
+
homepage: https://github.com/intermark/flavours
|
150
|
+
licenses:
|
151
|
+
- MIT
|
152
|
+
metadata: {}
|
153
|
+
post_install_message:
|
154
|
+
rdoc_options: []
|
155
|
+
require_paths:
|
156
|
+
- lib
|
157
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - '>='
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
requirements: []
|
168
|
+
rubyforge_project:
|
169
|
+
rubygems_version: 2.1.11
|
170
|
+
signing_key:
|
171
|
+
specification_version: 4
|
172
|
+
summary: Fast Product Flavor creation for Android.
|
173
|
+
test_files: []
|