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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e38ae2c5aaba370596e63a6d495a74e96eceedb6
4
- data.tar.gz: 4609484c94ef031a48d6b4eb09df8d80d0305d9d
3
+ metadata.gz: db8b057a0c10547bb8f652e11c98727f925ec758
4
+ data.tar.gz: 72956258d8d52b681c03e91ab0d96ece4927664f
5
5
  SHA512:
6
- metadata.gz: 2246e0e10acb416ba30ce82ac02a9f4931b30e7e00f15f6dff6f5320a14a08d29ca6e4477358b41b3b18c9c82f32f3e480ebbde409af4aa2723b0df548712c14
7
- data.tar.gz: a8d6023db6a6801694792bc40737da37cda1b3d2d4ecae48cc0ac5390b7183e1b86b19fe02aceb62e77bba03767bc12774c8c0c2fef9afe5abd3720ffbfbe2d0
6
+ metadata.gz: 11bf9e38e7e84929b5dabd320358e664efb7f11cf5515f8f28e06762e3152e95101c9208f7ccac540a41915100310bbf38b4cb07b66089912e04b1fda8ed5e56
7
+ data.tar.gz: 223ec607bb586d9ca58d107c914b5d928b1abee3016b9dc9bc3f9741ff39459cfaf0c09fcd87cec41af2ceef13705ac7605de20ea9db21e1e60b6c9ae4d480c7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flavours (0.0.7)
4
+ flavours (0.0.9)
5
5
  bundler (~> 1.3)
6
6
  commander (~> 4.2)
7
7
  dotenv (~> 0.11)
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.
@@ -16,7 +16,7 @@ module Flavours
16
16
  end
17
17
 
18
18
  # Resize Icons
19
- resize_icons directory, m, flavour_hash if flavour_hash['iconURL'] || flavour_hash['iconPath']
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
- else
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]
@@ -1,5 +1,5 @@
1
1
  module Flavours
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
 
4
4
  def self.check_for_newer_version
5
5
  unless Gem.latest_version_for('flavours').to_s == VERSION
@@ -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.sub("'", "\\'")}</#{res}>\n"
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.8
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-23 00:00:00.000000000 Z
11
+ date: 2014-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler