flavours 0.0.8 → 0.0.9
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +15 -1
- data/lib/flavours/images.rb +7 -4
- data/lib/flavours/version.rb +1 -1
- data/lib/flavours/xmlres.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db8b057a0c10547bb8f652e11c98727f925ec758
|
4
|
+
data.tar.gz: 72956258d8d52b681c03e91ab0d96ece4927664f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11bf9e38e7e84929b5dabd320358e664efb7f11cf5515f8f28e06762e3152e95101c9208f7ccac540a41915100310bbf38b4cb07b66089912e04b1fda8ed5e56
|
7
|
+
data.tar.gz: 223ec607bb586d9ca58d107c914b5d928b1abee3016b9dc9bc3f9741ff39459cfaf0c09fcd87cec41af2ceef13705ac7605de20ea9db21e1e60b6c9ae4d480c7
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -86,12 +86,13 @@ In the top-level of the JSON file, we have the main key/value pair:
|
|
86
86
|
This section contains an array of key/value pairs that correspond to each product flavor you'd like to create. Here are all of the possiblities:
|
87
87
|
|
88
88
|
* `flavourName`
|
89
|
-
* `iconURL`
|
89
|
+
* `iconURL` or `iconPath`
|
90
90
|
* `packageName`
|
91
91
|
* `buildConfig`
|
92
92
|
* `colorsXML`
|
93
93
|
* `stringsXML`
|
94
94
|
* `settingsXML`
|
95
|
+
* `drawables`
|
95
96
|
|
96
97
|
`flavourName` is required to build that Product Flavor. However, the other options are all optional. `[buildConfig, colorsXML, stringsXML]` all house more key/values that will be be turned in to XML, or `String` properties in the `BuildConfig.java` file specific to that Flavor.
|
97
98
|
|
@@ -111,6 +112,19 @@ This results in a settings.xml file where the lines look like this:
|
|
111
112
|
|
112
113
|
`<item name="NAME" type="TYPE">VALUE</item>`
|
113
114
|
|
115
|
+
`drawables` also has a slightly different format. It's an array of objects with key/value pairs like `settingsXML` is, but the pairs are slightly different.
|
116
|
+
|
117
|
+
```
|
118
|
+
"drawables": [
|
119
|
+
{
|
120
|
+
"name": "some_image.png",
|
121
|
+
"path": "path/relative/to/project/an_image.png"
|
122
|
+
}
|
123
|
+
]
|
124
|
+
```
|
125
|
+
|
126
|
+
What this does is finds an image relative to your directory at the specified `path` key/value and then makes a copy of it to the appropriate `{flavour}/res/drawable` folder. It doesn't permanently move your file, just duplicates it in the correct spot. It puts it in a general drawable folder instead of one like drawable-hdpi.
|
127
|
+
|
114
128
|
## Creating Flavors
|
115
129
|
|
116
130
|
Now that you're set up - it's time to run this bad boy! Make sure that you have updated your `flavours.json` file with the correct information for your apps, and then run the following command inside the project directory.
|
data/lib/flavours/images.rb
CHANGED
@@ -16,7 +16,7 @@ module Flavours
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# Resize Icons
|
19
|
-
resize_icons directory, m, flavour_hash
|
19
|
+
resize_icons directory, m, flavour_hash
|
20
20
|
|
21
21
|
# Move Drawables
|
22
22
|
move_drawables directory, m, flavour_hash if flavour_hash['drawables']
|
@@ -29,20 +29,23 @@ module Flavours
|
|
29
29
|
name = flavour_hash['flavourName']
|
30
30
|
|
31
31
|
# Get Image Information
|
32
|
+
img_path = ''
|
32
33
|
if flavour_hash['iconUrl']
|
33
34
|
img_path = self.path_for_downloaded_image_from_url directory, name, flavour_hash['iconUrl'], 'icons'
|
34
|
-
|
35
|
+
elsif flavour_hash['iconPath']
|
35
36
|
img_path = "#{directory}/#{flavour_hash['iconPath']}"
|
37
|
+
else
|
38
|
+
return
|
36
39
|
end
|
37
40
|
|
38
41
|
# Make Assets Directory
|
39
|
-
drawables = ['drawable-xxhdpi','drawable-xhdpi','drawable-hdpi','drawable-mdpi']
|
42
|
+
drawables = ['drawable-xxxhdpi','drawable-xxhdpi','drawable-xhdpi','drawable-hdpi','drawable-mdpi']
|
40
43
|
drawables.each do |d|
|
41
44
|
Flavours::make_asset_directory directory, m, name, d
|
42
45
|
end
|
43
46
|
|
44
47
|
# Resize
|
45
|
-
image_sizes = ['144x144', '96x96', '72x72', '48x48']
|
48
|
+
image_sizes = ['192x192', '144x144', '96x96', '72x72', '48x48']
|
46
49
|
image_sizes.each_index do |i|
|
47
50
|
size = image_sizes[i]
|
48
51
|
drawable = drawables[i]
|
data/lib/flavours/version.rb
CHANGED
data/lib/flavours/xmlres.rb
CHANGED
@@ -48,6 +48,6 @@ module Flavours
|
|
48
48
|
# Resource String
|
49
49
|
def self.res_string res, name, value, type
|
50
50
|
type_string = type ? " type=\"#{type}\"" : ''
|
51
|
-
return " <#{res} name=\"#{name}\"#{type_string}>#{value.
|
51
|
+
return " <#{res} name=\"#{name}\"#{type_string}>#{value.gsub("'", %q(\\\'))}</#{res}>\n"
|
52
52
|
end
|
53
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flavours
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Gordon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|