high_five 0.2.7 → 0.2.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/lib/high_five/android_helper.rb +3 -0
- data/lib/high_five/image_helper.rb +31 -0
- data/lib/high_five/thor/tasks/android_tasks.rb +2 -0
- data/lib/high_five/thor/tasks/distribution.rb +1 -1
- data/lib/high_five/thor/tasks/ios_tasks.rb +7 -5
- data/lib/high_five/version.rb +1 -1
- data/lib/high_five.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 697b43cd0c99875dfad86b3c5fc37a17aa23f6bc
|
4
|
+
data.tar.gz: 30f7fd136bf0957cd7176b1447cdd094ab03527b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12879143bfd2679e67115533ef97fd19ae5d7c99f71a0b53536be4ad8e8f072da799c5bfeb2821ba2b592042ce03f4dc4b63cb9dceb1d826e1843429ffbb5727
|
7
|
+
data.tar.gz: ed566404e0909c2650a83a859ea8fb2b4659e944ed0915f9301b295646977123b0424f05db915118a610a6bfd8b38a44f5db2e55b1054049ea605e5c96fbaf44
|
@@ -16,6 +16,9 @@ module HighFive
|
|
16
16
|
end
|
17
17
|
|
18
18
|
platform_config = base_config.build_platform_config(:android)
|
19
|
+
if options[:environment]
|
20
|
+
platform_config = platform_config.build_platform_config(options[:environment])
|
21
|
+
end
|
19
22
|
return platform_config.android_manifest if platform_config.android_manifest
|
20
23
|
|
21
24
|
destination_dir = platform_config.destination
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module HighFive
|
2
|
+
module ImageHelper
|
3
|
+
|
4
|
+
# replace the image at path `image` with a resized version of the image at `source`
|
5
|
+
def replace_image(image_path, source_path)
|
6
|
+
image = ChunkyPNG::Image.from_file(image_path)
|
7
|
+
|
8
|
+
if (rmagick?)
|
9
|
+
source = Magick::Image.read(source_path).first
|
10
|
+
resized = source.scale(image.height, image.width)
|
11
|
+
resized.write(image_path)
|
12
|
+
else
|
13
|
+
source = ChunkyPNG::Image.from_file(path)
|
14
|
+
source.resize(image.height, image.width).save(image_path)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def rmagick?
|
21
|
+
@rmagick ||= begin
|
22
|
+
require "rmagick"
|
23
|
+
puts "Using rmagick..."
|
24
|
+
true
|
25
|
+
rescue LoadError
|
26
|
+
puts "using ChunkyPNG..."
|
27
|
+
false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -54,10 +54,12 @@ module HighFive
|
|
54
54
|
|
55
55
|
desc "set_icon", "Generate app icons from base png image"
|
56
56
|
method_option :platform_path, desc: "Path to the ios or android directory"
|
57
|
+
method_option :environment, :aliases => '-e', :desc => "Set environment"
|
57
58
|
def set_icon(path)
|
58
59
|
image = ChunkyPNG::Image.from_file(path)
|
59
60
|
|
60
61
|
manifest = File.read(android_manifest_path)
|
62
|
+
puts "Using android manifest: #{android_manifest_path}"
|
61
63
|
icon_name = manifest.match(/android:icon="@drawable\/(.*?)"/)[1] + '.png'
|
62
64
|
|
63
65
|
drawable_dir = File.join File.dirname(android_manifest_path), 'res'
|
@@ -65,7 +65,7 @@ module HighFive
|
|
65
65
|
@output_file_name = options[:output_file_name]
|
66
66
|
ant_flags = options[:"ant-flags"] || ""
|
67
67
|
system("android update project --path #{android_path} --subprojects")
|
68
|
-
system("ant -file '#{android_path}/build.xml' release #{ant_flags}")
|
68
|
+
system("ant -file '#{android_path}/build.xml' clean release #{ant_flags}")
|
69
69
|
|
70
70
|
android_name = HighFive::AndroidHelper.project_name_from_build_xml("#{android_path}/build.xml")
|
71
71
|
if @output_file_name
|
@@ -7,6 +7,7 @@ module HighFive
|
|
7
7
|
class IosTasks < ::HighFive::Thor::Task
|
8
8
|
include ::Thor::Actions
|
9
9
|
include ::HighFive::IosHelper
|
10
|
+
include ::HighFive::ImageHelper
|
10
11
|
namespace :ios
|
11
12
|
|
12
13
|
desc "set_version", "build the debug apk via ant debug"
|
@@ -35,19 +36,20 @@ module HighFive
|
|
35
36
|
method_option :target, :aliases => '-t', :desc => "Use a specific target (i.e. <Target>.plist"
|
36
37
|
method_option :platform_path, :desc => "Path to ios or android directory"
|
37
38
|
def set_icon(path)
|
38
|
-
image = ChunkyPNG::Image.from_file(path)
|
39
|
-
|
40
39
|
icon_files = plist['CFBundleIcons']["CFBundlePrimaryIcon"]["CFBundleIconFiles"]
|
41
40
|
icon_files += [ plist['CFBundleIconFile'] ]
|
42
41
|
icon_files += plist['CFBundleIcons~ipad']["CFBundlePrimaryIcon"]["CFBundleIconFiles"]
|
43
|
-
|
44
42
|
icon_files.each do |icon_entry|
|
45
43
|
icon_file_name = icon_entry
|
46
44
|
unless icon_entry.end_with? ".png"
|
47
45
|
icon_file_name += ".png"
|
48
46
|
end
|
49
47
|
|
50
|
-
|
48
|
+
# look in a directory named after the target first, if it's present
|
49
|
+
# This helps with multi-target apps
|
50
|
+
old_icon_path = Dir[File.join(ios_path, "#{target}/**/#{icon_file_name}")].first
|
51
|
+
old_icon_path = Dir[File.join(ios_path, "**/#{icon_file_name}")].first if old_icon_path.nil?
|
52
|
+
|
51
53
|
if old_icon_path.nil?
|
52
54
|
puts "Skipping #{icon_entry} because the file is missing. This will cause problems with app store submission"
|
53
55
|
next
|
@@ -55,8 +57,8 @@ module HighFive
|
|
55
57
|
print "Replacing #{old_icon_path}..."
|
56
58
|
old_image = ChunkyPNG::Image.from_file(old_icon_path)
|
57
59
|
puts "#{old_image.width}x#{old_image.height}"
|
60
|
+
replace_image(old_icon_path, path)
|
58
61
|
|
59
|
-
image.resize(old_image.height, old_image.width).save(old_icon_path)
|
60
62
|
end
|
61
63
|
end
|
62
64
|
|
data/lib/high_five/version.rb
CHANGED
data/lib/high_five.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: high_five
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Samson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -206,6 +206,7 @@ files:
|
|
206
206
|
- lib/high_five/cli.rb
|
207
207
|
- lib/high_five/config.rb
|
208
208
|
- lib/high_five/generators/manifest.erb
|
209
|
+
- lib/high_five/image_helper.rb
|
209
210
|
- lib/high_five/ios_helper.rb
|
210
211
|
- lib/high_five/thor/runner.rb
|
211
212
|
- lib/high_five/thor/task.rb
|