class Pretest::Mobile::Environment
Public Instance Methods
linux?()
click to toggle source
# File lib/pretest/mobile/environment.rb, line 75 def linux? unix? && !mac? end
mac?()
click to toggle source
# File lib/pretest/mobile/environment.rb, line 63 def mac? (/darwin/ =~ RUBY_PLATFORM) != nil end
mobile_env()
click to toggle source
# File lib/pretest/mobile/environment.rb, line 23 def mobile_env if env == 'android' set_android_env elsif env == 'ios' # set_ios_env elsif (env != 'ios') && (env != 'android') puts "You must use one of the following arguments:\n" \ "android:\t # pretest mobile_environment android\n" \ "ios:\t\t # pretest mobile_environment ios" end end
set_android_env()
click to toggle source
# File lib/pretest/mobile/environment.rb, line 42 def set_android_env set_environment_values File.new("#{ENV['HOME']}/.pretest", 'w') unless Dir.entries(ENV['HOME']).include?('.pretest') if File.read("#{ENV['HOME']}/.pretest").include?('ANDROID_HOME') puts 'ANDROID_HOME is already defined' else File.open("#{ENV['HOME']}/.pretest", 'a') { |file| file << @android_studio } File.open("#{ENV['HOME']}/.bashrc", 'a') { |file| file << @set_source } system 'source ~/.bashrc' puts 'ANDROID_HOME defined with success' end end
set_bits()
click to toggle source
# File lib/pretest/mobile/environment.rb, line 55 def set_bits if RUBY_PLATFORM.include?('32') (@bits = '32') && (@phantomjs_bits = 'linux-i686') else (@bits = '64') && (@phantomjs_bits = 'linux-x86_64') end end
set_environment_values()
click to toggle source
# File lib/pretest/mobile/environment.rb, line 35 def set_environment_values @android_studio = "\n\n#Android sdk set path\n" \ "export ANDROID_HOME='/usr/local/opt/android-sdk'\n" + "export PATH='${PATH}:${ANDROID_HOME}/tools'".tr!("'", '"') @set_source = "\n[[ -s '$HOME/.pretest' ]] && source '$HOME/.pretest' # Load environment variables defined in pretest".tr!("'", '"') end
set_mobile_environment()
click to toggle source
# File lib/pretest/mobile/environment.rb, line 15 def set_mobile_environment if linux? || mac? mobile_env elsif windows? end end
unix?()
click to toggle source
# File lib/pretest/mobile/environment.rb, line 71 def unix? !windows? end
windows?()
click to toggle source
# File lib/pretest/mobile/environment.rb, line 67 def windows? (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil end