Class: HighFive::Thor::Tasks::Android
Instance Method Summary
collapse
#replace_image
#android_manifest_path, #parse_resolution, project_name_from_build_xml, #res_map, #valid_directories
inherited
Instance Method Details
#build ⇒ Object
20
21
22
23
|
# File 'lib/high_five/thor/tasks/android.rb', line 20
def build
run('ant -file build.xml "-Dkey.store=/Users/Shared/Jenkins/Home/jobs/modern resident/workspace/modern_resident-mobile/android/Keystore.ks" -Dkey.store.password=modernresident -Dkey.alias=android -Dkey.alias.password=modernresident clean release
Buildfile: /Users/Shared/Jenkins/Home/jobs/modern resident/workspace/modern_resident-mobile/android/build.xml')
end
|
#debug(target) ⇒ Object
14
15
16
17
|
# File 'lib/high_five/thor/tasks/android.rb', line 14
def debug(target)
@destination_root = base_config.root
puts "Debugy #{target}"
end
|
#set_icon(path) ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/high_five/thor/tasks/android.rb', line 58
def set_icon(path)
image = ChunkyPNG::Image.from_file(path)
manifest = File.read(android_manifest_path)
puts "Using android manifest: #{android_manifest_path}"
icon_name = manifest.match(/android:icon="@drawable\/(.*?)"/)[1] + '.png'
drawable_dir = File.join File.dirname(android_manifest_path), 'res'
valid_directories(drawable_dir).each do |dir|
res = parse_resolution(dir)
size = res_map[res]
icon_path = File.join(dir, icon_name)
replace_image icon_path, path
puts "Writing #{size}x#{size} -> #{icon_path}"
end
end
|
#set_version ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/high_five/thor/tasks/android.rb', line 30
def set_version
file = File.read(android_manifest_path)
xml = Nokogiri::XML(file)
xml.xpath("//manifest").each do |node|
if (options[:version])
old = node["android:versionName"]
node["android:versionName"] = options[:version]
puts "Setting version #{old} => #{options[:version]}"
end
if (options[:build_number])
old = node["android:versionCode"]
node["android:versionCode"] = options[:build_number]
puts "Setting versionCode #{old} => #{options[:build_number]}"
end
end
File.open(android_manifest_path, "w") do |f|
f.write xml.to_xml
end
end
|