ruboto 0.10.1 → 0.10.2.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/Rakefile +110 -34
- data/assets/rakelib/ruboto.rake +181 -76
- data/assets/src/org/ruboto/JRubyAdapter.java +7 -3
- data/assets/src/org/ruboto/ScriptLoader.java +12 -4
- data/assets/src/ruboto/widget.rb +43 -34
- data/bin/ruboto +9 -4
- data/lib/ruboto/sdk_versions.rb +11 -2
- data/lib/ruboto/util/build.rb +1 -1
- data/lib/ruboto/util/update.rb +104 -32
- data/lib/ruboto/version.rb +1 -1
- data/test/activity/call_super_activity.rb +2 -3
- data/test/activity/dir_and_file_activity.rb +18 -0
- data/test/activity/dir_and_file_activity_test.rb +20 -0
- data/test/activity/image_button_and_button_activity.rb +4 -5
- data/test/activity/json_activity.rb +21 -0
- data/test/activity/json_activity_test.rb +17 -0
- data/test/activity/location_activity.rb +30 -0
- data/test/activity/location_activity_test.rb +17 -0
- data/test/activity/margins_activity.rb +0 -1
- data/test/activity/option_menu_activity.rb +0 -1
- data/test/activity/psych_activity.rb +8 -2
- data/test/activity/ssl_activity.rb +31 -0
- data/test/activity/ssl_activity_test.rb +22 -0
- data/test/activity/stack_activity.rb +0 -1
- data/test/activity/stack_activity_test.rb +4 -5
- data/test/activity/subclass_activity.rb +0 -1
- data/test/activity/view_constants_activity.rb +0 -1
- data/test/app_test_methods.rb +19 -6
- data/test/minimal_app_test.rb +10 -10
- data/test/rake_test.rb +8 -8
- data/test/ruboto_gen_test.rb +18 -12
- data/test/ruboto_update_test.rb +16 -10
- data/test/test_helper.rb +16 -35
- metadata +21 -9
data/lib/ruboto/version.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
require 'ruboto/activity'
|
2
1
|
require 'ruboto/widget'
|
3
2
|
|
4
|
-
ruboto_import_widgets :
|
3
|
+
ruboto_import_widgets :LinearLayout, :TextView
|
5
4
|
|
6
5
|
class CallSuperActivity
|
7
|
-
def
|
6
|
+
def onCreate(bundle)
|
8
7
|
super
|
9
8
|
setTitle 'Default'
|
10
9
|
setTitle 'With Super', true
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'ruboto/widget'
|
2
|
+
|
3
|
+
ruboto_import_widgets :LinearLayout, :TextView
|
4
|
+
|
5
|
+
class DirAndFileActivity
|
6
|
+
def onCreate(bundle)
|
7
|
+
super
|
8
|
+
setTitle File.basename(__FILE__).chomp('_activity.rb').split('_').
|
9
|
+
map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
10
|
+
self.content_view =
|
11
|
+
linear_layout :orientation => :vertical do
|
12
|
+
text_view :id => 42, :text => __FILE__
|
13
|
+
text_view :id => 43, :text => File.dirname(__FILE__)
|
14
|
+
text_view :id => 44, :text => Dir["#{File.dirname(__FILE__)}/*"][0].to_s
|
15
|
+
text_view :id => 45, :text => Dir.foreach(File.dirname(__FILE__)).to_a[2].to_s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
activity org.ruboto.test_app.DirAndFileActivity
|
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('__FILE__ is set OK') do |activity|
|
14
|
+
assert_matches %r{jar:file:/data/app/org.ruboto.test_app-[12].apk!/dir_and_file_activity.rb},
|
15
|
+
activity.find_view_by_id(42).text.to_s
|
16
|
+
assert_matches %r{jar:file:/data/app/org.ruboto.test_app-[12].apk!},
|
17
|
+
activity.find_view_by_id(43).text.to_s
|
18
|
+
assert_matches %r{file:/data/app/org.ruboto.test_app-[12].apk!/AndroidManifest.xml},
|
19
|
+
activity.find_view_by_id(44).text.to_s
|
20
|
+
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'ruboto/activity'
|
2
1
|
require 'ruboto/widget'
|
3
2
|
|
4
3
|
ruboto_import_widgets :Button, :ImageButton, :LinearLayout, :TextView
|
@@ -10,12 +9,12 @@ class ImageButtonAndButtonActivity
|
|
10
9
|
|
11
10
|
self.content_view =
|
12
11
|
linear_layout :orientation => LinearLayout::VERTICAL, :gravity => android.view.Gravity::CENTER_HORIZONTAL do
|
13
|
-
@text_view = text_view :text
|
12
|
+
@text_view = text_view :text => 'What hath Matz wrought?', :id => 42, :text_size => 48.0,
|
14
13
|
:width => :fill_parent, :gravity => android.view.Gravity::CENTER
|
15
|
-
button :text
|
16
|
-
:width
|
14
|
+
button :text => 'Button', :id => 44, :text_size => 48.0,
|
15
|
+
:width => :fill_parent, :gravity => android.view.Gravity::CENTER,
|
17
16
|
:on_click_listener => proc { @text_view.text = 'Button pressed' }
|
18
|
-
image_button :image_resource
|
17
|
+
image_button :image_resource => $package.R::drawable::get_ruboto_core, :id => 43, :width => :wrap_content,
|
19
18
|
:on_click_listener => proc { @text_view.text = 'Image button pressed' }
|
20
19
|
end
|
21
20
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'ruboto/util/stack'
|
2
|
+
with_large_stack { require 'json' }
|
3
|
+
require 'ruboto/widget'
|
4
|
+
|
5
|
+
ruboto_import_widgets :LinearLayout, :TextView
|
6
|
+
|
7
|
+
class JsonActivity
|
8
|
+
def onCreate(bundle)
|
9
|
+
super
|
10
|
+
set_title File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
11
|
+
self.content_view =
|
12
|
+
linear_layout :orientation => LinearLayout::VERTICAL, :gravity => android.view.Gravity::CENTER do
|
13
|
+
text_view :id => 42, :text => with_large_stack { JSON.load('["foo"]')[0] },
|
14
|
+
:text_size => 48.0, :gravity => android.view.Gravity::CENTER
|
15
|
+
text_view :id => 43, :text => with_large_stack { JSON.dump(['foo']) },
|
16
|
+
:text_size => 48.0, :gravity => android.view.Gravity::CENTER
|
17
|
+
text_view :id => 44, :text => with_large_stack { 'foo'.to_json },
|
18
|
+
:text_size => 48.0, :gravity => android.view.Gravity::CENTER
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
activity org.ruboto.test_app.JsonActivity
|
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('json encode decode') do |activity|
|
14
|
+
assert_equal 'foo', activity.find_view_by_id(42).text.to_s
|
15
|
+
assert_equal '["foo"]', activity.find_view_by_id(43).text.to_s
|
16
|
+
assert_equal '"foo"', activity.find_view_by_id(44).text.to_s
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'ruboto/widget'
|
2
|
+
|
3
|
+
java_import android.location.Location
|
4
|
+
|
5
|
+
ruboto_import_widgets :LinearLayout, :TextView
|
6
|
+
|
7
|
+
class LocationActivity
|
8
|
+
def onCreate(bundle)
|
9
|
+
super
|
10
|
+
set_title File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
11
|
+
self.content_view =
|
12
|
+
linear_layout :orientation => LinearLayout::VERTICAL, :gravity => android.view.Gravity::CENTER do
|
13
|
+
@distance_text = text_view :id => 42,
|
14
|
+
:text_size => 48.0, :gravity => android.view.Gravity::CENTER
|
15
|
+
@start_bearing_text = text_view :id => 43,
|
16
|
+
:text_size => 48.0, :gravity => android.view.Gravity::CENTER
|
17
|
+
@end_bearing_text = text_view :id => 44,
|
18
|
+
:text_size => 48.0, :gravity => android.view.Gravity::CENTER
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def onResume
|
23
|
+
super
|
24
|
+
result = Array.new(3, 0.0).to_java(:float)
|
25
|
+
Location.distanceBetween(59.0, 11.0, 59.1, 11.1, result)
|
26
|
+
@distance_text.text = result[0].to_s
|
27
|
+
@start_bearing_text.text = result[1].to_s
|
28
|
+
@end_bearing_text.text = result[2].to_s
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
activity org.ruboto.test_app.LocationActivity
|
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('distanceBetween') do |activity|
|
14
|
+
assert_equal '12531.119140625', activity.find_view_by_id(42).text.to_s
|
15
|
+
assert_equal '27.2149505615234', activity.find_view_by_id(43).text.to_s
|
16
|
+
assert_equal '27.3007125854492', activity.find_view_by_id(44).text.to_s
|
17
|
+
end
|
@@ -9,14 +9,20 @@ end
|
|
9
9
|
# ODOT
|
10
10
|
|
11
11
|
require 'ruboto/util/stack'
|
12
|
-
with_large_stack {
|
12
|
+
with_large_stack {require 'psych'}
|
13
|
+
|
14
|
+
# TODO(uwe): Remove when we stop supporting psych with Ruby 1.8 mode
|
15
|
+
if RUBY_VERSION < '1.9'
|
16
|
+
$LOAD_PATH.delete File.join(Config::CONFIG['libdir'], 'ruby/1.9')
|
17
|
+
end
|
18
|
+
# ODOT
|
13
19
|
|
14
20
|
Psych::Parser
|
15
21
|
Psych::Handler
|
16
22
|
|
17
23
|
require 'ruboto/widget'
|
18
24
|
|
19
|
-
ruboto_import_widgets :
|
25
|
+
ruboto_import_widgets :LinearLayout, :TextView
|
20
26
|
|
21
27
|
class PsychActivity
|
22
28
|
def on_create(bundle)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'ruboto/util/stack'
|
2
|
+
require 'ruboto/widget'
|
3
|
+
|
4
|
+
ruboto_import_widgets :LinearLayout, :TextView
|
5
|
+
|
6
|
+
class SslActivity
|
7
|
+
def onCreate(bundle)
|
8
|
+
super
|
9
|
+
puts 'start thread'
|
10
|
+
@thread = Thread.with_large_stack { require 'net/https' }
|
11
|
+
puts 'thread started'
|
12
|
+
set_title File.basename(__FILE__).chomp('_activity.rb').split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join(' ')
|
13
|
+
self.content_view =
|
14
|
+
linear_layout :orientation => LinearLayout::VERTICAL, :gravity => android.view.Gravity::CENTER do
|
15
|
+
@text_view = text_view :id => 42, :text => 'net/https loading...',
|
16
|
+
:text_size => 48.0, :gravity => android.view.Gravity::CENTER
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def onResume
|
21
|
+
super
|
22
|
+
puts 'on resume my lord'
|
23
|
+
Thread.start do
|
24
|
+
puts 'joining thread'
|
25
|
+
@thread.join
|
26
|
+
puts 'thread joined'
|
27
|
+
run_on_ui_thread{@text_view.text = 'net/https loaded OK!'}
|
28
|
+
puts 'text updated'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
activity org.ruboto.test_app.SslActivity
|
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('load net/https', :ui => false) do |activity|
|
14
|
+
start = Time.now
|
15
|
+
expected = 'net/https loaded OK'
|
16
|
+
loop do
|
17
|
+
result = activity.run_on_ui_thread { activity.find_view_by_id(42).text.to_s }
|
18
|
+
break if result == expected || (Time.now - start > 120)
|
19
|
+
sleep 5
|
20
|
+
end
|
21
|
+
assert_equal expected, result
|
22
|
+
end
|
@@ -2,7 +2,6 @@ STACK_DEPTH_SCRIPT = java.lang.Thread.current_thread.stack_trace.length.to_s
|
|
2
2
|
|
3
3
|
raise "Stack level: #{STACK_DEPTH_SCRIPT}" rescue puts $!.backtrace.join("\n")
|
4
4
|
|
5
|
-
require 'ruboto/activity'
|
6
5
|
require 'ruboto/widget'
|
7
6
|
|
8
7
|
ruboto_import_widgets :Button, :LinearLayout, :TextView
|
@@ -15,9 +15,8 @@ end
|
|
15
15
|
# ANDROID: 16, PLATFORM: 0.4.8.dev, JRuby: 1.7.0.preview2 '[29, 34, 47, 64]' expected, but got '[28, 33, 47, 64]'
|
16
16
|
test('stack depth') do |activity|
|
17
17
|
os_offset = {
|
18
|
-
|
19
|
-
|
20
|
-
16 => [0, 0, 1, 1],
|
18
|
+
10 => [0, 0, -1, -1],
|
19
|
+
13 => [1, 1, 0, 0],
|
21
20
|
}[android.os.Build::VERSION::SDK_INT] || [0, 0, 0, 0]
|
22
21
|
if org.ruboto.JRubyAdapter.uses_platform_apk?
|
23
22
|
jruby_offset = {
|
@@ -32,8 +31,8 @@ test('stack depth') do |activity|
|
|
32
31
|
version_message ="ANDROID: #{android.os.Build::VERSION::SDK_INT}, PLATFORM: #{org.ruboto.JRubyAdapter.uses_platform_apk ? org.ruboto.JRubyAdapter.platform_version_name : 'STANDALONE'}, JRuby: #{org.jruby.runtime.Constants::VERSION}"
|
33
32
|
assert_equal [28 + os_offset[0] + jruby_offset[0],
|
34
33
|
33 + os_offset[1] + jruby_offset[1],
|
35
|
-
|
36
|
-
|
34
|
+
47 + os_offset[2] + jruby_offset[2],
|
35
|
+
64 + os_offset[3] + jruby_offset[3]], [activity.find_view_by_id(42).text.to_i,
|
37
36
|
activity.find_view_by_id(43).text.to_i,
|
38
37
|
activity.find_view_by_id(44).text.to_i,
|
39
38
|
activity.find_view_by_id(45).text.to_i], version_message
|
data/test/app_test_methods.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(
|
1
|
+
require File.expand_path('test_helper', File.dirname(__FILE__))
|
2
2
|
|
3
3
|
module AppTestMethods
|
4
4
|
include RubotoTest
|
@@ -6,8 +6,8 @@ module AppTestMethods
|
|
6
6
|
def test_activity_tests
|
7
7
|
if ENV['ACTIVITY_TEST_PATTERN']
|
8
8
|
Dir.chdir APP_DIR do
|
9
|
-
FileUtils.rm
|
10
|
-
FileUtils.rm
|
9
|
+
FileUtils.rm 'src/ruboto_test_app_activity.rb'
|
10
|
+
FileUtils.rm 'test/src/ruboto_test_app_activity_test.rb'
|
11
11
|
end
|
12
12
|
else
|
13
13
|
assert_code 'Base64Loads', "require 'base64'"
|
@@ -30,7 +30,7 @@ module AppTestMethods
|
|
30
30
|
Dir.chdir APP_DIR do
|
31
31
|
system "#{RUBOTO_CMD} gen class Activity --name #{activity_name}Activity"
|
32
32
|
s = File.read(filename)
|
33
|
-
raise
|
33
|
+
raise 'Code injection failed!' unless s.gsub!(/(require 'ruboto\/widget')/, "\\1\n#{code}")
|
34
34
|
File.open(filename, 'w') { |f| f << s }
|
35
35
|
end
|
36
36
|
end
|
@@ -39,6 +39,19 @@ module AppTestMethods
|
|
39
39
|
Dir[File.expand_path("#{activity_dir}/*", File.dirname(__FILE__))].each do |file|
|
40
40
|
# FIXME(uwe): Remove when we stop testing JRuby < 1.7.0.rc1
|
41
41
|
next if file =~ /subclass/ && (RUBOTO_PLATFORM == 'CURRENT' || JRUBY_JARS_VERSION < Gem::Version.new('1.7.1.dev'))
|
42
|
+
# EMXIF
|
43
|
+
|
44
|
+
# FIXME(uwe): Remove when we stop testing RubotoCore <= 0.5.2 and android-10
|
45
|
+
next if file =~ /json/ && (RUBOTO_PLATFORM == 'CURRENT' || ANDROID_OS <= 10)
|
46
|
+
# EMXIF
|
47
|
+
|
48
|
+
# FIXME(uwe): Remove when we include jopenssl and bouncycastle
|
49
|
+
next if file =~ /ssl/
|
50
|
+
# EMXIF
|
51
|
+
|
52
|
+
# FIXME(uwe): Remove when we stop testing JRuby < 1.7.4.dev
|
53
|
+
next if file =~ /dir_and_file/ && (RUBOTO_PLATFORM == 'CURRENT' || JRUBY_JARS_VERSION < Gem::Version.new('1.7.4.dev'))
|
54
|
+
# EMXIF
|
42
55
|
|
43
56
|
if file =~ /_test.rb$/
|
44
57
|
next unless file =~ /#{ENV['ACTIVITY_TEST_PATTERN']}/
|
@@ -47,8 +60,8 @@ module AppTestMethods
|
|
47
60
|
activity_name = File.basename(snake_name).split('_').map { |s| "#{s[0..0].upcase}#{s[1..-1]}" }.join
|
48
61
|
Dir.chdir APP_DIR do
|
49
62
|
system "#{RUBOTO_CMD} gen class Activity --name #{activity_name}"
|
50
|
-
FileUtils.cp "#{snake_name}.rb",
|
51
|
-
FileUtils.cp file,
|
63
|
+
FileUtils.cp "#{snake_name}.rb", 'src/'
|
64
|
+
FileUtils.cp file, 'test/src/'
|
52
65
|
end
|
53
66
|
elsif !File.exists? "#{file.chomp('.rb')}'_test.rb'"
|
54
67
|
Dir.chdir APP_DIR do
|
data/test/minimal_app_test.rb
CHANGED
@@ -13,13 +13,13 @@ if RubotoTest::RUBOTO_PLATFORM == 'STANDALONE'
|
|
13
13
|
cleanup_app
|
14
14
|
end
|
15
15
|
|
16
|
-
# APK was
|
17
|
-
# APK was
|
18
|
-
# APK was
|
19
|
-
# APK was
|
20
|
-
# APK was
|
21
|
-
# APK was
|
22
|
-
|
16
|
+
# APK was 3.5MB. JRuby: 1.6.7, ANDROID_TARGET: 15.
|
17
|
+
# APK was 3.3MB. JRuby: 1.6.7.2, ANDROID_TARGET: 10.
|
18
|
+
# APK was 4.7MB. JRuby: 1.7.0, ANDROID_TARGET: 15.
|
19
|
+
# APK was 4.5MB. JRuby: 1.7.2, ANDROID_TARGET: 10.
|
20
|
+
# APK was 4.5MB. JRuby: 1.7.2, ANDROID_TARGET: 15.
|
21
|
+
# APK was 4.6MB. JRuby: 1.7.3.dev, ANDROID_TARGET: 10.
|
22
|
+
# APK was 4.5MB. JRuby: 1.7.3.dev, ANDROID_TARGET: 15.
|
23
23
|
def test_minimal_apk_is_less_than_3_mb
|
24
24
|
apk_size = BigDecimal(File.size("#{APP_DIR}/bin/RubotoTestApp-debug.apk").to_s) / (1024 * 1024)
|
25
25
|
upper_limit = {
|
@@ -27,9 +27,9 @@ if RubotoTest::RUBOTO_PLATFORM == 'STANDALONE'
|
|
27
27
|
'1.6.7.2' => 3.5,
|
28
28
|
'1.6.8' => 3.5,
|
29
29
|
'1.7.0' => ANDROID_TARGET < 15 ? 4.7 : 4.9,
|
30
|
-
'1.7.1
|
31
|
-
'1.7.2
|
32
|
-
}[JRUBY_JARS_VERSION.to_s] || 4.
|
30
|
+
'1.7.1' => ANDROID_TARGET < 15 ? 4.7 : 4.9,
|
31
|
+
'1.7.2' => ANDROID_TARGET < 15 ? 4.6 : 4.9,
|
32
|
+
}[JRUBY_JARS_VERSION.to_s] || 4.7
|
33
33
|
lower_limit = upper_limit * 0.9
|
34
34
|
version_message ="JRuby: #{JRUBY_JARS_VERSION}, ANDROID_TARGET: #{ANDROID_TARGET}"
|
35
35
|
assert apk_size <= upper_limit, "APK was larger than #{'%.1f' % upper_limit}MB: #{'%.1f' % apk_size.ceil(1)}MB. #{version_message}"
|
data/test/rake_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(
|
1
|
+
require File.expand_path('test_helper', File.dirname(__FILE__))
|
2
2
|
|
3
3
|
class RakeTest < Test::Unit::TestCase
|
4
4
|
def setup
|
@@ -11,18 +11,18 @@ class RakeTest < Test::Unit::TestCase
|
|
11
11
|
|
12
12
|
# FIXME(uwe): Remove condition when we stop supporting android-7
|
13
13
|
if ANDROID_OS == 7
|
14
|
-
puts
|
14
|
+
puts 'Skipping sdcard test since files on sdcard are not removed on android-7 on app uninstall'
|
15
15
|
else
|
16
16
|
def test_that_update_scripts_task_copies_files_to_sdcard_and_are_read_by_activity
|
17
17
|
Dir.chdir APP_DIR do
|
18
|
-
activity_filename =
|
18
|
+
activity_filename = 'src/ruboto_test_app_activity.rb'
|
19
19
|
s = File.read(activity_filename)
|
20
|
-
s.gsub!(/What hath Matz wrought\?/,
|
20
|
+
s.gsub!(/What hath Matz wrought\?/, 'This text was changed by script!')
|
21
21
|
File.open(activity_filename, 'w') { |f| f << s }
|
22
22
|
|
23
|
-
test_filename =
|
23
|
+
test_filename = 'test/src/ruboto_test_app_activity_test.rb'
|
24
24
|
s2 = File.read(test_filename)
|
25
|
-
s2.gsub!(/What hath Matz wrought\?/,
|
25
|
+
s2.gsub!(/What hath Matz wrought\?/, 'This text was changed by script!')
|
26
26
|
File.open(test_filename, 'w') { |f| f << s2 }
|
27
27
|
|
28
28
|
apk_timestamp = File.ctime("bin/#{APP_NAME}-debug.apk")
|
@@ -41,7 +41,7 @@ class RakeTest < Test::Unit::TestCase
|
|
41
41
|
Dir.chdir APP_DIR do
|
42
42
|
system 'rake install'
|
43
43
|
apk_timestamp = File.ctime("bin/#{APP_NAME}-debug.apk")
|
44
|
-
FileUtils.touch
|
44
|
+
FileUtils.touch 'src/ruboto_test_app_activity.rb'
|
45
45
|
system 'rake install'
|
46
46
|
assert_not_equal apk_timestamp, File.ctime("bin/#{APP_NAME}-debug.apk"), 'APK should have been rebuilt'
|
47
47
|
end
|
@@ -53,7 +53,7 @@ class RakeTest < Test::Unit::TestCase
|
|
53
53
|
assert_equal "android:minSdkVersion='#{ANDROID_TARGET}'", manifest.slice(/android:minSdkVersion='\d+'/)
|
54
54
|
assert_equal "android:targetSdkVersion='#{ANDROID_TARGET}'", manifest.slice(/android:targetSdkVersion='\d+'/)
|
55
55
|
prop_file = File.read('project.properties')
|
56
|
-
File.open('project.properties', 'w'){|f| f << prop_file.sub(/target=android-#{ANDROID_TARGET}/,
|
56
|
+
File.open('project.properties', 'w'){|f| f << prop_file.sub(/target=android-#{ANDROID_TARGET}/, 'target=android-6')}
|
57
57
|
system 'rake debug'
|
58
58
|
manifest = File.read('AndroidManifest.xml')
|
59
59
|
assert_equal "android:minSdkVersion='6'", manifest.slice(/android:minSdkVersion='\d+'/)
|