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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: edcd019cc082e2e4baf676a34e1d61ee9bf61969
4
- data.tar.gz: 9850b6c15da1d8d722484c53c93ed89c27ef2664
3
+ metadata.gz: e38ae2c5aaba370596e63a6d495a74e96eceedb6
4
+ data.tar.gz: 4609484c94ef031a48d6b4eb09df8d80d0305d9d
5
5
  SHA512:
6
- metadata.gz: e7163dc4cc37e991f3947acd2169aee860d6be3283cc41e10d66505472355fe1e2ef5654088d6acff40d340abf46198634ba0a6f8a7b5bf5de34f9f5f191c062
7
- data.tar.gz: 157a4f4bf6b7fa7cc9b392db0e0fd7a0c10665813d99b396ea7420e85c74fbed1ac7b5fcfb19c3963c3d261dd6f537109d0dcb7736a35b031753314236b4c64d
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.
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Flavours
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
 
4
4
  def self.check_for_newer_version
5
5
  unless Gem.latest_version_for('flavours').to_s == VERSION
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.7
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-21 00:00:00.000000000 Z
11
+ date: 2014-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler