ruboto-core 0.2.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +1 -1
- data/Gemfile.lock +8 -4
- data/README.md +1 -1
- data/Rakefile +4 -0
- data/assets/Rakefile +140 -64
- data/assets/assets/scripts/ruboto.rb +17 -26
- data/assets/res/drawable-hdpi/icon.png +0 -0
- data/assets/res/drawable-ldpi/icon.png +0 -0
- data/assets/res/drawable-mdpi/icon.png +0 -0
- data/assets/src/RubotoActivity.java +2 -0
- data/assets/src/org/ruboto/Script.java +38 -4
- data/assets/src/org/ruboto/test/InstrumentationTestRunner.java +12 -0
- data/lib/java_class_gen/android_api.xml +1 -1
- data/lib/ruboto/commands/base.rb +19 -9
- data/lib/ruboto/util/asset_copier.rb +10 -3
- data/lib/ruboto/util/build.rb +1 -1
- data/lib/ruboto/util/update.rb +110 -23
- data/lib/ruboto/util/verify.rb +24 -0
- data/lib/ruboto/util/xml_element.rb +2 -9
- data/test/activity/{image_button.rb → image_button_activity.rb} +0 -0
- data/test/activity/{image_button_test.rb → image_button_activity_test.rb} +1 -1
- data/test/activity/{image_button_and_button.rb → image_button_and_button_activity.rb} +0 -7
- data/test/activity/{image_button_and_button_test.rb → image_button_and_button_activity_test.rb} +1 -1
- data/test/activity/option_menu_activity.rb +21 -0
- data/test/activity/option_menu_activity_test.rb +20 -0
- data/test/app_test_methods.rb +24 -31
- data/test/minimal_app_test.rb +22 -0
- data/test/rake_test.rb +2 -17
- data/test/ruboto_gen_test.rb +19 -8
- data/test/ruboto_update_test.rb +8 -18
- data/test/service_test.rb +2 -4
- data/test/test_helper.rb +59 -7
- metadata +31 -13
data/lib/ruboto/util/verify.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'ruboto/api'
|
2
|
+
require 'yaml'
|
2
3
|
|
3
4
|
module Ruboto
|
4
5
|
module Util
|
@@ -18,6 +19,16 @@ module Ruboto
|
|
18
19
|
File.open("AndroidManifest.xml", 'w') {|f| verify_manifest.document.write(f, 4)}
|
19
20
|
end
|
20
21
|
|
22
|
+
def verify_test_manifest
|
23
|
+
abort "cannot find your test AndroidManifest.xml to extract info from it. Make sure you're in the root directory of your app" \
|
24
|
+
unless File.exists? 'test/AndroidManifest.xml'
|
25
|
+
@manifest ||= REXML::Document.new(File.read('test/AndroidManifest.xml')).root
|
26
|
+
end
|
27
|
+
|
28
|
+
def save_test_manifest
|
29
|
+
File.open("test/AndroidManifest.xml", 'w') {|f| verify_test_manifest.document.write(f, 4)}
|
30
|
+
end
|
31
|
+
|
21
32
|
def verify_package
|
22
33
|
verify_manifest
|
23
34
|
@package ||= @manifest.attribute('package').value
|
@@ -58,6 +69,19 @@ module Ruboto
|
|
58
69
|
def verify_api
|
59
70
|
Ruboto::API.api
|
60
71
|
end
|
72
|
+
|
73
|
+
def verify_ruboto_config
|
74
|
+
if File.exists? 'ruboto.yml'
|
75
|
+
@ruboto_config ||= YAML::load_file('ruboto.yml')
|
76
|
+
else
|
77
|
+
@ruboto_config = {}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def save_ruboto_config
|
82
|
+
File.open("ruboto.yml", 'w') {|f| YAML.dump verify_ruboto_config}
|
83
|
+
end
|
84
|
+
|
61
85
|
end
|
62
86
|
end
|
63
87
|
end
|
@@ -156,9 +156,8 @@ module Ruboto
|
|
156
156
|
|
157
157
|
params = parameters
|
158
158
|
args = ""
|
159
|
-
if params.size >
|
160
|
-
args = ",
|
161
|
-
rv << "Object[] args = {" + params.map{|i| i[0]}.join(", ") + "};"
|
159
|
+
if params.size > 1
|
160
|
+
args = ", new Object[]{" + params.map{|i| i[0]}.join(", ") + "}"
|
162
161
|
elsif params.size > 0
|
163
162
|
args = ", " + params.map{|i| i[0]}.join(", ")
|
164
163
|
end
|
@@ -177,13 +176,7 @@ module Ruboto
|
|
177
176
|
convert_return = ", #{return_class}.class"
|
178
177
|
end
|
179
178
|
|
180
|
-
if return_class == 'Integer'
|
181
|
-
# TODO(uwe): This is a fix for JRUBY-5937 Remove when the issue is fixed.
|
182
|
-
rv << "#{return_cast}((Number)getRuby().callMethod(callbackProcs[#{constant_string}], \"call\" #{args}#{convert_return})).intValue();"
|
183
|
-
# TODO end
|
184
|
-
else
|
185
179
|
rv << "#{return_cast}getRuby().callMethod(callbackProcs[#{constant_string}], \"call\" #{args}#{convert_return});"
|
186
|
-
end
|
187
180
|
rv
|
188
181
|
end
|
189
182
|
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'ruboto'
|
2
|
+
|
3
|
+
ruboto_import_widgets :ImageButton, :LinearLayout, :TextView
|
4
|
+
|
5
|
+
$activity.handle_create do |bundle|
|
6
|
+
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').map{|s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
7
|
+
|
8
|
+
setup_content do
|
9
|
+
linear_layout :orientation => LinearLayout::VERTICAL do
|
10
|
+
@text_view = text_view :text => 'What hath Matz wrought?', :id => 42
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
handle_create_options_menu do |menu|
|
15
|
+
add_menu('Test') do
|
16
|
+
@text_view.setText 'What hath Matz wrought!'
|
17
|
+
toast 'Flipped a bit via butterfly'
|
18
|
+
end
|
19
|
+
true
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
activity Java::org.ruboto.test_app.OptionMenuActivity
|
2
|
+
|
3
|
+
setup do |activity|
|
4
|
+
start = Time.now
|
5
|
+
loop do
|
6
|
+
@text_view = activity.findViewById(42)
|
7
|
+
break if @text_view || (Time.now - start > 60)
|
8
|
+
sleep 1
|
9
|
+
end
|
10
|
+
assert @text_view
|
11
|
+
end
|
12
|
+
|
13
|
+
test('initial setup') do |activity|
|
14
|
+
assert_equal "What hath Matz wrought?", @text_view.text
|
15
|
+
end
|
16
|
+
|
17
|
+
test('option_menu changes text') do |activity|
|
18
|
+
activity.window.performPanelIdentifierAction(android.view.Window::FEATURE_OPTIONS_PANEL, 0, 0)
|
19
|
+
assert_equal "What hath Matz wrought!", @text_view.text
|
20
|
+
end
|
data/test/app_test_methods.rb
CHANGED
@@ -8,47 +8,40 @@ module AppTestMethods
|
|
8
8
|
puts "Skipping instrumentation tests on #{ANDROID_OS} since they don't work."
|
9
9
|
end
|
10
10
|
else
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
def test_that_yaml_loads
|
17
|
-
assert_code "with_large_stack{require 'yaml'}"
|
11
|
+
def test_activity_tests
|
12
|
+
if not ON_JRUBY_JARS_1_5_6
|
13
|
+
assert_code 'YamlLoads', "with_large_stack{require 'yaml'}"
|
14
|
+
else
|
15
|
+
puts "Skipping YAML tests on jruby-jars-1.5.6"
|
18
16
|
end
|
19
|
-
else
|
20
|
-
puts "Skipping YAML tests on jruby-jars-1.5.6"
|
21
|
-
end
|
22
17
|
|
23
|
-
|
24
|
-
assert_code "File.read(__FILE__)"
|
25
|
-
end
|
18
|
+
assert_code 'ReadSourceFile', "File.read(__FILE__)"
|
26
19
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
File.open(test_filename, 'w') { |f| f << File.read('#{PROJECT_DIR}/test/activity/#{test}') }
|
35
|
-
run_app_tests
|
20
|
+
Dir[File.expand_path('activity/*_test.rb', File.dirname(__FILE__))].each do |test_src|
|
21
|
+
snake_name = test_src.chomp('_test.rb')
|
22
|
+
activity_name = File.basename(snake_name).split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join
|
23
|
+
Dir.chdir APP_DIR do
|
24
|
+
system "#{RUBOTO_CMD} gen class Activity --name #{activity_name}"
|
25
|
+
FileUtils.cp "#{snake_name}.rb", "assets/scripts/"
|
26
|
+
FileUtils.cp test_src, "test/assets/scripts/"
|
36
27
|
end
|
37
|
-
}
|
38
|
-
puts "Creating test from file #{PROJECT_DIR}/test/activity/#{test}"
|
39
28
|
end
|
29
|
+
run_app_tests
|
40
30
|
end
|
41
31
|
|
42
32
|
private
|
43
33
|
|
44
|
-
def assert_code(code)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
34
|
+
def assert_code(activity_name, code)
|
35
|
+
snake_name = activity_name.scan(/[A-Z]+[a-z]+/).map { |s| s.downcase }.join('_')
|
36
|
+
filename = "assets/scripts/#{snake_name}_activity.rb"
|
37
|
+
Dir.chdir APP_DIR do
|
38
|
+
system "#{RUBOTO_CMD} gen class Activity --name #{activity_name}Activity"
|
39
|
+
s = File.read(filename)
|
40
|
+
s.gsub!(/(require 'ruboto')/, "\\1\n#{code}")
|
41
|
+
File.open(filename, 'w') { |f| f << s }
|
42
|
+
end
|
50
43
|
end
|
51
44
|
|
52
45
|
end
|
53
46
|
|
54
|
-
end
|
47
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path("test_helper", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class MinimalAppTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
generate_app :excluded_stdlibs => %w{ant cgi digest dl drb ffi irb net optparse racc rbconfig rdoc rexml rinda rss rubygems runit shell soap test uri webrick win32 wsdl xmlrpc xsd}
|
6
|
+
end
|
7
|
+
|
8
|
+
def teardown
|
9
|
+
cleanup_app
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_minimal_apk_is_less_than_3_mb
|
13
|
+
apk_size = File.size("#{APP_DIR}/bin/RubotoTestApp-debug.apk").to_f / (1024 * 1024)
|
14
|
+
limit = 3.0
|
15
|
+
assert apk_size < limit, "APK was larger than #{'%.1f' % limit}MB: #{'%.1f' % apk_size}MB"
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_minimal_apk_succeeds_tests
|
19
|
+
run_app_tests
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/test/rake_test.rb
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
require File.expand_path("test_helper", File.dirname(__FILE__))
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
$stdout.sync = true
|
5
2
|
|
6
3
|
class RakeTest < Test::Unit::TestCase
|
7
4
|
def setup
|
@@ -18,7 +15,7 @@ class RakeTest < Test::Unit::TestCase
|
|
18
15
|
File.open("#{APP_DIR}/AndroidManifest.xml", 'w') { |f| f << manifest }
|
19
16
|
|
20
17
|
Dir.chdir APP_DIR do
|
21
|
-
system 'rake install:
|
18
|
+
system 'rake install:clean start'
|
22
19
|
assert_equal 0, $?
|
23
20
|
end
|
24
21
|
|
@@ -31,23 +28,11 @@ class RakeTest < Test::Unit::TestCase
|
|
31
28
|
else
|
32
29
|
def test_that_update_scripts_task_copies_files_to_app_directory_when_permissions_are_not_set
|
33
30
|
Dir.chdir APP_DIR do
|
34
|
-
system 'rake install:
|
31
|
+
system 'rake install:clean start'
|
35
32
|
assert_equal 0, $?
|
36
33
|
end
|
37
34
|
wait_for_dir("/data/data/#{PACKAGE}/files/scripts")
|
38
35
|
end
|
39
36
|
end
|
40
37
|
|
41
|
-
private
|
42
|
-
|
43
|
-
def wait_for_dir(dir)
|
44
|
-
puts "Waiting for app to generate script directory: #{dir}"
|
45
|
-
start = Time.now
|
46
|
-
loop do
|
47
|
-
break if `adb shell ls -d #{dir}`.chomp =~ %r{^#{dir}$}
|
48
|
-
flunk 'Timeout waiting for scripts directory to appear' if Time.now > start + 60
|
49
|
-
sleep 1
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
38
|
end
|
data/test/ruboto_gen_test.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require File.expand_path("test_helper", File.dirname(__FILE__))
|
2
|
-
require 'fileutils'
|
3
2
|
require 'test/app_test_methods'
|
4
3
|
|
5
4
|
class RubotoGenTest < Test::Unit::TestCase
|
@@ -12,20 +11,32 @@ class RubotoGenTest < Test::Unit::TestCase
|
|
12
11
|
def teardown
|
13
12
|
cleanup_app
|
14
13
|
end
|
14
|
+
|
15
|
+
def test_icons_are_updated
|
16
|
+
Dir.chdir APP_DIR do
|
17
|
+
assert_equal 4032, File.size('res/drawable-hdpi/icon.png')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_gen_class_activity_with_lowercase_should_fail
|
22
|
+
Dir.chdir APP_DIR do
|
23
|
+
system "#{RUBOTO_CMD} gen class activity --name VeryNewActivity"
|
24
|
+
assert_equal 1, $?.exitstatus
|
25
|
+
assert !File.exists?('src/org/ruboto/test_app/VeryNewActivity.java')
|
26
|
+
assert !File.exists?('assets/scripts/very_new_activity.rb')
|
27
|
+
assert !File.exists?('test/assets/scripts/very_new_activity_test.rb')
|
28
|
+
assert File.read('AndroidManifest.xml') !~ /VeryNewActivity/
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
15
32
|
end
|
16
33
|
|
17
34
|
if not RubotoTest::ON_JRUBY_JARS_1_5_6
|
18
|
-
class RubotoGenWithPsychTest <
|
19
|
-
include AppTestMethods
|
20
|
-
|
35
|
+
class RubotoGenWithPsychTest < RubotoGenTest
|
21
36
|
def setup
|
22
37
|
generate_app :with_psych => true
|
23
38
|
end
|
24
39
|
|
25
|
-
def teardown
|
26
|
-
cleanup_app
|
27
|
-
end
|
28
|
-
|
29
40
|
def test_psych_jar_exists
|
30
41
|
assert File.exists?("#{APP_DIR}/libs/psych.jar"), "Failed to generate psych jar"
|
31
42
|
end
|
data/test/ruboto_update_test.rb
CHANGED
@@ -1,28 +1,11 @@
|
|
1
1
|
require File.expand_path("test_helper", File.dirname(__FILE__))
|
2
|
-
require 'fileutils'
|
3
2
|
require 'test/app_test_methods'
|
4
3
|
|
5
4
|
module UpdateTestMethods
|
6
5
|
include RubotoTest
|
7
6
|
|
8
7
|
def setup(with_psych = false)
|
9
|
-
|
10
|
-
FileUtils.rm_rf APP_DIR if File.exists? APP_DIR
|
11
|
-
Dir.chdir TMP_DIR do
|
12
|
-
system "tar xzf #{PROJECT_DIR}/examples/RubotoTestApp_0.1.0_jruby_1.6.3.dev.tgz"
|
13
|
-
end
|
14
|
-
if ENV['ANDROID_HOME']
|
15
|
-
android_home = ENV['ANDROID_HOME']
|
16
|
-
else
|
17
|
-
android_home = File.dirname(File.dirname(`which adb`))
|
18
|
-
end
|
19
|
-
File.open("#{APP_DIR}/local.properties", 'w'){|f| f.puts "sdk.dir=#{android_home}"}
|
20
|
-
File.open("#{APP_DIR}/test/local.properties", 'w'){|f| f.puts "sdk.dir=#{android_home}"}
|
21
|
-
Dir.chdir APP_DIR do
|
22
|
-
FileUtils.touch "libs/psych.jar" if with_psych
|
23
|
-
system "#{RUBOTO_CMD} update app"
|
24
|
-
assert_equal 0, $?, "update app failed with return code #$?"
|
25
|
-
end
|
8
|
+
generate_app(:with_psych => with_psych, :update => true)
|
26
9
|
end
|
27
10
|
|
28
11
|
def teardown
|
@@ -35,6 +18,13 @@ module UpdateTestMethods
|
|
35
18
|
assert_equal 1, File.readlines('test/build.xml').grep(/<macrodef name="run-tests-helper">/).size, 'Duplicate macro in build.xml'
|
36
19
|
end
|
37
20
|
end
|
21
|
+
|
22
|
+
def test_icons_are_untouched
|
23
|
+
Dir.chdir APP_DIR do
|
24
|
+
assert_equal 4100, File.size('res/drawable-hdpi/icon.png')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
38
28
|
end
|
39
29
|
|
40
30
|
class RubotoUpdateTest < Test::Unit::TestCase
|
data/test/service_test.rb
CHANGED
@@ -2,8 +2,6 @@ require File.expand_path("test_helper", File.dirname(__FILE__))
|
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
4
|
class ServiceTest < Test::Unit::TestCase
|
5
|
-
include RubotoTest
|
6
|
-
|
7
5
|
def setup
|
8
6
|
generate_app
|
9
7
|
end
|
@@ -44,6 +42,6 @@ EOF
|
|
44
42
|
File.open(activity_filename, 'w') { |f| f << s }
|
45
43
|
end
|
46
44
|
run_app_tests
|
47
|
-
|
45
|
+
end
|
48
46
|
|
49
|
-
end
|
47
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'rubygems'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'yaml'
|
3
5
|
|
4
6
|
module RubotoTest
|
5
7
|
PROJECT_DIR = File.expand_path('..', File.dirname(__FILE__))
|
6
8
|
$LOAD_PATH << PROJECT_DIR
|
7
9
|
|
8
|
-
|
10
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
|
11
|
+
gem_spec = Gem::Specification.find_by_path 'jruby-jars'
|
12
|
+
else
|
13
|
+
gem_spec = Gem.searcher.find('jruby-jars')
|
14
|
+
end
|
9
15
|
raise StandardError.new("Can't find Gem specification jruby-jars.") unless gem_spec
|
10
16
|
JRUBY_JARS_VERSION = gem_spec.version
|
11
17
|
ON_JRUBY_JARS_1_5_6 = JRUBY_JARS_VERSION == Gem::Version.new('1.5.6')
|
@@ -35,6 +41,9 @@ module RubotoTest
|
|
35
41
|
puts "Getting version from device/emulator took #{(Time.now - start).to_i}s"
|
36
42
|
return api_level
|
37
43
|
end
|
44
|
+
if line =~ /\[ro\.build\.version\.sdk\]: \[(\d+)\]/
|
45
|
+
return $1
|
46
|
+
end
|
38
47
|
end
|
39
48
|
raise "Unable to read device/emulator apilevel"
|
40
49
|
end
|
@@ -77,19 +86,47 @@ class Test::Unit::TestCase
|
|
77
86
|
|
78
87
|
def generate_app(options = {})
|
79
88
|
with_psych = options.delete(:with_psych) || false
|
89
|
+
update = options.delete(:update) || false
|
90
|
+
excluded_stdlibs = options.delete(:excluded_stdlibs)
|
80
91
|
raise "Unknown options: #{options.inspect}" unless options.empty?
|
81
92
|
Dir.mkdir TMP_DIR unless File.exists? TMP_DIR
|
82
93
|
FileUtils.rm_rf APP_DIR if File.exists? APP_DIR
|
83
|
-
template_dir = "#{APP_DIR}_template_#{$$}#{'_with_psych' if with_psych}"
|
94
|
+
template_dir = "#{APP_DIR}_template_#{$$}#{'_with_psych' if with_psych}#{'_updated' if update}#{"_without_#{excluded_stdlibs.join('_')}" if excluded_stdlibs}"
|
84
95
|
if File.exists?(template_dir)
|
85
96
|
puts "Copying app from template #{template_dir}"
|
86
97
|
FileUtils.cp_r template_dir, APP_DIR, :preserve => true
|
87
98
|
else
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
99
|
+
if update
|
100
|
+
Dir.chdir TMP_DIR do
|
101
|
+
system "tar xzf #{PROJECT_DIR}/examples/RubotoTestApp_0.1.0_jruby_1.6.3.dev.tgz"
|
102
|
+
end
|
103
|
+
if ENV['ANDROID_HOME']
|
104
|
+
android_home = ENV['ANDROID_HOME']
|
105
|
+
else
|
106
|
+
android_home = File.dirname(File.dirname(`which adb`))
|
107
|
+
end
|
108
|
+
Dir.chdir APP_DIR do
|
109
|
+
File.open('local.properties', 'w'){|f| f.puts "sdk.dir=#{android_home}"}
|
110
|
+
File.open('test/local.properties', 'w'){|f| f.puts "sdk.dir=#{android_home}"}
|
111
|
+
FileUtils.touch "libs/psych.jar" if with_psych
|
112
|
+
exclude_stdlibs(excluded_stdlibs) if excluded_stdlibs
|
113
|
+
system "#{RUBOTO_CMD} update app"
|
114
|
+
assert_equal 0, $?, "update app failed with return code #$?"
|
115
|
+
end
|
116
|
+
else
|
117
|
+
puts "Generating app #{APP_DIR}"
|
118
|
+
system "#{RUBOTO_CMD} gen app --package #{PACKAGE} --path #{APP_DIR} --name #{APP_NAME} --target #{ANDROID_TARGET} #{'--with-psych' if with_psych}"
|
119
|
+
if $? != 0
|
120
|
+
FileUtils.rm_rf APP_DIR
|
121
|
+
raise "gen app failed with return code #$?"
|
122
|
+
end
|
123
|
+
if excluded_stdlibs
|
124
|
+
Dir.chdir APP_DIR do
|
125
|
+
exclude_stdlibs(excluded_stdlibs)
|
126
|
+
system "#{RUBOTO_CMD} update jruby --force"
|
127
|
+
raise "update jruby failed with return code #$?" if $? != 0
|
128
|
+
end
|
129
|
+
end
|
93
130
|
end
|
94
131
|
Dir.chdir APP_DIR do
|
95
132
|
system 'rake debug'
|
@@ -111,4 +148,19 @@ class Test::Unit::TestCase
|
|
111
148
|
end
|
112
149
|
end
|
113
150
|
|
151
|
+
def wait_for_dir(dir)
|
152
|
+
puts "Waiting for app to generate script directory: #{dir}"
|
153
|
+
start = Time.now
|
154
|
+
loop do
|
155
|
+
break if `adb shell ls -d #{dir}`.chomp =~ %r{^#{dir}$}
|
156
|
+
flunk 'Timeout waiting for scripts directory to appear' if Time.now > start + 120
|
157
|
+
sleep 1
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def exclude_stdlibs(excluded_stdlibs)
|
162
|
+
puts "Adding ruboto.yml: #{excluded_stdlibs.join(' ')}"
|
163
|
+
File.open('ruboto.yml', 'w'){|f| f << YAML.dump({:excluded_stdlibs => excluded_stdlibs})}
|
164
|
+
end
|
165
|
+
|
114
166
|
end
|