ruboto 0.9.0.rc.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/Rakefile +52 -10
- data/assets/src/RubotoActivity.java +3 -3
- data/assets/src/org/ruboto/JRubyAdapter.java +16 -3
- data/assets/src/org/ruboto/Script.java +15 -25
- data/assets/src/org/ruboto/ScriptLoader.java +4 -4
- data/assets/src/ruboto/preference.rb +0 -10
- data/lib/ruboto/commands/base.rb +15 -5
- data/lib/ruboto/util/build.rb +4 -4
- data/lib/ruboto/util/update.rb +28 -27
- data/lib/ruboto/version.rb +7 -1
- data/test/activity/stack_activity_test.rb +4 -3
- data/test/app_test_methods.rb +4 -3
- data/test/block_def_activity/stack_activity_test.rb +4 -1
- data/test/handle_activity/stack_activity_test.rb +4 -2
- data/test/minimal_app_test.rb +4 -4
- data/test/ruboto_gen_test.rb +16 -6
- data/test/sqldroid_test.rb +3 -1
- data/test/test_helper.rb +2 -1
- data/test/update_test_methods.rb +27 -0
- metadata +14 -15
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -79,6 +79,7 @@ end
|
|
79
79
|
desc 'Generate release docs for a given milestone'
|
80
80
|
task :release_docs do
|
81
81
|
raise "\n This task requires Ruby 1.9 or newer to parse JSON as YAML.\n\n" if RUBY_VERSION == '1.8.7'
|
82
|
+
puts 'GitHub login:'
|
82
83
|
begin
|
83
84
|
require 'rubygems'
|
84
85
|
require 'highline/import'
|
@@ -86,7 +87,7 @@ task :release_docs do
|
|
86
87
|
pass = ask('password: ') { |q| q.echo = '*' }
|
87
88
|
rescue
|
88
89
|
print 'user name: ' ; user = STDIN.gets.chomp
|
89
|
-
print 'password
|
90
|
+
print ' password: ' ; pass = STDIN.gets.chomp
|
90
91
|
end
|
91
92
|
require 'uri'
|
92
93
|
require 'net/http'
|
@@ -118,6 +119,7 @@ task :release_docs do
|
|
118
119
|
res = https.start { |http| http.request(req) }
|
119
120
|
issues = YAML.load(res.body).sort_by { |i| i['number'] }
|
120
121
|
milestone_name = issues[0] ? issues[0]['milestone']['title'] : "No issues for milestone #{milestone}"
|
122
|
+
milestone_description = issues[0] ? issues[0]['milestone']['description'] : "No issues for milestone #{milestone}"
|
121
123
|
categories = {'Features' => 'feature', 'Bugfixes' => 'bug', 'Internal' => 'internal', 'Support' => 'support', 'Documentation' => 'documentation', 'Pull requests' => nil, 'Other' => nil}
|
122
124
|
grouped_issues = issues.group_by do |i|
|
123
125
|
labels = i['labels'].map { |l| l['name']}
|
@@ -132,7 +134,17 @@ task :release_docs do
|
|
132
134
|
cat ||= 'Other'
|
133
135
|
cat
|
134
136
|
end
|
135
|
-
puts
|
137
|
+
puts
|
138
|
+
puts "Subject: [ANN] Ruboto #{milestone_name} released!"
|
139
|
+
puts
|
140
|
+
puts "The Ruboto team is proud to announce the release of Ruboto #{milestone_name}."
|
141
|
+
puts
|
142
|
+
puts Ruboto::DESCRIPTION
|
143
|
+
puts
|
144
|
+
puts "New in version #{milestone_name}:\n"
|
145
|
+
puts
|
146
|
+
puts milestone_description
|
147
|
+
puts
|
136
148
|
(categories.keys & grouped_issues.keys).each do |cat|
|
137
149
|
puts "#{cat}:\n\n"
|
138
150
|
grouped_issues[cat].each { |i| puts %Q{* Issue ##{i['number']} #{i['title']}} }
|
@@ -140,10 +152,39 @@ task :release_docs do
|
|
140
152
|
end
|
141
153
|
puts "You can find a complete list of issues here:\n\n"
|
142
154
|
puts "* https://github.com/ruboto/ruboto/issues?state=closed&milestone=#{milestone}\n\n"
|
155
|
+
puts
|
156
|
+
puts <<EOF
|
157
|
+
Installation:
|
158
|
+
|
159
|
+
To use Ruboto, you need to install a Java JDK, the Android SDK, Apache ANT, and a Ruby implementation. Then do (possibly as root)
|
160
|
+
|
161
|
+
gem install ruboto
|
162
|
+
|
163
|
+
|
164
|
+
To create a project do
|
165
|
+
|
166
|
+
ruboto gen app --package <your.package.name>
|
167
|
+
|
168
|
+
|
169
|
+
You can find an introductory tutorial at https://github.com/ruboto/ruboto/wiki/Getting-started-with-Ruboto
|
170
|
+
|
171
|
+
If you have any problems or questions, come see us at http://ruboto.org/
|
172
|
+
|
173
|
+
Enjoy!
|
174
|
+
|
175
|
+
|
176
|
+
--
|
177
|
+
The Ruboto Team
|
178
|
+
http://ruboto.org/
|
179
|
+
|
180
|
+
EOF
|
181
|
+
|
143
182
|
end
|
144
183
|
|
145
184
|
desc 'Fetch download stats form rubygems.org'
|
146
185
|
task :stats do
|
186
|
+
require 'time'
|
187
|
+
require 'date'
|
147
188
|
require 'rubygems'
|
148
189
|
require 'uri'
|
149
190
|
require 'net/http'
|
@@ -164,13 +205,14 @@ task :stats do
|
|
164
205
|
req = Net::HTTP::Get.new(versions_uri.request_uri)
|
165
206
|
res = https.start { |http| http.request(req) }
|
166
207
|
versions = YAML.load(res.body).sort_by { |v| Gem::Version.new(v['number']) }
|
167
|
-
puts "\n#{gem}:\n#{versions.map { |v| "#{'%10s' % v['number']} #{v['downloads_count']}" }.join("\n")}"
|
208
|
+
puts "\n#{gem}:\n#{versions.map { |v| "#{Time.parse(v['built_at']).strftime('%Y-%m-%d')} #{'%10s' % v['number']} #{v['downloads_count']}" }.join("\n")}"
|
168
209
|
|
169
210
|
versions.each do |v|
|
170
|
-
downloads_uri = URI("#{base_uri}/versions/#{gem}-#{v['number']}/downloads/search.yaml?from
|
211
|
+
downloads_uri = URI("#{base_uri}/versions/#{gem}-#{v['number']}/downloads/search.yaml?from=#{Time.parse(v['built_at']).strftime('%Y-%m-%d')}&to=#{Date.today}")
|
171
212
|
req = Net::HTTP::Get.new(downloads_uri.request_uri)
|
172
213
|
res = https.start { |http| http.request(req) }
|
173
214
|
counts = YAML.load(res.body)
|
215
|
+
counts.delete_if{|date_str,count| count == 0}
|
174
216
|
counts.each do |date_str, count|
|
175
217
|
date = Date.parse(date_str)
|
176
218
|
counts_per_month[date.year][date.month] += count
|
@@ -218,10 +260,10 @@ end
|
|
218
260
|
|
219
261
|
desc "Push the gem to RubyGems"
|
220
262
|
task :release => [:clean, :gem] do
|
221
|
-
output = `git status --porcelain`
|
222
|
-
raise "Workspace not clean!\n#{output}" unless output.empty?
|
223
|
-
sh "git tag #{Ruboto::VERSION}"
|
224
|
-
sh "git push --tags"
|
263
|
+
#output = `git status --porcelain`
|
264
|
+
#raise "Workspace not clean!\n#{output}" unless output.empty?
|
265
|
+
#sh "git tag #{Ruboto::VERSION}"
|
266
|
+
#sh "git push --tags"
|
225
267
|
sh "gem push #{GEM_FILE}"
|
226
268
|
|
227
269
|
examples_glob = "#{EXAMPLE_FILE.slice(/^.*?_\d+\.\d+\.\d+/)}*"
|
@@ -253,8 +295,8 @@ namespace :platform do
|
|
253
295
|
sh "ruby -rubygems -I#{File.expand_path('lib', File.dirname(__FILE__))} bin/ruboto gen app --package org.ruboto.core --name RubotoCore --with-jruby --path #{PLATFORM_PROJECT} --min-sdk #{Ruboto::SdkVersions::MINIMUM_SUPPORTED_SDK} --target #{Ruboto::SdkVersions::DEFAULT_TARGET_SDK}"
|
254
296
|
Dir.chdir(PLATFORM_PROJECT) do
|
255
297
|
manifest = REXML::Document.new(File.read(MANIFEST_FILE))
|
256
|
-
manifest.root.attributes['android:versionCode'] = '
|
257
|
-
manifest.root.attributes['android:versionName'] = '0.4.
|
298
|
+
manifest.root.attributes['android:versionCode'] = '409'
|
299
|
+
manifest.root.attributes['android:versionName'] = '0.4.9'
|
258
300
|
manifest.root.attributes['android:installLocation'] = 'auto' # or 'preferExternal' ?
|
259
301
|
File.open(MANIFEST_FILE, 'w') { |f| manifest.document.write(f, 4) }
|
260
302
|
File.open('Gemfile.apk', 'w'){|f| f << "source :rubygems\n\ngem 'activerecord-jdbc-adapter'\n"}
|
@@ -40,7 +40,7 @@ THE_CONSTANTS
|
|
40
40
|
|
41
41
|
@Override
|
42
42
|
public void onCreate(Bundle bundle) {
|
43
|
-
System.out.println("
|
43
|
+
System.out.println("THE_RUBOTO_CLASS onCreate(): " + getClass().getName());
|
44
44
|
if (ScriptLoader.isCalledFromJRuby()) {
|
45
45
|
super.onCreate(bundle);
|
46
46
|
return;
|
@@ -55,14 +55,14 @@ THE_CONSTANTS
|
|
55
55
|
setTheme(configBundle.getInt("Theme"));
|
56
56
|
}
|
57
57
|
if (configBundle.containsKey("ClassName")) {
|
58
|
-
if (this.getClass().getName() ==
|
58
|
+
if (this.getClass().getName() == THE_RUBOTO_CLASS.class.getName()) {
|
59
59
|
scriptInfo.setRubyClassName(configBundle.getString("ClassName"));
|
60
60
|
} else {
|
61
61
|
throw new IllegalArgumentException("Only local Intents may set class name.");
|
62
62
|
}
|
63
63
|
}
|
64
64
|
if (configBundle.containsKey("Script")) {
|
65
|
-
if (this.getClass().getName() ==
|
65
|
+
if (this.getClass().getName() == THE_RUBOTO_CLASS.class.getName()) {
|
66
66
|
scriptInfo.setScriptName(configBundle.getString("Script"));
|
67
67
|
} else {
|
68
68
|
throw new IllegalArgumentException("Only local Intents may set script name.");
|
@@ -217,7 +217,11 @@ public class JRubyAdapter {
|
|
217
217
|
throw new RuntimeException(iae);
|
218
218
|
} catch (java.lang.reflect.InvocationTargetException ite) {
|
219
219
|
if (isDebugBuild) {
|
220
|
-
|
220
|
+
if (ite.getCause() instanceof RuntimeException) {
|
221
|
+
throw ((RuntimeException) ite.getCause());
|
222
|
+
} else {
|
223
|
+
throw ((Error) ite.getCause());
|
224
|
+
}
|
221
225
|
} else {
|
222
226
|
return null;
|
223
227
|
}
|
@@ -251,7 +255,7 @@ public class JRubyAdapter {
|
|
251
255
|
System.setProperty("jruby.backtrace.style", "normal"); // normal raw full mri
|
252
256
|
|
253
257
|
// Uncomment these to debug/profile Ruby source loading
|
254
|
-
|
258
|
+
System.setProperty("jruby.debug.loadService", "true");
|
255
259
|
// System.setProperty("jruby.debug.loadService.timing", "true");
|
256
260
|
|
257
261
|
// Used to enable JRuby to generate proxy classes
|
@@ -324,7 +328,16 @@ public class JRubyAdapter {
|
|
324
328
|
setOutputStream(output);
|
325
329
|
}
|
326
330
|
|
327
|
-
String jrubyHome = "file:" + apkName + "
|
331
|
+
String jrubyHome = "file:" + apkName + "!/jruby.home";
|
332
|
+
|
333
|
+
// FIXME(uwe): Remove when we stop supporting RubotoCore 0.4.7
|
334
|
+
Log.i("RUBOTO_CORE_VERSION_NAME: " + RUBOTO_CORE_VERSION_NAME);
|
335
|
+
if (RUBOTO_CORE_VERSION_NAME != null &&
|
336
|
+
(RUBOTO_CORE_VERSION_NAME.equals("0.4.7") || RUBOTO_CORE_VERSION_NAME.equals("0.4.8"))) {
|
337
|
+
jrubyHome = "file:" + apkName + "!";
|
338
|
+
}
|
339
|
+
// EMXIF
|
340
|
+
|
328
341
|
Log.i("Setting JRUBY_HOME: " + jrubyHome);
|
329
342
|
System.setProperty("jruby.home", jrubyHome);
|
330
343
|
|
@@ -9,6 +9,7 @@ import java.io.InputStream;
|
|
9
9
|
import java.io.OutputStream;
|
10
10
|
import java.lang.reflect.InvocationTargetException;
|
11
11
|
import java.lang.reflect.Method;
|
12
|
+
import java.net.URL;
|
12
13
|
|
13
14
|
import android.content.Context;
|
14
15
|
import android.content.res.AssetManager;
|
@@ -108,41 +109,30 @@ public class Script {
|
|
108
109
|
}
|
109
110
|
|
110
111
|
boolean exists() {
|
112
|
+
return getAbsolutePath() != null;
|
113
|
+
}
|
114
|
+
|
115
|
+
String getAbsolutePath() {
|
111
116
|
for (String dir : scriptsDir) {
|
112
|
-
|
113
|
-
|
114
|
-
|
117
|
+
String path = dir + "/" + name;
|
118
|
+
Log.d("Checking path: " + path);
|
119
|
+
if (new File(path).exists()) {
|
120
|
+
return "file:" + path;
|
115
121
|
}
|
116
122
|
}
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
is.close();
|
122
|
-
return true;
|
123
|
-
} else {
|
124
|
-
return false;
|
125
|
-
}
|
126
|
-
} catch (IOException ioex) {
|
127
|
-
System.out.println("Classpath resource exception: " + ioex);
|
128
|
-
return false;
|
123
|
+
URL url = getClass().getClassLoader().getResource(name);
|
124
|
+
Log.d("Classpath resource: " + url);
|
125
|
+
if (url != null) {
|
126
|
+
return url.toString();
|
129
127
|
}
|
128
|
+
return null;
|
130
129
|
}
|
131
130
|
|
132
131
|
public String getContents() throws IOException {
|
133
132
|
InputStream is = null;
|
134
133
|
BufferedReader buffer = null;
|
135
134
|
try {
|
136
|
-
|
137
|
-
System.out.println("Checking file: " + dir + "/" + name);
|
138
|
-
if (new File(dir + "/" + name).exists()) {
|
139
|
-
is = new java.io.FileInputStream(dir + "/" + name);
|
140
|
-
}
|
141
|
-
}
|
142
|
-
if (is == null) {
|
143
|
-
is = getClass().getClassLoader().getResourceAsStream(name);
|
144
|
-
}
|
145
|
-
buffer = new BufferedReader(new java.io.InputStreamReader(is), 8192);
|
135
|
+
buffer = new BufferedReader(new java.io.InputStreamReader(new URL(getAbsolutePath()).openStream()), 8192);
|
146
136
|
StringBuilder source = new StringBuilder();
|
147
137
|
while (true) {
|
148
138
|
String line = buffer.readLine();
|
@@ -11,7 +11,7 @@ public class ScriptLoader {
|
|
11
11
|
*/
|
12
12
|
public static boolean isCalledFromJRuby() {
|
13
13
|
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
|
14
|
-
int maxLookBack = Math.min(
|
14
|
+
int maxLookBack = Math.min(9, stackTraceElements.length);
|
15
15
|
for(int i = 0; i < maxLookBack ; i++){
|
16
16
|
if (stackTraceElements[i].getClassName().startsWith("org.jruby.javasupport.JavaMethod")) {
|
17
17
|
return true;
|
@@ -26,7 +26,7 @@ public class ScriptLoader {
|
|
26
26
|
System.out.println("Looking for Ruby class: " + component.getScriptInfo().getRubyClassName());
|
27
27
|
Object rubyClass = JRubyAdapter.get(component.getScriptInfo().getRubyClassName());
|
28
28
|
System.out.println("Found: " + rubyClass);
|
29
|
-
Script rubyScript = new Script(component.getScriptInfo().getScriptName());
|
29
|
+
final Script rubyScript = new Script(component.getScriptInfo().getScriptName());
|
30
30
|
Object rubyInstance;
|
31
31
|
if (rubyScript.exists()) {
|
32
32
|
rubyInstance = component;
|
@@ -61,7 +61,7 @@ public class ScriptLoader {
|
|
61
61
|
System.out.println("Set class: " + JRubyAdapter.get(component.getScriptInfo().getRubyClassName()));
|
62
62
|
Thread t = new Thread(new Runnable(){
|
63
63
|
public void run() {
|
64
|
-
JRubyAdapter.setScriptFilename(
|
64
|
+
JRubyAdapter.setScriptFilename(rubyScript.getAbsolutePath());
|
65
65
|
JRubyAdapter.runScriptlet(script);
|
66
66
|
}
|
67
67
|
});
|
@@ -81,7 +81,7 @@ public class ScriptLoader {
|
|
81
81
|
}
|
82
82
|
JRubyAdapter.runScriptlet("$activity.instance_variable_set '@ruboto_java_class', '" + component.getScriptInfo().getRubyClassName() + "'");
|
83
83
|
JRubyAdapter.runScriptlet("puts %Q{$activity: #$activity}");
|
84
|
-
JRubyAdapter.setScriptFilename(
|
84
|
+
JRubyAdapter.setScriptFilename(rubyScript.getAbsolutePath());
|
85
85
|
JRubyAdapter.runScriptlet(script);
|
86
86
|
}
|
87
87
|
}
|
@@ -25,16 +25,6 @@ RubotoPreferenceActivity.class_eval do
|
|
25
25
|
end
|
26
26
|
rv
|
27
27
|
end
|
28
|
-
|
29
|
-
def setup_preference_screen &block
|
30
|
-
@preference_screen_block = block
|
31
|
-
end
|
32
|
-
|
33
|
-
def on_create(bundle)
|
34
|
-
@parent = nil
|
35
|
-
setPreferenceScreen(instance_eval &@preference_screen_block) if @preference_screen_block
|
36
|
-
instance_eval { @finish_create_block.call } if @finish_create_block
|
37
|
-
end
|
38
28
|
end
|
39
29
|
|
40
30
|
Preference.class_eval do
|
data/lib/ruboto/commands/base.rb
CHANGED
@@ -58,16 +58,23 @@ module Ruboto
|
|
58
58
|
description "Generate the JRuby jars jar"
|
59
59
|
cast :boolean
|
60
60
|
}
|
61
|
+
option('force') {
|
62
|
+
description 'Force creation of project even if the path exists'
|
63
|
+
cast :boolean
|
64
|
+
}
|
61
65
|
|
62
66
|
def run
|
63
67
|
package = params['package'].value
|
64
68
|
name = params['name'].value || package.split('.').last.split('_').map{|s| s.capitalize}.join
|
69
|
+
name[0..0] = name[0..0].upcase
|
65
70
|
activity = params['activity'].value || "#{name}Activity"
|
66
71
|
path = params['path'].value || package.split('.').last
|
67
72
|
target = params['target'].value
|
68
73
|
min_sdk = params['min-sdk'].value || target
|
74
|
+
with_jruby = params['with-jruby'].value
|
75
|
+
force = params['force'].value
|
69
76
|
|
70
|
-
abort "Path (#{path}) must be to a directory that does not yet exist. It will be created." if File.exists?(path)
|
77
|
+
abort "Path (#{path}) must be to a directory that does not yet exist. It will be created." if !force && File.exists?(path)
|
71
78
|
abort "Target must match android-<number>: got #{target}" unless target =~ /^android-(\d+)$/
|
72
79
|
abort "Minimum Android api level is #{MINIMUM_SUPPORTED_SDK}: got #{target}" unless $1.to_i >= MINIMUM_SUPPORTED_SDK_LEVEL
|
73
80
|
|
@@ -96,9 +103,9 @@ module Ruboto
|
|
96
103
|
update_ruboto true
|
97
104
|
update_icons true
|
98
105
|
update_classes nil, true
|
99
|
-
update_jruby true if
|
106
|
+
update_jruby true if with_jruby
|
100
107
|
update_dx_jar true unless params['with-jruby'].value
|
101
|
-
update_core_classes
|
108
|
+
update_core_classes 'include'
|
102
109
|
|
103
110
|
log_action("Generating the default Activity and script") do
|
104
111
|
generate_inheriting_file "Activity", activity, package
|
@@ -144,6 +151,7 @@ module Ruboto
|
|
144
151
|
|
145
152
|
def run
|
146
153
|
name = params['name'].value
|
154
|
+
name[0..0] = name[0..0].upcase
|
147
155
|
script_name = params['script_name'].value || "#{underscore(name)}.rb"
|
148
156
|
klass = params['class'].value
|
149
157
|
|
@@ -346,12 +354,14 @@ module Ruboto
|
|
346
354
|
when "app" then
|
347
355
|
force = params['force'].value
|
348
356
|
old_version = read_ruboto_version
|
349
|
-
if Gem::Version.new(old_version) < Gem::Version.new(Ruboto::UPDATE_VERSION_LIMIT)
|
357
|
+
if old_version && Gem::Version.new(old_version) < Gem::Version.new(Ruboto::UPDATE_VERSION_LIMIT)
|
350
358
|
puts "Detected old Ruboto version: #{old_version}"
|
351
359
|
puts "Will use Ruboto #{Ruboto::UPDATE_VERSION_LIMIT} to update it first."
|
352
360
|
`gem query -i -n ruboto -v #{Ruboto::UPDATE_VERSION_LIMIT}`
|
353
361
|
system "gem install ruboto -v #{Ruboto::UPDATE_VERSION_LIMIT}" unless $? == 0
|
362
|
+
raise "Install of Ruboto #{Ruboto::UPDATE_VERSION_LIMIT} failed!" unless $? == 0
|
354
363
|
system "ruboto _#{Ruboto::UPDATE_VERSION_LIMIT}_ update app"
|
364
|
+
raise "Ruboto update app to #{Ruboto::UPDATE_VERSION_LIMIT} failed!" unless $? == 0
|
355
365
|
end
|
356
366
|
update_android
|
357
367
|
update_test force
|
@@ -362,7 +372,7 @@ module Ruboto
|
|
362
372
|
update_jruby force
|
363
373
|
update_manifest nil, nil, force
|
364
374
|
update_icons force
|
365
|
-
update_core_classes
|
375
|
+
update_core_classes 'include'
|
366
376
|
update_bundle
|
367
377
|
when "jruby" then
|
368
378
|
update_jruby(params['force'].value, true) || abort
|
data/lib/ruboto/util/build.rb
CHANGED
@@ -37,7 +37,7 @@ module Ruboto
|
|
37
37
|
unless force == "include"
|
38
38
|
abort "#{klass} not available in minSdkVersion, added in #{element.attribute('api_added')}; use '--force include' to create it" if
|
39
39
|
element.attribute('api_added') and element.attribute('api_added').to_i > verify_min_sdk.to_i
|
40
|
-
abort "#{klass} deprecated for targetSdkVersion,
|
40
|
+
abort "#{klass} deprecated for targetSdkVersion, deprecated in #{element.attribute('deprecated')}; use '--force include' to create it" if
|
41
41
|
element.attribute('deprecated') and element.attribute('deprecated').to_i <= verify_target_sdk.to_i
|
42
42
|
end
|
43
43
|
|
@@ -55,9 +55,9 @@ module Ruboto
|
|
55
55
|
target_api = verify_target_sdk.to_i
|
56
56
|
|
57
57
|
# Remove methods changed outside of the scope of the sdk versions
|
58
|
-
methods = methods.select{|i|
|
59
|
-
methods = methods.select{|i|
|
60
|
-
methods = methods.select{|i|
|
58
|
+
methods = methods.select{|i| !i.attribute('api_added') || (i.attribute('api_added').to_i <= target_api)}
|
59
|
+
methods = methods.select{|i| !i.attribute('deprecated') || (i.attribute('deprecated').to_i > min_api)}
|
60
|
+
methods = methods.select{|i| !i.attribute('api_removed') || (i.attribute('api_removed').to_i > min_api)}
|
61
61
|
|
62
62
|
# Inform and remove methods that do not exist in one of the sdk versions
|
63
63
|
methods = methods.select do |i|
|
data/lib/ruboto/util/update.rb
CHANGED
@@ -31,21 +31,24 @@ module Ruboto
|
|
31
31
|
|
32
32
|
def update_test(force = nil)
|
33
33
|
root = Dir.getwd
|
34
|
-
if !File.exists?("#{root}/test")
|
34
|
+
if !File.exists?("#{root}/test") || !File.exists?("#{root}/test/AndroidManifest.xml") || !File.exists?("#{root}/test/ant.properties")
|
35
35
|
name = verify_strings.root.elements['string'].text.gsub(' ', '')
|
36
36
|
puts "\nGenerating Android test project #{name} in #{root}..."
|
37
37
|
system %Q{android create test-project -m "#{root.gsub('"', '\"')}" -n "#{name}Test" -p "#{root.gsub('"', '\"')}/test"}
|
38
38
|
FileUtils.rm_rf File.join(root, 'test', 'src', verify_package.split('.'))
|
39
39
|
puts "Done"
|
40
|
-
else
|
41
|
-
test_ant_properties_file = 'test/ant.properties'
|
42
|
-
test_ant_properties = File.read(test_ant_properties_file)
|
43
|
-
if test_ant_properties.gsub!(/^tested.project.dir=.*$/, 'tested.project.dir=../')
|
44
|
-
File.open(test_ant_properties_file, 'w') { |f| f << test_ant_properties }
|
45
|
-
end
|
46
40
|
end
|
47
41
|
|
48
42
|
Dir.chdir File.join(root, 'test') do
|
43
|
+
instrumentation_property = "test.runner=org.ruboto.test.InstrumentationTestRunner\n"
|
44
|
+
prop_file = 'ant.properties'
|
45
|
+
prop_lines = (prop_lines_org = File.read(prop_file)).dup
|
46
|
+
prop_lines.gsub!(/^tested.project.dir=.*$/, 'tested.project.dir=../')
|
47
|
+
prop_lines << instrumentation_property unless prop_lines.include? instrumentation_property
|
48
|
+
if prop_lines != prop_lines_org
|
49
|
+
File.open(prop_file, 'w') { |f| f << prop_lines }
|
50
|
+
end
|
51
|
+
|
49
52
|
test_manifest = REXML::Document.new(File.read('AndroidManifest.xml')).root
|
50
53
|
test_manifest.elements['application'].attributes['android:icon'] ||= '@drawable/ic_launcher'
|
51
54
|
test_manifest.elements['instrumentation'].attributes['android:name'] = 'org.ruboto.test.InstrumentationTestRunner'
|
@@ -65,11 +68,6 @@ module Ruboto
|
|
65
68
|
# end
|
66
69
|
|
67
70
|
File.open("AndroidManifest.xml", 'w') { |f| test_manifest.document.write(f, 4) }
|
68
|
-
instrumentation_property = "test.runner=org.ruboto.test.InstrumentationTestRunner\n"
|
69
|
-
|
70
|
-
prop_file = 'ant.properties'
|
71
|
-
prop_lines = File.readlines(prop_file)
|
72
|
-
File.open(prop_file, 'a') { |f| f << instrumentation_property } unless prop_lines.include?(instrumentation_property)
|
73
71
|
|
74
72
|
run_tests_override = <<-EOF
|
75
73
|
<!-- BEGIN added by Ruboto -->
|
@@ -389,7 +387,7 @@ module Ruboto
|
|
389
387
|
if jruby_core_version >= '1.7.0'
|
390
388
|
excluded_core_packages = [
|
391
389
|
'META-INF', 'cext',
|
392
|
-
|
390
|
+
'com/headius', # included since we are trying to use DexClient
|
393
391
|
'com/headius/invokebinder',
|
394
392
|
'com/kenai/constantine', 'com/kenai/jffi', 'com/martiansoftware', 'ext', 'java',
|
395
393
|
'jline', 'jni',
|
@@ -415,18 +413,20 @@ module Ruboto
|
|
415
413
|
|
416
414
|
# FIXME(uwe): IR is the future. We should try using it.
|
417
415
|
# 'org/jruby/ir',
|
418
|
-
|
416
|
+
'org/jruby/ir/dataflow',
|
419
417
|
# 'org/jruby/ir/instructions',
|
420
418
|
# 'org/jruby/ir/interpreter',
|
421
419
|
# 'org/jruby/ir/operands',
|
422
420
|
# 'org/jruby/ir/passes',
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
421
|
+
'org/jruby/ir/representations',
|
422
|
+
'org/jruby/ir/targets',
|
423
|
+
'org/jruby/ir/transformations',
|
424
|
+
'org/jruby/ir/util',
|
427
425
|
|
428
426
|
'org/jruby/javasupport/bsf',
|
429
|
-
'org/jruby/runtime/invokedynamic',
|
427
|
+
# 'org/jruby/runtime/invokedynamic', # Should be excluded
|
428
|
+
|
429
|
+
# 'org/jruby/management', # should be excluded
|
430
430
|
]
|
431
431
|
|
432
432
|
# TODO(uwe): Remove when we stop supporting jruby-jars < 1.7.0
|
@@ -491,13 +491,12 @@ module Ruboto
|
|
491
491
|
FileUtils.mkdir_p 'tmp'
|
492
492
|
Dir.chdir 'tmp' do
|
493
493
|
FileUtils.mkdir_p 'old'
|
494
|
-
FileUtils.mkdir_p 'new'
|
494
|
+
FileUtils.mkdir_p 'new/jruby.home'
|
495
495
|
Dir.chdir 'old' do
|
496
496
|
`jar -xf ../../#{jruby_stdlib}`
|
497
497
|
end
|
498
|
-
FileUtils.move 'old/META-INF/jruby.home/lib', 'new'
|
499
|
-
|
500
|
-
FileUtils.rm_rf 'new/lib/ruby/gems'
|
498
|
+
FileUtils.move 'old/META-INF/jruby.home/lib', 'new/jruby.home/lib'
|
499
|
+
FileUtils.rm_rf 'new/jruby.home/lib/ruby/gems'
|
501
500
|
|
502
501
|
if excluded_stdlibs.any?
|
503
502
|
|
@@ -513,7 +512,7 @@ module Ruboto
|
|
513
512
|
|
514
513
|
lib_dirs.each do |ld|
|
515
514
|
excluded_stdlibs.each do |d|
|
516
|
-
dir = "new/lib/ruby/#{ld}/#{d}"
|
515
|
+
dir = "new/jruby.home/lib/ruby/#{ld}/#{d}"
|
517
516
|
FileUtils.rm_rf dir if File.exists? dir
|
518
517
|
file = "#{dir}.rb"
|
519
518
|
FileUtils.rm_rf file if File.exists? file
|
@@ -524,9 +523,11 @@ module Ruboto
|
|
524
523
|
|
525
524
|
Dir.chdir "new" do
|
526
525
|
# Uncomment this part to split the stdlib into one jar per directory
|
527
|
-
# Dir['
|
528
|
-
#
|
529
|
-
#
|
526
|
+
# Dir['jruby.home/lib/ruby/*/*'].select { |f| File.directory? f }.each do |d|
|
527
|
+
# file = "#{d}.rb"
|
528
|
+
# `jar -cf ../../jruby-stdlib-#{d.gsub('/', '-')}-#{JRubyJars::VERSION}.jar #{d} #{file if File.exists?(file)}`
|
529
|
+
# FileUtils.rm_rf d
|
530
|
+
# FileUtils.rm_rf file if File.exists?(file)
|
530
531
|
# end
|
531
532
|
|
532
533
|
`jar -cf ../../#{jruby_stdlib} .`
|
data/lib/ruboto/version.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
module Ruboto
|
2
|
-
|
2
|
+
DESCRIPTION = <<EOF
|
3
|
+
Ruboto (JRuby on Android) is a platform for developing full stand-alone apps for
|
4
|
+
Android using the Ruby language and libraries. It includes support libraries
|
5
|
+
and generators for creating projects, classes, tests, and more. The complete
|
6
|
+
APIs of Android, Java, and Ruby is available to you using the Ruby language.
|
7
|
+
EOF
|
8
|
+
VERSION = '0.9.0'
|
3
9
|
UPDATE_VERSION_LIMIT = '0.5.2'
|
4
10
|
end
|
@@ -11,8 +11,8 @@ setup do |activity|
|
|
11
11
|
end
|
12
12
|
|
13
13
|
# ANDROID: 10, PLATFORM: 0.4.7, JRuby: 1.7.0.dev '28334966' expected, but got '28335067'
|
14
|
+
# ANDROID: 15, PLATFORM: STANDALONE, JRuby: 1.7.0 '[28, 33, 51, 68]' expected, but got '[28, 33, 47, 64]'
|
14
15
|
# ANDROID: 16, PLATFORM: 0.4.8.dev, JRuby: 1.7.0.preview2 '[29, 34, 47, 64]' expected, but got '[28, 33, 47, 64]'
|
15
|
-
|
16
16
|
test('stack depth') do |activity|
|
17
17
|
os_offset = {
|
18
18
|
13 => [1]*4,
|
@@ -24,12 +24,13 @@ test('stack depth') do |activity|
|
|
24
24
|
'0.4.7' => [0, 0, 0, 0],
|
25
25
|
'0.4.8.dev' => [0, 0, -4, -4],
|
26
26
|
'0.4.8' => [0, 0, -4, -4],
|
27
|
+
'0.4.9' => [0, 0, -4, -4],
|
27
28
|
}[org.ruboto.JRubyAdapter.platform_version_name] || [0, 0, 0, 0]
|
28
29
|
else # STANDALONE
|
29
30
|
jruby_offset = {
|
30
31
|
'1.7.0.dev' => [1, 1, 1, 1],
|
31
|
-
'1.7.0
|
32
|
-
'1.7.
|
32
|
+
'1.7.0' => [0, 0, -4, -4],
|
33
|
+
'1.7.1.dev' => [0, 0, -4, -4],
|
33
34
|
}[org.jruby.runtime.Constants::VERSION] || [0, 0, 0, 0]
|
34
35
|
end
|
35
36
|
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}"
|
data/test/app_test_methods.rb
CHANGED
@@ -4,10 +4,11 @@ module AppTestMethods
|
|
4
4
|
include RubotoTest
|
5
5
|
|
6
6
|
def test_activity_tests
|
7
|
+
assert_code 'Base64Loads', "require 'base64'"
|
7
8
|
assert_code 'YamlLoads', "with_large_stack{require 'yaml'}"
|
8
9
|
assert_code 'ReadSourceFile', 'File.read(__FILE__)'
|
9
10
|
assert_code 'DirListsFilesInApk', 'Dir["#{File.dirname(__FILE__)}/*"].each{|f| raise "File #{f.inspect} not found" unless File.exists?(f)}'
|
10
|
-
assert_code '
|
11
|
+
assert_code 'RepeatRubotoImportWidget', 'ruboto_import_widget :TextView ; ruboto_import_widget :TextView'
|
11
12
|
run_activity_tests('activity')
|
12
13
|
end
|
13
14
|
|
@@ -26,12 +27,12 @@ module AppTestMethods
|
|
26
27
|
private
|
27
28
|
|
28
29
|
def assert_code(activity_name, code)
|
29
|
-
snake_name = activity_name.scan(/[A-Z]+[a-
|
30
|
+
snake_name = activity_name.scan(/[A-Z]+[a-z0-9]+/).map { |s| s.downcase }.join('_')
|
30
31
|
filename = "src/#{snake_name}_activity.rb"
|
31
32
|
Dir.chdir APP_DIR do
|
32
33
|
system "#{RUBOTO_CMD} gen class Activity --name #{activity_name}Activity"
|
33
34
|
s = File.read(filename)
|
34
|
-
s.gsub!(/(require 'ruboto')/, "\\1\n#{code}")
|
35
|
+
raise "Code injection failed!" unless s.gsub!(/(require 'ruboto\/widget')/, "\\1\n#{code}")
|
35
36
|
File.open(filename, 'w') { |f| f << s }
|
36
37
|
end
|
37
38
|
end
|
@@ -10,6 +10,7 @@ setup do |activity|
|
|
10
10
|
assert @text_view
|
11
11
|
end
|
12
12
|
|
13
|
+
# ANDROID: 15, PLATFORM: STANDALONE, JRuby: 1.7.0 '[44, 72, 62, 79]' expected, but got '[44, 71, 62, 79]'
|
13
14
|
test('stack depth') do |activity|
|
14
15
|
os_offset = {13 => 1, 15 => 1, 16 => 1}[android.os.Build::VERSION::SDK_INT].to_i
|
15
16
|
if org.ruboto.JRubyAdapter.uses_platform_apk?
|
@@ -17,12 +18,14 @@ test('stack depth') do |activity|
|
|
17
18
|
'0.4.7' => [0, 0, 0, 0],
|
18
19
|
'0.4.8.dev' => [0, -1, 0, 0],
|
19
20
|
'0.4.8' => [0, -1, 0, 0],
|
21
|
+
'0.4.9' => [0, -1, 0, 0],
|
20
22
|
}[org.ruboto.JRubyAdapter.platform_version_name] || [0, 0, 0, 0]
|
21
23
|
else # STANDALONE
|
22
24
|
jruby_offset = {
|
23
25
|
'1.7.0.preview1' => [0, -1, -1, -1],
|
24
26
|
'1.7.0.preview2' => [0, -1, 0, 0],
|
25
|
-
'1.7.0
|
27
|
+
'1.7.0' => [0, -1, 0, 0],
|
28
|
+
'1.7.1.dev' => [0, -1, 0, 0],
|
26
29
|
}[org.jruby.runtime.Constants::VERSION] || [0, 0, 0, 0]
|
27
30
|
end
|
28
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}"
|
@@ -14,7 +14,7 @@ end
|
|
14
14
|
# ANDROID: 15, PLATFORM: 0.4.8.dev, JRuby: 1.7.0.preview2 '[44, 68, 77, 93]' expected, but got '[44, 67, 76, 92]'
|
15
15
|
# ANDROID: 10, PLATFORM: STANDALONE, JRuby: 1.7.0.preview2 '[43, 67, 76, 92]' expected, but got '[43, 66, 75, 91]'
|
16
16
|
# ANDROID: 15, PLATFORM: STANDALONE, JRuby: 1.7.0.preview2 '[44, 68, 77, 93]' expected, but got '[44, 67, 76, 92]'
|
17
|
-
|
17
|
+
# ANDROID: 15, PLATFORM: STANDALONE, JRuby: 1.7.0 '[44, 68, 77, 93]' expected, but got '[44, 67, 76, 92]'
|
18
18
|
test('stack depth') do |activity|
|
19
19
|
os_offset = {13 => 1, 15 => 1, 16 => 1}[android.os.Build::VERSION::SDK_INT].to_i
|
20
20
|
if org.ruboto.JRubyAdapter.uses_platform_apk?
|
@@ -22,13 +22,15 @@ test('stack depth') do |activity|
|
|
22
22
|
'0.4.7' => [0, 0, 0, 0],
|
23
23
|
'0.4.8.dev' => [0, -1, -1, -1],
|
24
24
|
'0.4.8' => [0, -1, -1, -1],
|
25
|
+
'0.4.9' => [0, -1, -1, -1],
|
25
26
|
}[org.ruboto.JRubyAdapter.platform_version_name] || [0, 0, 0, 0]
|
26
27
|
else # STANDALONE
|
27
28
|
jruby_offset = {
|
28
29
|
'1.7.0.dev' => [1, 0, 0, 0],
|
29
30
|
'1.7.0.preview1' => [0, -1, -1, -1],
|
30
31
|
'1.7.0.preview2' => [0, -1, -1, -1],
|
31
|
-
'1.7.0
|
32
|
+
'1.7.0' => [0, -1, -1, -1],
|
33
|
+
'1.7.1.dev' => [0, -1, -1, -1],
|
32
34
|
}[org.jruby.runtime.Constants::VERSION] || [0, 0, 0, 0]
|
33
35
|
end
|
34
36
|
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}"
|
data/test/minimal_app_test.rb
CHANGED
@@ -17,6 +17,7 @@ if RubotoTest::RUBOTO_PLATFORM == 'STANDALONE'
|
|
17
17
|
# APK was larger than 4.4MB: 4.7MB. JRuby: 1.7.0.preview2, ANDROID_TARGET: 10.
|
18
18
|
# APK was larger than 3.2MB: 3.5MB. JRuby: 1.6.7, ANDROID_TARGET: 15.
|
19
19
|
# APK was larger than 4.6MB: 4.9MB. JRuby: 1.7.0.preview2, ANDROID_TARGET: 15.
|
20
|
+
# APK was larger than 3.2MB: 4.7MB. JRuby: 1.7.0, ANDROID_TARGET: 15.
|
20
21
|
|
21
22
|
def test_minimal_apk_is_less_than_3_mb
|
22
23
|
apk_size = BigDecimal(File.size("#{APP_DIR}/bin/RubotoTestApp-debug.apk").to_s) / (1024 * 1024)
|
@@ -24,10 +25,9 @@ if RubotoTest::RUBOTO_PLATFORM == 'STANDALONE'
|
|
24
25
|
'1.6.7' => 3.5,
|
25
26
|
'1.6.7.2' => 3.5,
|
26
27
|
'1.6.8' => 3.5,
|
27
|
-
'1.7.0
|
28
|
-
'1.7.
|
29
|
-
|
30
|
-
}[JRUBY_JARS_VERSION.to_s] || 3.2
|
28
|
+
'1.7.0' => ANDROID_TARGET < 15 ? 4.7 : 4.9,
|
29
|
+
'1.7.1.dev' => ANDROID_TARGET < 15 ? 4.7 : 4.9,
|
30
|
+
}[JRUBY_JARS_VERSION.to_s] || 4.9
|
31
31
|
lower_limit = upper_limit * 0.9
|
32
32
|
version_message ="JRuby: #{JRUBY_JARS_VERSION}, ANDROID_TARGET: #{ANDROID_TARGET}"
|
33
33
|
assert apk_size <= upper_limit, "APK was larger than #{'%.1f' % upper_limit}MB: #{'%.1f' % apk_size.ceil(1)}MB. #{version_message}"
|
data/test/ruboto_gen_test.rb
CHANGED
@@ -48,6 +48,7 @@ class RubotoGenTest < Test::Unit::TestCase
|
|
48
48
|
# APK was smaller than 278.1KB: 67.2KB. PLATFORM: CURRENT, ANDROID_TARGET: 15.
|
49
49
|
# APK was larger than 5800.0KB: 5879.2KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.6.7.
|
50
50
|
# APK was larger than 7308.0KB: 7558.3KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.7.0.preview2.
|
51
|
+
# APK was larger than 4200.0KB: 7380.0KB. PLATFORM: STANDALONE, ANDROID_TARGET: 15, JRuby: 1.7.0.
|
51
52
|
|
52
53
|
def test_new_apk_size_is_within_limits
|
53
54
|
apk_size = BigDecimal(File.size("#{APP_DIR}/bin/RubotoTestApp-debug.apk").to_s) / 1024
|
@@ -56,10 +57,9 @@ class RubotoGenTest < Test::Unit::TestCase
|
|
56
57
|
if RUBOTO_PLATFORM == 'STANDALONE'
|
57
58
|
upper_limit = {
|
58
59
|
'1.6.7' => ANDROID_TARGET < 15 ? 5800.0 : 5900.0,
|
59
|
-
'1.7.0
|
60
|
-
'1.7.
|
61
|
-
|
62
|
-
}[JRUBY_JARS_VERSION.to_s] || 4200.0
|
60
|
+
'1.7.0' => ANDROID_TARGET < 15 ? 7400.0 : 7600.0,
|
61
|
+
'1.7.1.dev' => ANDROID_TARGET < 15 ? 7400.0 : 7600.0,
|
62
|
+
}[JRUBY_JARS_VERSION.to_s] || 7600.0
|
63
63
|
version << ", JRuby: #{JRUBY_JARS_VERSION.to_s}"
|
64
64
|
else
|
65
65
|
upper_limit = {
|
@@ -242,13 +242,23 @@ EOF
|
|
242
242
|
run_app_tests
|
243
243
|
end
|
244
244
|
|
245
|
+
def test_activity_with_first_letter_lower_case_in_name
|
246
|
+
Dir.chdir APP_DIR do
|
247
|
+
system "#{RUBOTO_CMD} gen class Activity --name appActivity"
|
248
|
+
assert_equal 0, $?.exitstatus
|
249
|
+
assert File.exists?('src/org/ruboto/test_app/AppActivity.java')
|
250
|
+
assert File.exists?('src/app_activity.rb')
|
251
|
+
assert File.exists?('test/src/app_activity_test.rb')
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
245
255
|
if RUBOTO_PLATFORM == 'FROM_GEM'
|
246
256
|
def test_gen_jruby
|
247
257
|
Dir.chdir APP_DIR do
|
248
258
|
system "#{RUBOTO_CMD} gen jruby"
|
249
259
|
assert_equal 0, $?.exitstatus
|
250
|
-
|
251
|
-
|
260
|
+
assert_equal ["libs/jruby-core-#{JRUBY_JARS_VERSION.to_s.downcase}.jar"], Dir["libs/jruby-core-*.jar"].map(&:downcase)
|
261
|
+
assert_equal ["libs/jruby-stdlib-#{JRUBY_JARS_VERSION.to_s.downcase}.jar"], Dir["libs/jruby-stdlib-*.jar"].map(&:downcase)
|
252
262
|
end
|
253
263
|
end
|
254
264
|
end
|
data/test/sqldroid_test.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require File.expand_path("test_helper", File.dirname(__FILE__))
|
2
2
|
|
3
3
|
# FIXME(uwe): Remove check when we stop supporting JRuby older than 1.7.0.rc1
|
4
|
-
|
4
|
+
# FIXME(uwe): Remove check when we stop supporting Android < 4.0.3
|
5
|
+
if RubotoTest::JRUBY_JARS_VERSION >= Gem::Version.new('1.7.0.rc1') &&
|
6
|
+
(RubotoTest::ANDROID_OS >= 15 || RubotoTest::RUBOTO_PLATFORM != 'STANDALONE')
|
5
7
|
|
6
8
|
require 'bigdecimal'
|
7
9
|
require 'test/app_test_methods'
|
data/test/test_helper.rb
CHANGED
@@ -117,7 +117,7 @@ module RubotoTest
|
|
117
117
|
install_jruby_jars_gem
|
118
118
|
|
119
119
|
if RUBOTO_PLATFORM == 'CURRENT'
|
120
|
-
JRUBY_JARS_VERSION = Gem::Version.new('1.7.
|
120
|
+
JRUBY_JARS_VERSION = Gem::Version.new('1.7.1.dev')
|
121
121
|
else
|
122
122
|
# FIXME(uwe): Simplify when we stop supporting rubygems < 1.8.0
|
123
123
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
|
@@ -179,6 +179,7 @@ class Test::Unit::TestCase
|
|
179
179
|
FileUtils.rm_rf APP_DIR if File.exists? APP_DIR
|
180
180
|
template_dir = "#{APP_DIR}_template_#{$$}"
|
181
181
|
template_dir << "_example_#{example}" if example
|
182
|
+
template_dir << "_bundle_#{[*bundle].join('_')}" if bundle
|
182
183
|
template_dir << '_updated' if update
|
183
184
|
template_dir << '_standalone' if standalone
|
184
185
|
template_dir << "_without_#{excluded_stdlibs.map { |ed| ed.gsub(/[.\/]/, '_') }.join('_')}" if excluded_stdlibs
|
data/test/update_test_methods.rb
CHANGED
@@ -13,6 +13,22 @@ module UpdateTestMethods
|
|
13
13
|
cleanup_app
|
14
14
|
end
|
15
15
|
|
16
|
+
# FIXME(uwe): We have no solution for legacy apps <= 0.9.0.rc1 and new RubotoCore >= 0.4.9.
|
17
|
+
unless Gem::Version.new(@old_ruboto_version) <= Gem::Version.new('0.9.0.rc.1')
|
18
|
+
def test_an_unchanged_app_succeeds_loading_stdlib
|
19
|
+
# FIXME(uwe): Remove when we stop supporting legacy Ruboto 0.9.0.rc.1 apps and older
|
20
|
+
if Gem::Version.new(@old_ruboto_version) <= Gem::Version.new('0.9.0.rc.1')
|
21
|
+
Dir.chdir "#{APP_DIR}/test" do
|
22
|
+
test_props = File.read('ant.properties')
|
23
|
+
test_props.gsub! /^tested.project.dir=.*$/, 'tested.project.dir=../'
|
24
|
+
File.open('ant.properties', 'w') { |f| f << test_props }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
assert_code "require 'base64'"
|
28
|
+
run_app_tests
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
16
32
|
def test_broadcast_receiver
|
17
33
|
Dir.chdir APP_DIR do
|
18
34
|
puts "Adding a broadcast receiver"
|
@@ -63,4 +79,15 @@ module UpdateTestMethods
|
|
63
79
|
end
|
64
80
|
end
|
65
81
|
|
82
|
+
private
|
83
|
+
|
84
|
+
def assert_code(code)
|
85
|
+
filename = "src/ruboto_test_app_activity.rb"
|
86
|
+
Dir.chdir APP_DIR do
|
87
|
+
s = File.read(filename)
|
88
|
+
raise "Code injection failed!" unless s.gsub!(/(require 'ruboto\/widget')/, "\\1\n#{code}")
|
89
|
+
File.open(filename, 'w') { |f| f << s }
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
66
93
|
end
|
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 59
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
9
|
- 0
|
10
|
-
|
11
|
-
- 1
|
12
|
-
version: 0.9.0.rc.1
|
10
|
+
version: 0.9.0
|
13
11
|
platform: ruby
|
14
12
|
authors:
|
15
13
|
- Daniel Jackoway
|
@@ -20,7 +18,7 @@ autorequire:
|
|
20
18
|
bindir: bin
|
21
19
|
cert_chain: []
|
22
20
|
|
23
|
-
date: 2012-
|
21
|
+
date: 2012-11-07 00:00:00 Z
|
24
22
|
dependencies:
|
25
23
|
- !ruby/object:Gem::Dependency
|
26
24
|
name: main
|
@@ -45,9 +43,12 @@ dependencies:
|
|
45
43
|
version: 4.7.2
|
46
44
|
type: :runtime
|
47
45
|
version_requirements: *id001
|
48
|
-
description:
|
49
|
-
Ruboto
|
50
|
-
|
46
|
+
description: |
|
47
|
+
Ruboto (JRuby on Android) is a platform for developing full stand-alone apps for
|
48
|
+
Android using the Ruby language and libraries. It includes support libraries
|
49
|
+
and generators for creating projects, classes, tests, and more. The complete
|
50
|
+
APIs of Android, Java, and Ruby is available to you using the Ruby language.
|
51
|
+
|
51
52
|
email: ruboto@googlegroups.com
|
52
53
|
executables:
|
53
54
|
- ruboto
|
@@ -204,14 +205,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
206
|
none: false
|
206
207
|
requirements:
|
207
|
-
- - "
|
208
|
+
- - ">="
|
208
209
|
- !ruby/object:Gem::Version
|
209
|
-
hash:
|
210
|
+
hash: 3
|
210
211
|
segments:
|
211
|
-
-
|
212
|
-
|
213
|
-
- 1
|
214
|
-
version: 1.3.1
|
212
|
+
- 0
|
213
|
+
version: "0"
|
215
214
|
requirements: []
|
216
215
|
|
217
216
|
rubyforge_project: ruboto/ruboto
|