test/test_helper.rb in ruboto-1.5.0 vs test/test_helper.rb in ruboto-1.6.0
- old
+ new
@@ -42,33 +42,16 @@
PACKAGE = 'org.ruboto.test_app'
APP_NAME = 'RubotoTestApp'
TMP_DIR = File.join PROJECT_DIR, 'tmp'
APP_DIR = File.join TMP_DIR, APP_NAME
- # FIXME(uwe): Remove special case when Android L has been released.
- if (ENV['ANDROID_TARGET'] && ENV['ANDROID_TARGET'] =~ /(?:android-)?L/)
- ANDROID_TARGET = 'L'
- else
- ANDROID_TARGET = (ENV['ANDROID_TARGET'] && ENV['ANDROID_TARGET'].slice(/\d+/).to_i) || MINIMUM_SUPPORTED_SDK_LEVEL
- end
- # EMXIF
+ ANDROID_TARGET = (ENV['ANDROID_TARGET'] && ENV['ANDROID_TARGET'].slice(/\d+/).to_i) || MINIMUM_SUPPORTED_SDK_LEVEL
def self.version_from_device
puts 'Reading OS version from device/emulator'
system 'adb wait-for-device'
- IO.popen('adb bugreport').each_line do |line|
- if line =~ /sdk-eng (.*?) .*? .*? test-keys/
- version = $1
- api_level = VERSION_TO_API_LEVEL[version]
- raise "Unknown version: #{version}" if api_level.nil?
- return "android-#{api_level}"
- end
- if line =~ /\[ro\.build\.version\.sdk\]: \[(\d+)\]/
- return $1
- end
- end
- raise 'Unable to read device/emulator apilevel'
+ `adb shell getprop ro.build.version.sdk`
end
def uninstall_jruby_jars_gem
uninstall_ruboto_gem
uninstall_gem('jruby-jars')
@@ -101,14 +84,10 @@
puts RUBY_DESCRIPTION
ANDROID_OS = (ENV['ANDROID_OS'] || version_from_device).slice(/\d+/).to_i
- # FIXME(uwe): Remove when Android L has been released
- ANDROID_OS = 21 if ANDROID_OS == 0
- # EMXIF
-
puts "ANDROID_OS: #{ANDROID_OS}"
puts "ANDROID_TARGET: #{ANDROID_TARGET}"
RUBOTO_CMD = "ruby -rubygems -I #{PROJECT_DIR}/lib #{PROJECT_DIR}/bin/ruboto"
@@ -121,18 +100,11 @@
if RUBOTO_PLATFORM == 'CURRENT'
JRUBY_JARS_VERSION = Gem::Version.new('1.7.19')
elsif ENV['JRUBY_JARS_VERSION']
JRUBY_JARS_VERSION = Gem::Version.new(ENV['JRUBY_JARS_VERSION'])
else
- # FIXME(uwe): Simplify when we stop supporting rubygems < 1.8.0
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
- gem_spec = Gem::Specification.find_by_path 'jruby-jars'
- else
- gem_spec = Gem.searcher.find('jruby-jars')
- end
- # EMXIF
-
+ gem_spec = Gem::Specification.find_by_path 'jruby-jars'
raise StandardError.new("Can't find Gem specification jruby-jars.") unless gem_spec
JRUBY_JARS_VERSION = gem_spec.version
end
puts "JRUBY_JARS_VERSION: #{JRUBY_JARS_VERSION}"
@@ -210,11 +182,11 @@
FileUtils.cp_r template_dir, APP_DIR, :preserve => true
else
if example
Dir.chdir TMP_DIR do
system "tar xzf #{PROJECT_DIR}/examples/#{APP_NAME}_#{example}.tgz"
- Dir.chdir(APP_NAME) { system '../../bin/ruboto setup -y' }
+ Dir.chdir(APP_NAME) { system "#{RUBOTO_CMD} setup -y" }
end
Dir.chdir APP_DIR do
File.open('local.properties', 'w') { |f| f.puts "sdk.dir=#{ANDROID_HOME}" }
File.open('test/local.properties', 'w') { |f| f.puts "sdk.dir=#{ANDROID_HOME}" }
if standalone
@@ -254,9 +226,11 @@
end
end
Dir.chdir APP_DIR do
write_android_manifest
+ sleep 1
+ FileUtils.touch('project.properties')
File.write('res/layout/dummy_layout.xml', <<-EOF)
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_text"
android:layout_width="wrap_content" android:layout_height="wrap_content"