ruboto 0.9.0 → 0.10.0.rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/README.md +13 -13
  2. data/Rakefile +4 -4
  3. data/assets/rakelib/ruboto.rake +8 -4
  4. data/assets/samples/sample_broadcast_receiver.rb +0 -8
  5. data/assets/src/InheritingBroadcastReceiver.java +0 -19
  6. data/assets/src/InheritingClass.java +1 -8
  7. data/assets/src/RubotoActivity.java +1 -20
  8. data/assets/src/RubotoBroadcastReceiver.java +15 -25
  9. data/assets/src/RubotoService.java +1 -15
  10. data/assets/src/org/ruboto/EntryPointActivity.java +0 -1
  11. data/assets/src/org/ruboto/JRubyAdapter.java +9 -8
  12. data/assets/src/org/ruboto/RubotoComponent.java +0 -3
  13. data/assets/src/org/ruboto/Script.java +9 -9
  14. data/assets/src/org/ruboto/ScriptInfo.java +0 -15
  15. data/assets/src/org/ruboto/ScriptLoader.java +31 -43
  16. data/assets/src/ruboto/activity.rb +16 -41
  17. data/assets/src/ruboto/base.rb +0 -70
  18. data/assets/src/ruboto/broadcast_receiver.rb +2 -22
  19. data/assets/src/ruboto/package.rb +0 -1
  20. data/assets/src/ruboto/preference.rb +7 -3
  21. data/assets/src/ruboto/service.rb +14 -51
  22. data/assets/src/ruboto/widget.rb +2 -2
  23. data/lib/DexClient.java +10 -3
  24. data/lib/ruboto/util/build.rb +0 -5
  25. data/lib/ruboto/util/code_formatting.rb +1 -1
  26. data/lib/ruboto/util/update.rb +69 -50
  27. data/lib/ruboto/util/verify.rb +6 -5
  28. data/lib/ruboto/util/xml_element.rb +16 -29
  29. data/lib/ruboto/version.rb +2 -2
  30. data/test/activity/mytest_activity.rb +56 -0
  31. data/test/activity/mytest_activity_test.rb +52 -0
  32. data/test/activity/mytest_otherfile_activity.rb +12 -0
  33. data/test/activity/navigation_activity.rb +1 -1
  34. data/test/activity/subclass_activity.rb +10 -5
  35. data/test/activity/subclass_activity_test.rb +17 -2
  36. data/test/activity/view_constants_activity.rb +42 -0
  37. data/test/activity/view_constants_activity_test.rb +30 -0
  38. data/test/app_test_methods.rb +31 -26
  39. data/test/broadcast_receiver_test.rb +3 -1
  40. data/test/ruboto_gen_test.rb +4 -4
  41. data/test/test_helper.rb +5 -2
  42. metadata +18 -38
  43. data/assets/src/ruboto.rb +0 -25
  44. data/assets/src/ruboto/legacy.rb +0 -220
  45. data/assets/src/ruboto/menu.rb +0 -88
  46. data/lib/java_class_gen/InheritingClass.java.erb +0 -10
  47. data/test/block_def_activity/image_button_activity.rb +0 -23
  48. data/test/block_def_activity/image_button_activity_test.rb +0 -21
  49. data/test/block_def_activity/image_button_and_button_activity.rb +0 -20
  50. data/test/block_def_activity/image_button_and_button_activity_test.rb +0 -27
  51. data/test/block_def_activity/margins_activity.rb +0 -18
  52. data/test/block_def_activity/margins_activity_test.rb +0 -25
  53. data/test/block_def_activity/option_menu_activity.rb +0 -26
  54. data/test/block_def_activity/option_menu_activity_test.rb +0 -17
  55. data/test/block_def_activity/psych_activity.rb +0 -35
  56. data/test/block_def_activity/psych_activity_test.rb +0 -16
  57. data/test/block_def_activity/stack_activity.rb +0 -25
  58. data/test/block_def_activity/stack_activity_test.rb +0 -39
  59. data/test/handle_activity/image_button_activity.rb +0 -21
  60. data/test/handle_activity/image_button_activity_test.rb +0 -21
  61. data/test/handle_activity/image_button_and_button_activity.rb +0 -24
  62. data/test/handle_activity/image_button_and_button_activity_test.rb +0 -27
  63. data/test/handle_activity/margins_activity.rb +0 -15
  64. data/test/handle_activity/margins_activity_test.rb +0 -25
  65. data/test/handle_activity/option_menu_activity.rb +0 -25
  66. data/test/handle_activity/option_menu_activity_test.rb +0 -20
  67. data/test/handle_activity/psych_activity.rb +0 -31
  68. data/test/handle_activity/psych_activity_test.rb +0 -16
  69. data/test/handle_activity/stack_activity.rb +0 -24
  70. data/test/handle_activity/stack_activity_test.rb +0 -47
  71. data/test/view_constants_test.rb +0 -103
data/README.md CHANGED
@@ -16,7 +16,7 @@ Before you use Ruboto, you should do the following things:
16
16
  * Install the JDK if it's not on your system already
17
17
  * Install [jruby](http://jruby.org/) if you don't already have it. JRuby has a [very easy install process](http://jruby.org/#2), or you can use [rvm](http://rvm.beginrescueend.com/)
18
18
  * Install [the Android SDK](http://developer.android.com/sdk/index.html)
19
- * Add the sdk's `tools/` directory to your `$PATH`
19
+ * Add the sdk's `tools/` and `platform-tools/` directory to your `$PATH`
20
20
  * Generate an [Emulator](http://developer.android.com/guide/developing/tools/emulator.html) image unless you want to develop using your phone.
21
21
 
22
22
  General Information
@@ -24,7 +24,7 @@ General Information
24
24
 
25
25
  The Rakefile assumes that you are in the root directory of your app, as do all commands of the `ruboto` command line utility, other than `ruboto gen app`.
26
26
 
27
- The Rakefile requires you to run it through JRuby's rake.
27
+ The Rakefile requires you to run it through JRuby's rake.
28
28
 
29
29
  Command-line Tools
30
30
  -------
@@ -46,7 +46,7 @@ Version values must be specified using'android-' and the sdk level number (e.g.,
46
46
  <a name="class_generator"></a>
47
47
  ### Class generator
48
48
 
49
- Generates a Java class (Activity, Service, or BroadcastReceiver) associated with a specific ruboto script. The generator also generates a corrsponding test script.
49
+ Generates a Java class (Activity, Service, or BroadcastReceiver) associated with a specific ruboto script. The generator also generates a corresponding test script.
50
50
 
51
51
  $ ruboto gen class ClassName --name YourObjectName
52
52
  Ex:
@@ -77,7 +77,7 @@ When you're ready to post your app to the Market, you need to do a few things.
77
77
 
78
78
  First, you'll need to generate a key to sign the app with using `keytool` if you do not already have one. If you're ok with accepting some sane defaults, you can use
79
79
  $ ruboto gen key --alias alias_for_your_key
80
- with an optional flag `--keystore /path/to/keystore.keystore`, which defaults to `~/.android/production.keystore`. It will ask for a password for the keystore and one for the key itself. Make sure that you remember those two passwords, as well as the alias for the key.
80
+ with an optional flag `--keystore /path/to/keystore.keystore`, which defaults to `~/.android/production.keystore`. It will ask for a password for the keystore and one for the key itself. Make sure that you remember those two passwords, as well as the alias for the key.
81
81
 
82
82
  Also make sure to keep your key backed up (if you lose it, you won't be able to release updates to your app that can install right over the old versions), but secure.
83
83
 
@@ -113,16 +113,16 @@ Also, you need root access to your device for this to work, as it needs to write
113
113
  You can update various portions of your generated Ruboto app through the ruboto command:
114
114
 
115
115
  * JRuby:
116
-
116
+
117
117
  1) If a new version of JRuby is released, you should update your gem (e.g., sudo gem update jruby-jars).
118
118
 
119
- 2) From the root directory of your app:
119
+ 2) From the root directory of your app:
120
120
 
121
121
  $ ruboto update jruby
122
122
 
123
123
  * The ruboto.rb script:
124
124
 
125
- 1) From the root directory of your app:
125
+ 1) From the root directory of your app:
126
126
 
127
127
  $ ruboto update ruboto
128
128
 
@@ -136,12 +136,12 @@ You can update various portions of your generated Ruboto app through the ruboto
136
136
 
137
137
  $ ruboto gen core Activity --method_base all-on-or-none --method_include specific-methods-to-include --method_include specific-methods-to-exclude
138
138
 
139
- 4) The generator will load up the SDK information and find the specified methods. The generator will abort around methods that were added or deprecated based on the SDK levels. You can either use method_exclude to remove methods individually or add '--force exclude' to remove the all. You can also us '--force include' to create them anyway (added methods are created without calling super to avoid crashin on legacy hardware).
139
+ 4) The generator will load up the SDK information and find the specified methods. The generator will abort around methods that were added or deprecated based on the SDK levels. You can either use method_exclude to remove methods individually or add '--force exclude' to remove the all. You can also us '--force include' to create them anyway (added methods are created without calling super to avoid crashing on legacy hardware).
140
140
 
141
141
  Scripts
142
142
  -------
143
143
 
144
- The main thing Ruboto offers you is the ability to write Ruby scripts to define the behavior of Activites, BroadcastReceievers, and Services. (Eventually it'll be every class. It's setup such that adding in more classes should be trivial.)
144
+ The main thing Ruboto offers you is the ability to write Ruby scripts to define the behavior of Activities, BroadcastReceievers, and Services. (Eventually it'll be every class. It's setup such that adding in more classes should be trivial.)
145
145
 
146
146
  Here's how it works:
147
147
 
@@ -212,14 +212,14 @@ Want to contribute? Great! Meet us in #ruboto on irc.freenode.net, fork the proj
212
212
  * As you gain wisdom, contribute it to [the wiki](http://github.com/ruboto/ruboto/wiki/)
213
213
  * When you gain enough wisdom, reconsider whether you could fork the project.
214
214
 
215
- If contributing code to the project, please run the exising tests and add tests for your changes. You run the tests using rake
215
+ If contributing code to the project, please run the existing tests and add tests for your changes. You run the tests using rake
216
216
 
217
217
  $ jruby -S rake test
218
218
 
219
219
  Getting Help
220
220
  ------------
221
221
 
222
- * You'll need to be pretty familiar with the Android API. The [Developer Guide](http://developer.android.com/guide/index.html) and [Reference](http://developer.android.com/reference/packages.html) are very useful.
222
+ * You'll need to be pretty familiar with the Android API. The [Developer Guide](http://developer.android.com/guide/index.html) and [Reference](http://developer.android.com/reference/packages.html) are very useful.
223
223
  * There is further documentation at the [wiki](http://github.com/ruboto/ruboto/wiki)
224
224
  * If you have bugs or feature requests, [open an issue on GitHub](http://github.com/ruboto/ruboto/issues)
225
225
  * You can ask questions in #ruboto on irc.freenode.net and on the [mailing list](http://groups.google.com/groups/ruboto)
@@ -241,9 +241,9 @@ If you have an "eclair" emulator that runs Android 2.1 and a "froyo" one that ru
241
241
  Alternatives
242
242
  ------------
243
243
 
244
- If Ruboto's performance is a problem for you, or you want something that gives you total access to the android API (as Ruboto does not yet do), check out [Mirah](http://mirah.org/) and [Garrett](http://github.com/technomancy/Garrett).
244
+ If Ruboto's performance is a problem for you, or you want something that gives you total access to the android API (as Ruboto does not yet do), check out [Mirah](http://mirah.org/) and [Garrett](http://github.com/technomancy/Garrett).
245
245
 
246
- Mirah, formerly known as Duby, is a language with Ruby-like syntax that compiles to java files. This means that it adds no big runtime dependencies and has essentially the same performance as writing Java code because it essentially generates the same Java code that you would write. This makes it extremely well-suited for mobile devices where performance is a much bigger consideration.
246
+ Mirah, formerly known as Duby, is a language with Ruby-like syntax that compiles to java files. This means that it adds no big runtime dependencies and has essentially the same performance as writing Java code because it essentially generates the same Java code that you would write. This makes it extremely well-suited for mobile devices where performance is a much bigger consideration.
247
247
 
248
248
  Garrett is a "playground for Mirah exploration on Android."
249
249
 
data/Rakefile CHANGED
@@ -260,10 +260,10 @@ end
260
260
 
261
261
  desc "Push the gem to RubyGems"
262
262
  task :release => [:clean, :gem] do
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"
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"
267
267
  sh "gem push #{GEM_FILE}"
268
268
 
269
269
  examples_glob = "#{EXAMPLE_FILE.slice(/^.*?_\d+\.\d+\.\d+/)}*"
@@ -270,11 +270,19 @@ file BUNDLE_JAR => [GEM_FILE, GEM_LOCK_FILE] do
270
270
  Dir['*'].each do |gem_lib|
271
271
  Dir.chdir "#{gem_lib}/lib" do
272
272
  Dir['**/*.jar'].each do |jar|
273
+ unless jar =~ /sqlite-jdbc/
274
+ puts "Expanding #{gem_lib} #{jar} into #{BUNDLE_JAR}"
275
+ `jar xf #{jar}`
276
+ end
273
277
  if jar == 'arjdbc/jdbc/adapter_java.jar'
274
278
  jar_load_code = <<-END_CODE
275
279
  require 'jruby'
276
280
  Java::arjdbc.jdbc.AdapterJavaService.new.basicLoad(JRuby.runtime)
277
281
  END_CODE
282
+ classes = Dir['arjdbc/**/*']
283
+ dbs = /db2|derby|firebird|h2|hsqldb|informix|mimer|mssql|mysql|oracle|postgres|sybase/i
284
+ files = classes.grep(dbs)
285
+ FileUtils.rm_f(files)
278
286
  elsif jar =~ /shared\/jopenssl.jar$/
279
287
  jar_load_code = <<-END_CODE
280
288
  require 'jruby'
@@ -285,10 +293,6 @@ Java::JopensslService.new.basicLoad(JRuby.runtime)
285
293
  else
286
294
  jar_load_code = ''
287
295
  end
288
- unless jar =~ /sqlite-jdbc/
289
- puts "Expanding #{gem_lib} #{jar} into #{BUNDLE_JAR}"
290
- `jar xf #{jar}`
291
- end
292
296
  puts "Writing dummy JAR file #{jar + '.rb'}"
293
297
  File.open(jar + '.rb', 'w') { |f| f << jar_load_code }
294
298
  if jar.end_with?('.jar')
@@ -5,14 +5,6 @@ class SampleBroadcastReceiver
5
5
  def on_receive(context, intent)
6
6
  Log.v "SampleBroadcastReceiver", 'Broadcast received!'
7
7
  Log.v "SampleBroadcastReceiver", intent.getExtras.to_s
8
- context.run_on_ui_thread do
9
- begin
10
- $activity.title = 'Broadcast received!'
11
- rescue Exception
12
- Log.e "Exception setting title: #{$!.message}\n#{$!.backtrace.join("\n")}"
13
- end
14
- end
15
- Log.v "SampleBroadcastReceiver", 'Broadcast processed OK!'
16
8
  rescue Exception
17
9
  Log.e "Exception processing broadcast: #{$!.message}\n#{$!.backtrace.join("\n")}"
18
10
  end
@@ -1,28 +1,9 @@
1
1
  package THE_PACKAGE;
2
2
 
3
3
  import org.ruboto.JRubyAdapter;
4
- import org.ruboto.ScriptLoader;
5
4
 
6
5
  public class InheritingBroadcastReceiver extends org.ruboto.RubotoBroadcastReceiver {
7
- private boolean scriptLoaded = false;
8
-
9
6
  public InheritingBroadcastReceiver() {
10
7
  super("sample_broadcast_receiver.rb");
11
- if (JRubyAdapter.isInitialized()) {
12
- scriptLoaded = true;
13
- }
14
- }
15
-
16
- public void onReceive(android.content.Context context, android.content.Intent intent) {
17
- if (!scriptLoaded) {
18
- if (JRubyAdapter.setUpJRuby(context)) {
19
- ScriptLoader.loadScript(this);
20
- scriptLoaded = true;
21
- } else {
22
- // FIXME(uwe): What to do if the Ruboto Core platform is missing?
23
- }
24
- }
25
- super.onReceive(context, intent);
26
8
  }
27
-
28
9
  }
@@ -9,9 +9,7 @@ import org.ruboto.ScriptInfo;
9
9
  import org.ruboto.ScriptLoader;
10
10
 
11
11
  public class THE_RUBOTO_CLASS THE_ACTION THE_ANDROID_CLASS {
12
- THE_CONSTANTS
13
-
14
- private final ScriptInfo scriptInfo = new ScriptInfo(CONSTANTS_COUNT);
12
+ private final ScriptInfo scriptInfo = new ScriptInfo();
15
13
  {
16
14
  scriptInfo.setRubyClassName(getClass().getSimpleName());
17
15
  ScriptLoader.loadScript(this);
@@ -23,11 +21,6 @@ THE_CONSTRUCTORS
23
21
  return scriptInfo;
24
22
  }
25
23
 
26
- // FIXME(uwe): Only used for block based primary activities. Remove if we remove support for such.
27
- public void onCreateSuper() {
28
- // Do nothing
29
- }
30
-
31
24
  THE_METHODS
32
25
 
33
26
  }
@@ -8,9 +8,7 @@ import android.app.ProgressDialog;
8
8
  import android.os.Bundle;
9
9
 
10
10
  public class THE_RUBOTO_CLASS THE_ACTION THE_ANDROID_CLASS {
11
- THE_CONSTANTS
12
-
13
- private final ScriptInfo scriptInfo = new ScriptInfo(CONSTANTS_COUNT);
11
+ private final ScriptInfo scriptInfo = new ScriptInfo();
14
12
  private String remoteVariable = null;
15
13
  Bundle[] args;
16
14
  private Bundle configBundle = null;
@@ -32,12 +30,6 @@ THE_CONSTANTS
32
30
  *
33
31
  * Activity Lifecycle: onCreate
34
32
  */
35
-
36
- // FIXME(uwe): Only used for block based primary activities. Remove if we remove support for such.
37
- public void onCreateSuper() {
38
- super.onCreate((Bundle) args[0]);
39
- }
40
-
41
33
  @Override
42
34
  public void onCreate(Bundle bundle) {
43
35
  System.out.println("THE_RUBOTO_CLASS onCreate(): " + getClass().getName());
@@ -71,23 +63,12 @@ THE_CONSTANTS
71
63
  }
72
64
 
73
65
  if (JRubyAdapter.isInitialized()) {
74
- prepareJRuby();
75
66
  ScriptLoader.loadScript(this, (Object[]) args);
76
67
  } else {
77
68
  super.onCreate(bundle);
78
69
  }
79
70
  }
80
71
 
81
- // TODO(uwe): Only needed for non-class-based definitions
82
- // Can be removed if we stop supporting non-class-based definitions
83
- // This causes JRuby to initialize and takes a while.
84
- protected void prepareJRuby() {
85
- JRubyAdapter.put("$context", this);
86
- JRubyAdapter.put("$activity", this);
87
- JRubyAdapter.put("$bundle", args[0]);
88
- }
89
- // TODO end
90
-
91
72
  public boolean rubotoAttachable() {
92
73
  return true;
93
74
  }
@@ -5,13 +5,9 @@ import java.io.IOException;
5
5
  import org.ruboto.ScriptLoader;
6
6
 
7
7
  public class THE_RUBOTO_CLASS THE_ACTION THE_ANDROID_CLASS {
8
- private final ScriptInfo scriptInfo = new ScriptInfo(CONSTANTS_COUNT);
8
+ private final ScriptInfo scriptInfo = new ScriptInfo();
9
+ private boolean scriptLoaded = false;
9
10
 
10
- public void setCallbackProc(int id, Object obj) {
11
- // Error: no callbacks
12
- throw new RuntimeException("RubotoBroadcastReceiver does not accept callbacks");
13
- }
14
-
15
11
  public ScriptInfo getScriptInfo() {
16
12
  return scriptInfo;
17
13
  }
@@ -25,39 +21,33 @@ public class THE_RUBOTO_CLASS THE_ACTION THE_ANDROID_CLASS {
25
21
 
26
22
  if (name != null) {
27
23
  scriptInfo.setScriptName(name);
28
-
29
24
  if (JRubyAdapter.isInitialized()) {
30
- // TODO(uwe): Only needed for non-class-based definitions
31
- // Can be removed if we stop supporting non-class-based definitions
32
- JRubyAdapter.put("$broadcast_receiver", this);
33
- // TODO end
34
-
35
25
  ScriptLoader.loadScript(this);
26
+ scriptLoaded = true;
36
27
  }
37
28
  }
38
29
  }
39
30
 
40
- // FIXME(uwe): Only used for block based primary activities. Remove if we remove support for such.
41
- public void onCreateSuper() {
42
- // Do nothing
43
- }
44
-
45
31
  public void onReceive(android.content.Context context, android.content.Intent intent) {
46
32
  try {
47
33
  Log.d("onReceive: " + this);
48
-
49
- // FIXME(uwe): Only needed for older broadcast receiver using callbacks
50
- // FIXME(uwe): Remove if we stop suppporting callbacks (to avoid global variables).
51
- JRubyAdapter.put("$context", context);
52
- JRubyAdapter.put("$intent", intent);
53
- JRubyAdapter.put("$broadcast_receiver", this);
54
- // FIXME end
34
+ if (!scriptLoaded) {
35
+ if (JRubyAdapter.setUpJRuby(context)) {
36
+ ScriptLoader.loadScript(this);
37
+ scriptLoaded = true;
38
+ } else {
39
+ // FIXME(uwe): What to do if the Ruboto Core platform is missing?
40
+ }
41
+ }
55
42
 
56
43
  // FIXME(uwe): Simplify when we stop supporting JRuby 1.6.x
57
44
  if (JRubyAdapter.isJRubyPreOneSeven()) {
45
+ JRubyAdapter.put("$broadcast_receiver", this);
46
+ JRubyAdapter.put("$context", context);
47
+ JRubyAdapter.put("$intent", intent);
58
48
  JRubyAdapter.runScriptlet("$broadcast_receiver.on_receive($context, $intent)");
59
49
  } else if (JRubyAdapter.isJRubyOneSeven()) {
60
- JRubyAdapter.runRubyMethod(this, "on_receive", new Object[]{context, intent});
50
+ JRubyAdapter.runRubyMethod(this, "on_receive", new Object[]{context, intent});
61
51
  } else {
62
52
  throw new RuntimeException("Unknown JRuby version: " + JRubyAdapter.get("JRUBY_VERSION"));
63
53
  }
@@ -5,9 +5,7 @@ import org.ruboto.ScriptLoader;
5
5
  import java.io.IOException;
6
6
 
7
7
  public class THE_RUBOTO_CLASS THE_ACTION THE_ANDROID_CLASS {
8
- THE_CONSTANTS
9
-
10
- private final ScriptInfo scriptInfo = new ScriptInfo(CONSTANTS_COUNT);
8
+ private final ScriptInfo scriptInfo = new ScriptInfo();
11
9
 
12
10
  public ScriptInfo getScriptInfo() {
13
11
  return scriptInfo;
@@ -17,12 +15,6 @@ THE_CONSTANTS
17
15
  *
18
16
  * Service Lifecycle: onCreate
19
17
  */
20
-
21
- // FIXME(uwe): Only used for block based primary activities. Remove if we remove support for such.
22
- public void onCreateSuper() {
23
- super.onCreate();
24
- }
25
-
26
18
  @Override
27
19
  public void onCreate() {
28
20
  if (ScriptLoader.isCalledFromJRuby()) {
@@ -32,12 +24,6 @@ THE_CONSTANTS
32
24
  System.out.println("RubotoService.onCreate()");
33
25
 
34
26
  if (JRubyAdapter.setUpJRuby(this)) {
35
- // TODO(uwe): Only needed for non-class-based definitions
36
- // Can be removed if we stop supporting non-class-based definitions
37
- JRubyAdapter.defineGlobalVariable("$context", this);
38
- JRubyAdapter.defineGlobalVariable("$service", this);
39
- // TODO end
40
-
41
27
  ScriptLoader.loadScript(this);
42
28
  } else {
43
29
  // FIXME(uwe): What to do if the Ruboto Core platform cannot be found?
@@ -100,7 +100,6 @@ public class EntryPointActivity extends org.ruboto.RubotoActivity {
100
100
  final boolean jrubyOk = JRubyAdapter.setUpJRuby(EntryPointActivity.this);
101
101
  if (jrubyOk) {
102
102
  Log.d("onResume: JRuby OK");
103
- prepareJRuby();
104
103
  runOnUiThread(new Runnable() {
105
104
  public void run() {
106
105
  fireRubotoActivity();
@@ -242,7 +242,7 @@ public class JRubyAdapter {
242
242
  // END Ruboto HeapAlloc
243
243
  setDebugBuild(appContext);
244
244
  Log.d("Setting up JRuby runtime (" + (isDebugBuild ? "DEBUG" : "RELEASE") + ")");
245
- System.setProperty("jruby.compile.mode", "OFF"); // OFF OFFIR JITIR? FORCEIR
245
+ System.setProperty("jruby.compile.mode", "OFF"); // OFF OFFIR JITIR? FORCE FORCEIR
246
246
  // System.setProperty("jruby.compile.backend", "DALVIK");
247
247
  System.setProperty("jruby.bytecode.version", "1.6");
248
248
  System.setProperty("jruby.interfaces.useProxy", "true");
@@ -255,7 +255,7 @@ public class JRubyAdapter {
255
255
  System.setProperty("jruby.backtrace.style", "normal"); // normal raw full mri
256
256
 
257
257
  // Uncomment these to debug/profile Ruby source loading
258
- System.setProperty("jruby.debug.loadService", "true");
258
+ // System.setProperty("jruby.debug.loadService", "true");
259
259
  // System.setProperty("jruby.debug.loadService.timing", "true");
260
260
 
261
261
  // Used to enable JRuby to generate proxy classes
@@ -342,6 +342,7 @@ public class JRubyAdapter {
342
342
  System.setProperty("jruby.home", jrubyHome);
343
343
 
344
344
  addLoadPath(scriptsDirName(appContext));
345
+ put("$package_name", appContext.getPackageName());
345
346
 
346
347
  initialized = true;
347
348
  } catch (ClassNotFoundException e) {
@@ -371,9 +372,7 @@ public class JRubyAdapter {
371
372
  return RUBOTO_CORE_VERSION_NAME != null;
372
373
  }
373
374
 
374
- // Private methods
375
-
376
- private static Boolean addLoadPath(String scriptsDir) {
375
+ public static Boolean addLoadPath(String scriptsDir) {
377
376
  if (new File(scriptsDir).exists()) {
378
377
  Log.i("Added directory to load path: " + scriptsDir);
379
378
  Script.addDir(scriptsDir);
@@ -387,6 +386,8 @@ public class JRubyAdapter {
387
386
  }
388
387
  }
389
388
 
389
+ // Private methods
390
+
390
391
  @SuppressWarnings("unchecked")
391
392
  private static <T> T callScriptingContainerMethod(Class<T> returnType, String methodName, Object... args) {
392
393
  Class<?>[] argClasses = new Class[args.length];
@@ -495,15 +496,15 @@ public class JRubyAdapter {
495
496
  }
496
497
  }
497
498
 
498
- private static void setLocalContextScope(String val) {
499
+ public static void setLocalContextScope(String val) {
499
500
  localContextScope = val;
500
501
  }
501
502
 
502
- private static void setLocalVariableBehavior(String val) {
503
+ public static void setLocalVariableBehavior(String val) {
503
504
  localVariableBehavior = val;
504
505
  }
505
506
 
506
- private static void setOutputStream(PrintStream out) {
507
+ public static void setOutputStream(PrintStream out) {
507
508
  if (ruby == null) {
508
509
  output = out;
509
510
  } else {
@@ -2,7 +2,4 @@ package org.ruboto;
2
2
 
3
3
  public interface RubotoComponent {
4
4
  ScriptInfo getScriptInfo();
5
-
6
- // FIXME(uwe): Only used for block based primary activities. Remove if we remove support for such.
7
- void onCreateSuper();
8
5
  }