Class: Souyuz::AndroidZipalignCommandGenerator
- Inherits:
-
Object
- Object
- Souyuz::AndroidZipalignCommandGenerator
- Defined in:
- lib/souyuz/generators/android_zipalign_command_generator.rb
Overview
Responsible for building the zipalign command
Class Method Summary collapse
- .detect_build_tools ⇒ Object
- .generate ⇒ Object
- .options ⇒ Object
- .pipe ⇒ Object
- .prefix ⇒ Object
- .zipalign_apk ⇒ Object
Class Method Details
.detect_build_tools ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/souyuz/generators/android_zipalign_command_generator.rb', line 16 def detect_build_tools UI.user_error! "Please ensure that the Android SDK is installed and the ANDROID_HOME variable is set correctly" unless ENV['ANDROID_HOME'] # determine latest buildtool version buildtools = File.join(ENV['ANDROID_HOME'], 'build-tools') version = Dir.entries(buildtools).sort.last UI.success "Using Buildtools Version: #{version}..." [buildtools, version] end |
.generate ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/souyuz/generators/android_zipalign_command_generator.rb', line 5 def generate parts = prefix parts << zipalign_apk parts += parts << Souyuz.cache[:signed_apk_path] parts << Souyuz.cache[:build_apk_path] parts += pipe parts end |
.options ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/souyuz/generators/android_zipalign_command_generator.rb', line 35 def = [] << "-v" if $verbose << "-f" << "4" end |
.pipe ⇒ Object
48 49 50 51 52 |
# File 'lib/souyuz/generators/android_zipalign_command_generator.rb', line 48 def pipe pipe = [] pipe end |
.prefix ⇒ Object
44 45 46 |
# File 'lib/souyuz/generators/android_zipalign_command_generator.rb', line 44 def prefix [""] end |
.zipalign_apk ⇒ Object
28 29 30 31 32 33 |
# File 'lib/souyuz/generators/android_zipalign_command_generator.rb', line 28 def zipalign_apk buildtools, version = detect_build_tools zipalign = ENV['ANDROID_HOME'] ? File.join(buildtools, version, 'zipalign') : 'zipalign' zipalign end |