lib/dryrun.rb in dryrun-0.3.6 vs lib/dryrun.rb in dryrun-0.4.0
- old
+ new
@@ -6,46 +6,46 @@
module DryRun
class MainApp
- def self.is_ANDROID_HOME_defined
- return true
+ def self.ANDROID_HOME_is_defined
+ sdk = `echo $ANDROID_HOME`.gsub("\n",'')
+ !sdk.empty?
end
def self.initialize(url)
- if !is_ANDROID_HOME_defined
- # TODO missing warning
+ unless self.ANDROID_HOME_is_defined
+ puts "\nWARNING: your #{'$ANDROID_HOME'.yellow} is not defined\n"
+ puts "\nhint: in your #{'~/.bashrc'.yellow} add:\n #{"export ANDROID_HOME=\"/Users/cesarferreira/Library/Android/sdk/\"".yellow}"
+ puts "\nNow type #{'source ~/.bashrc'.yellow}\n\n"
+ exit 1
end
github = Github.new(url)
- if !github.is_valid
+ unless github.is_valid
puts "#{url.red} is not a valid github url"
exit 1
end
# clone the repository
- clonable = github.clonable_url
+ repository_path = github.clone
- repository = github.clone
+ android_project = AndroidProject.new(repository_path)
- Dir.chdir repository
-
- project = AndroidProject.new(repository)
-
# is a valid android project?
- if !project.is_valid
+ unless android_project.is_valid
puts "#{url.red} is not a valid android project"
exit 1
end
# clean and install the apk
- project.clean_install
+ android_project.install
- puts "\n> If you want to remove the app you just installed, execute:\n#{project.get_uninstall_command.yellow}\n\n"
+ puts "\n> If you want to remove the app you just installed, execute:\n#{android_project.get_uninstall_command.yellow}\n\n"
end
end
end