flavours 0.0.7 → 0.0.8
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/README.md +17 -0
- data/lib/flavours/images.rb +28 -0
- data/lib/flavours/version.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: e38ae2c5aaba370596e63a6d495a74e96eceedb6
|
4
|
+
data.tar.gz: 4609484c94ef031a48d6b4eb09df8d80d0305d9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2246e0e10acb416ba30ce82ac02a9f4931b30e7e00f15f6dff6f5320a14a08d29ca6e4477358b41b3b18c9c82f32f3e480ebbde409af4aa2723b0df548712c14
|
7
|
+
data.tar.gz: a8d6023db6a6801694792bc40737da37cda1b3d2d4ecae48cc0ac5390b7183e1b86b19fe02aceb62e77bba03767bc12774c8c0c2fef9afe5abd3720ffbfbe2d0
|
data/README.md
CHANGED
@@ -91,9 +91,26 @@ This section contains an array of key/value pairs that correspond to each produc
|
|
91
91
|
* `buildConfig`
|
92
92
|
* `colorsXML`
|
93
93
|
* `stringsXML`
|
94
|
+
* `settingsXML`
|
94
95
|
|
95
96
|
`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.
|
96
97
|
|
98
|
+
`settingsXML` has a slightly different format. It's an array of objects with key/value pairs:
|
99
|
+
|
100
|
+
```
|
101
|
+
"settingsXML": [
|
102
|
+
{
|
103
|
+
"type": "drawable",
|
104
|
+
"name": "someDrawable",
|
105
|
+
"value": "@drawable/someDrawable"
|
106
|
+
}
|
107
|
+
]
|
108
|
+
```
|
109
|
+
|
110
|
+
This results in a settings.xml file where the lines look like this:
|
111
|
+
|
112
|
+
`<item name="NAME" type="TYPE">VALUE</item>`
|
113
|
+
|
97
114
|
## Creating Flavors
|
98
115
|
|
99
116
|
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
@@ -17,6 +17,9 @@ module Flavours
|
|
17
17
|
|
18
18
|
# Resize Icons
|
19
19
|
resize_icons directory, m, flavour_hash if flavour_hash['iconURL'] || flavour_hash['iconPath']
|
20
|
+
|
21
|
+
# Move Drawables
|
22
|
+
move_drawables directory, m, flavour_hash if flavour_hash['drawables']
|
20
23
|
end
|
21
24
|
|
22
25
|
|
@@ -76,4 +79,29 @@ module Flavours
|
|
76
79
|
return img_path + img_file_name
|
77
80
|
end
|
78
81
|
|
82
|
+
|
83
|
+
# Move Drawables
|
84
|
+
def self.move_drawables directory, m, flavour_hash
|
85
|
+
imgs = flavour_hash['drawables']
|
86
|
+
if imgs && imgs.kind_of?(Array)
|
87
|
+
imgs.each do |i|
|
88
|
+
move_drawable directory, m, flavour_hash, i
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
# Move Drawable
|
95
|
+
def self.move_drawable directory, m, flavour_hash, i
|
96
|
+
# Set Up
|
97
|
+
f_name = flavour_hash['flavourName']
|
98
|
+
# Make Path
|
99
|
+
Flavours::make_asset_directory directory, m, f_name, 'drawable'
|
100
|
+
# Find Image
|
101
|
+
image = Image.read("#{directory}/#{i['path']}").first
|
102
|
+
if image
|
103
|
+
image.write "#{Flavours::file_path_with_folder_name(directory, 'drawable', m, f_name)}/#{i['name']}"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
79
107
|
end
|
data/lib/flavours/version.rb
CHANGED
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.8
|
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-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|