ruboto 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00cab987d3fcf1b915f97630b2e2199fff2cc215
4
- data.tar.gz: a1a0c57fe7ba04e52c4b39868212553f220321f4
3
+ metadata.gz: 541c9b2e7673b6da8fc43a3534f5f2fcc2d8c718
4
+ data.tar.gz: 86da6d0da33706109710b734f42ed4da1abd019e
5
5
  SHA512:
6
- metadata.gz: cb9071d664bfd5517e03e01f281e291d1b13fbdeda5dcf8ca1c1dde64acbe924dff69e4afeea168b01079e38e6ca00af8c46213cdb66d72d68a7f5bf0d2e0eb8
7
- data.tar.gz: e31c4dc89f7a6d82b19ff82111cd31b1c4870233c40b4f37f1b15e61b852f0e78d60eacf32ed66e587c6b603732b8d8786584b0fe1fbcc6bda7f124a27b998fe
6
+ metadata.gz: 14ce1aac618874c8d9a99588065a767027419546a9a399b870ccfe8e80007aeff10b412c59e35950da1337d0abe83f78c4771115f948858b2c7ab1e79510d73d
7
+ data.tar.gz: cd2279a27b6cbf5206dafc6f3f0314e32917f79a236db532159cf1c54e73293e29456828660665124a75aefc772f7381f09758f76921454eb0a8bf6554a94b74
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruboto (1.0.0)
5
- main (>= 4.7.2)
6
- rake
7
- rubyzip (>= 1.0.0)
4
+ ruboto (1.0.1)
5
+ main (~> 5.0)
6
+ rake (~> 10.0)
7
+ rubyzip (~> 1.0)
8
8
 
9
9
  GEM
10
10
  remote: http://rubygems.org/
@@ -1,23 +1,10 @@
1
- Subject: [ANN] Ruboto 1.0.0 release candidate
1
+ Subject: [ANN] Ruboto 1.0.1 release candidate
2
2
 
3
3
  Hi all!
4
4
 
5
- The Ruboto 1.0.0 release candidate is now available.
6
-
7
- The main motivation for the 1.0 release is to announce that Ruboto is
8
- ready for general consumption!
9
-
10
- * All important parts of the Android API are available.
11
- * The API has stabilised.
12
- * Performance is reasonable. (Best case startup 4 seconds or less).
13
- * Home page/Wiki/Tutorials and other docs are of high enough quality that
14
- new developers have a low threshold to get going, and more advanced
15
- developers can find how to do more advanced apps.
16
-
17
- Notable features this release is RubyGems support for the "dalvik"
18
- platform and support for using Android utility projects. This means you
19
- can release gems for dalvik only and consume in-house or third-party
20
- utility projects.
5
+ The Ruboto 1.0.1 release candidate is now available.
6
+
7
+ This release focuses on bug fixes and documentation.
21
8
 
22
9
  As always we need your help and feedback to ensure the quality of the release. Please install the release candidate using
23
10
 
data/RELEASE_DOC.md CHANGED
@@ -1,6 +1,6 @@
1
- Subject: [ANN] Ruboto 1.0.0 released!
1
+ Subject: [ANN] Ruboto 1.0.1 released!
2
2
 
3
- The Ruboto team is pleased to announce the release of Ruboto 1.0.0.
3
+ The Ruboto team is pleased to announce the release of Ruboto 1.0.1.
4
4
 
5
5
  Ruboto (JRuby on Android) is a platform for developing full stand-alone
6
6
  apps for Android using the Ruby language and libraries. It includes
@@ -8,64 +8,63 @@ support libraries and generators for creating projects, classes, tests,
8
8
  and more. The complete APIs of Android, Java, and Ruby are available to
9
9
  you using the Ruby language.
10
10
 
11
- New in version 1.0.0:
12
-
13
- The main motivation for the 1.0 release is to announce that Ruboto is
14
- ready for general consumption!
15
-
16
- * All important parts of the Android API are available.
17
- * The API has stabilised.
18
- * Performance is reasonable. (Best case startup 4 seconds or less).
19
- * Home page/Wiki/Tutorials and other docs are of high enough quality that
20
- new developers have a low threshold to get going, and more advanced
21
- developers can find how to do more advanced apps.
22
-
23
- Notable features this release is RubyGems support for the "dalvik"
24
- platform and support for using Android utility projects. This means you
25
- can release gems for dalvik only and consume in-house or third-party
26
- utility projects.
11
+ New in version 1.0.1:
12
+
13
+ This release focuses on bug fixes and documentation.
27
14
 
28
15
  Features:
29
16
 
30
- * Issue #75 Faster startup
31
- * Issue #392 Establish a specialized RubyGems platform for JRuby on
32
- Android
33
- * Issue #524 Use "ruboto emulator" to setup HAXM
34
- * Issue #530 Shift all layout parameters into :layout = {} and remove the
35
- need for "=" in setting instance variables
36
- * Issue #544 Add support for using utility projects
17
+ * Issue #546 Better stack traces using "jruby.rewrite.java.trace" = "true"
18
+ * Issue #548 Allow using snapshot versions of jruby-jars
37
19
 
38
20
  Bugfixes:
39
21
 
40
- * Issue #431 Error running Ruboto test suites
41
- * Issue #483 The Tutorial: adding a startup splash builds but crashes
42
- starting in the emulator
43
- * Issue #534 ruboto emulator -t does not show emulator window though it
44
- says Emulator started OK
45
- * Issue #542 please install the jdbcsqlite3 adapter
22
+ * Issue #505 Trigger rebuild of the package if non-ruby source has changed
23
+ in the "src" directory
24
+ * Issue #507 Undefined method `__ruby_object' when implementing a Java
25
+ interface
26
+ * Issue #537 Generated BroadcastReceiver has incorrect number of argument
27
+ for Log.e
28
+ * Issue #541 Gem errors with activerecord-jdbc-sqlite3
29
+ * Issue #545 JRuby use of javax.annotation.processing breaks use of ARJDBC
30
+ * Issue #554 Better error message when trying to run an emulator for a
31
+ target that is not installed
32
+ * Issue #556 "ruboto emulator" ignores HAXM installation on Windows
33
+
34
+ Documentation:
35
+
36
+ * Issue #532 Environment setup for windows
37
+ * Issue #538 Complete the "What is Ruboto?" WIKI article
38
+ * Issue #553 The number of stars for the Ruboto project has disappeared
39
+ from the ruboto.org front page
40
+ * Issue #560 Add a tutorial for detecting incoming phone calls
46
41
 
47
42
  Support:
48
43
 
49
- * Issue #520 ruboto setup - "Android SDK command adb : Not found"
50
- * Issue #539 "rake install start" returns "rake aborted! No such file or
51
- directory - adb"
44
+ * Issue #480 Could not locate Gemfile
45
+ * Issue #549 How can I view output?
46
+ * Issue #551 rake install start problem on windows
47
+ * Issue #552 Problem with rake install start on windows
48
+ * Issue #555 Ruboto command not found after installation
52
49
 
53
- Documentation:
50
+ Community:
54
51
 
55
- * Issue #506 Add barcode scanning example
56
- * Issue #528 Fix formatting errors in the RELEASE_DOC
57
- * Issue #535 Mac kernel freezes when ruboto emulator start under MacOS
58
- 10.9 with Virtualbox 4.3.x installed.
52
+ * Issue #531 How can I help?
59
53
 
60
54
  Pull requests:
61
55
 
62
- * Issue #527 Add weight to widget.rb
63
- * Issue #536 Update emulator.rb (Fix no emulator window shows in MacOS
64
- 10.9 with Virtualbox 4.3, when $DISPLAY variable is empty)
56
+ * Issue #550 Fix Log import
57
+
58
+ Internal:
59
+
60
+ * Issue #513 Refactor to generate special
61
+ onCreate/onDestroy/onBind/onStartCommand instead of hard coding
62
+ * Issue #559 Remove redundant script file reference in
63
+ InheritingBroadcastReceiver
65
64
 
66
65
  You can find a complete list of issues here:
67
66
 
68
- * https://github.com/ruboto/ruboto/issues?state=closed&milestone=17
67
+ * https://github.com/ruboto/ruboto/issues?state=closed&milestone=31
69
68
 
70
69
 
71
70
  Installation:
data/Rakefile CHANGED
@@ -137,8 +137,8 @@ def get_github_issues
137
137
  req.basic_auth(user, pass)
138
138
  res = https.start { |http| http.request(req) }
139
139
  milestones = YAML.load(res.body).sort_by { |i| Date.parse(i['due_on']) }
140
- milestone_entry = milestones.find { |m| m['title'] == Ruboto::VERSION }
141
- raise "Milestone for version #{} not found." unless milestone_entry
140
+ milestone_entry = milestones.find { |m| m['title'] == Ruboto::VERSION.chomp('.dev') }
141
+ raise "Milestone for version #{Ruboto::VERSION} not found." unless milestone_entry
142
142
  milestone = milestone_entry['number']
143
143
 
144
144
  uri = URI("#{base_uri}/issues?milestone=#{milestone}&state=closed&per_page=1000")
@@ -150,9 +150,11 @@ def get_github_issues
150
150
  milestone_description = issues[0] ? issues[0]['milestone']['description'] : "No issues for milestone #{milestone}"
151
151
  milestone_description = milestone_description.split("\r\n").map(&:wrap).join("\r\n")
152
152
  categories = {
153
- 'Features' => 'feature', 'Bugfixes' => 'bug', 'Support' => 'support',
154
- 'Documentation' => 'documentation', 'Pull requests' => nil,
155
- 'Internal' => 'internal', 'Rejected' => 'rejected', 'Other' => nil
153
+ 'Features' => 'feature', 'Bugfixes' => 'bug',
154
+ 'Documentation' => 'documentation', 'Support' => 'support',
155
+ 'Community' => 'community',
156
+ 'Pull requests' => nil, 'Internal' => 'internal',
157
+ 'Rejected' => 'rejected', 'Other' => nil
156
158
  }
157
159
  grouped_issues = issues.group_by do |i|
158
160
  labels = i['labels'].map { |l| l['name'] }
@@ -229,7 +231,7 @@ New in version #{milestone_name}:
229
231
  #{milestone_description}
230
232
 
231
233
  #{(categories.keys & grouped_issues.keys).map do |cat|
232
- "#{cat}:\n
234
+ "#{cat}:\n
233
235
  #{grouped_issues[cat].map { |i| %Q{* Issue ##{i['number']} #{i['title']}}.wrap(2) }.join("\n")}
234
236
  "
235
237
  end.join("\n")}
@@ -278,15 +280,16 @@ EOF
278
280
  puts release_doc
279
281
  puts
280
282
  puts '=' * 80
283
+ File.write(RELEASE_DOC, release_doc)
281
284
 
282
285
  unless Gem::Version.new(Ruboto::VERSION).prerelease?
283
286
  header = <<EOF
284
287
  ---
285
288
  title : Ruboto #{Ruboto::VERSION}
286
289
  layout: post
290
+ category: news
287
291
  ---
288
292
  EOF
289
- File.write(RELEASE_DOC, release_doc)
290
293
  Dir.chdir BLOG_DIR do
291
294
  output = `git status --porcelain`
292
295
  old_blog_posts = Dir[RELEASE_BLOG_GLOB] - [RELEASE_BLOG]
@@ -453,11 +456,30 @@ namespace :platform do
453
456
  file PLATFORM_CURRENT_RELEASE_APK do
454
457
  FileUtils.mkdir_p File.dirname(PLATFORM_CURRENT_RELEASE_APK)
455
458
  puts 'Downloading the current RubotoCore platform release apk'
456
- uri = URI('http://ruboto.org/downloads/RubotoCore-release.apk')
459
+ uri = URI('https://raw.github.com/ruboto/ruboto.github.com/master/downloads/RubotoCore-release.apk')
457
460
  begin
458
- http = Net::HTTP.new(uri.host, uri.port)
459
- content = http.request(Net::HTTP::Get.new(uri.request_uri)).body
460
- File.open(PLATFORM_CURRENT_RELEASE_APK, 'wb') { |f| f << content }
461
+ Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https',
462
+ :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
463
+ headers = {'User-Agent' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; de-at) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10'}
464
+ loop do
465
+ response = http.get(uri.request_uri, headers)
466
+ if response.code == '200'
467
+ File.open(PLATFORM_CURRENT_RELEASE_APK, 'wb') { |f| f << response.body }
468
+ break
469
+ elsif response.code == '302'
470
+ headers.update('Referer' => uri.to_s)
471
+ if (cookie = response.response['set-cookie'])
472
+ headers.update('Cookie' => cookie)
473
+ end
474
+ uri = URI(response['location'].gsub(/^\//, 'http://ruboto.org/'))
475
+ puts "Following redirect to #{uri}."
476
+ else
477
+ puts "Got an unexpected response (#{response.code}). Retrying download."
478
+ puts response.inspect
479
+ sleep 1
480
+ end
481
+ end
482
+ end
461
483
  rescue Exception, SystemExit
462
484
  puts "Download failed: #{$!}"
463
485
  FileUtils.rm(PLATFORM_CURRENT_RELEASE_APK) if File.exists?(PLATFORM_CURRENT_RELEASE_APK)
@@ -91,8 +91,9 @@ JARS = Dir[File.expand_path 'libs/*.jar'] - JRUBY_JARS
91
91
  RESOURCE_FILES = Dir[File.expand_path 'res/**/*']
92
92
  JAVA_SOURCE_FILES = Dir[File.expand_path 'src/**/*.java']
93
93
  RUBY_SOURCE_FILES = Dir[File.expand_path 'src/**/*.rb']
94
+ OTHER_SOURCE_FILES = Dir[File.expand_path 'src/**/*'] - JAVA_SOURCE_FILES - RUBY_SOURCE_FILES
94
95
  CLASSES_CACHE = "#{PROJECT_DIR}/bin/#{build_project_name}-debug-unaligned.apk.d"
95
- APK_DEPENDENCIES = [:patch_dex, MANIFEST_FILE, RUBOTO_CONFIG_FILE, BUNDLE_JAR, CLASSES_CACHE] + JRUBY_JARS + JARS + JAVA_SOURCE_FILES + RESOURCE_FILES + RUBY_SOURCE_FILES
96
+ APK_DEPENDENCIES = [:patch_dex, MANIFEST_FILE, RUBOTO_CONFIG_FILE, BUNDLE_JAR, CLASSES_CACHE] + JRUBY_JARS + JARS + JAVA_SOURCE_FILES + RESOURCE_FILES + RUBY_SOURCE_FILES + OTHER_SOURCE_FILES
96
97
  KEYSTORE_FILE = (key_store = File.readlines('ant.properties').grep(/^key.store=/).first) ? File.expand_path(key_store.chomp.sub(/^key.store=/, '').sub('${user.home}', '~')) : "#{build_project_name}.keystore"
97
98
  KEYSTORE_ALIAS = (key_alias = File.readlines('ant.properties').grep(/^key.alias=/).first) ? key_alias.chomp.sub(/^key.alias=/, '') : build_project_name
98
99
  APK_FILE_REGEXP = /^-rw-r--r--\s+(?:system|\d+\s+\d+)\s+(?:system|\d+)\s+(\d+)\s+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}|\w{3} \d{2}\s+(?:\d{4}|\d{2}:\d{2}))\s+(.*)$/
@@ -363,7 +364,8 @@ file BUNDLE_JAR => [GEM_FILE, GEM_LOCK_FILE] do
363
364
  next unless File.exists? GEM_FILE
364
365
  puts "Generating #{BUNDLE_JAR}"
365
366
  require 'bundler'
366
- if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new('1.3.5')
367
+ # Issue #547 https://github.com/ruboto/ruboto/issues/547
368
+ if true || Gem::Version.new(Bundler::VERSION) <= Gem::Version.new('1.5.0')
367
369
  require 'bundler/vendored_thor'
368
370
 
369
371
  # Store original RubyGems/Bundler environment
@@ -6,6 +6,6 @@ class SampleBroadcastReceiver
6
6
  Log.v 'SampleBroadcastReceiver', 'Broadcast received!'
7
7
  Log.v 'SampleBroadcastReceiver', intent.getExtras.to_s
8
8
  rescue Exception
9
- Log.e "Exception processing broadcast: #{$!.message}\n#{$!.backtrace.join("\n")}"
9
+ Log.e 'SampleBroadcastReceiver', "Exception processing broadcast: #{$!.message}\n#{$!.backtrace.join("\n")}"
10
10
  end
11
11
  end
@@ -3,7 +3,4 @@ package THE_PACKAGE;
3
3
  import org.ruboto.JRubyAdapter;
4
4
 
5
5
  public class InheritingBroadcastReceiver extends org.ruboto.RubotoBroadcastReceiver {
6
- public InheritingBroadcastReceiver() {
7
- super("sample_broadcast_receiver.rb");
8
- }
9
6
  }
@@ -9,18 +9,13 @@ 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
- private final ScriptInfo scriptInfo = new ScriptInfo();
12
+ THE_CONSTRUCTORS
13
+
14
+ THE_METHODS
15
+
13
16
  {
14
17
  scriptInfo.setRubyClassName(getClass().getSimpleName());
15
18
  ScriptLoader.loadScript(this);
16
19
  }
17
20
 
18
- THE_CONSTRUCTORS
19
-
20
- public ScriptInfo getScriptInfo() {
21
- return scriptInfo;
22
- }
23
-
24
- THE_METHODS
25
-
26
21
  }
@@ -1,9 +1,4 @@
1
1
  package THE_PACKAGE;
2
2
 
3
3
  public class InheritingService extends org.ruboto.RubotoService {
4
- public void onCreate() {
5
- getScriptInfo().setRubyClassName(getClass().getSimpleName());
6
- super.onCreate();
7
- }
8
-
9
4
  }
@@ -9,35 +9,24 @@ import android.os.Bundle;
9
9
 
10
10
  public class THE_RUBOTO_CLASS THE_ACTION THE_ANDROID_CLASS {
11
11
  public static final String THEME_KEY = "RUBOTO_THEME";
12
- private final ScriptInfo scriptInfo = new ScriptInfo();
13
- Bundle[] args;
14
12
 
15
- public ScriptInfo getScriptInfo() {
16
- return scriptInfo;
17
- }
18
-
19
- /****************************************************************************************
20
- *
21
- * Activity Lifecycle: onCreate
13
+ /**
14
+ * Called at the start of onCreate() to prepare the Activity.
15
+ * @return true if onCreate() should just call super and terminate.
22
16
  */
23
- @Override
24
- public void onCreate(Bundle bundle) {
25
- System.out.println("THE_RUBOTO_CLASS onCreate(): " + getClass().getName() + ", finishing: " + isFinishing());
17
+ private boolean preOnCreate(Bundle bundle) {
18
+ System.out.println("RubotoActivity onCreate(): " + getClass().getName() + ", finishing: " + isFinishing());
19
+
20
+ if (isFinishing()) return true;
26
21
 
27
22
  // Shut this RubotoActivity down if it's not able to restart
28
- if (this.getClass().getName().equals("org.ruboto.THE_RUBOTO_CLASS") && !JRubyAdapter.isInitialized()) {
23
+ if (this.getClass().getName().equals("org.ruboto.RubotoActivity") && !JRubyAdapter.isInitialized()) {
29
24
  super.onCreate(bundle);
30
- System.out.println("Shutting down stale THE_RUBOTO_CLASS: " + getClass().getName());
25
+ System.out.println("Shutting down stale RubotoActivity: " + getClass().getName());
31
26
  finish();
32
- return;
27
+ return true;
33
28
  }
34
29
 
35
- if (isFinishing() || ScriptLoader.isCalledFromJRuby()) {
36
- super.onCreate(bundle);
37
- return;
38
- }
39
- args = new Bundle[]{bundle};
40
-
41
30
  // FIXME(uwe): Deprecated as of Ruboto 0.13.0. Remove in june 2014 (twelve months).
42
31
  Bundle configBundle = getIntent().getBundleExtra("Ruboto Config");
43
32
  if (configBundle != null) {
@@ -50,40 +39,11 @@ public class THE_RUBOTO_CLASS THE_ACTION THE_ANDROID_CLASS {
50
39
  if (getIntent().hasExtra(THEME_KEY)) {
51
40
  setTheme(getIntent().getIntExtra(THEME_KEY, 0));
52
41
  }
53
- scriptInfo.setFromIntent(getIntent());
54
42
 
55
- if (JRubyAdapter.isInitialized() && scriptInfo.isReadyToLoad()) {
56
- ScriptLoader.loadScript(this);
57
- ScriptLoader.callOnCreate(this, (Object[]) args);
58
- } else {
59
- super.onCreate(bundle);
60
- }
61
- }
62
-
63
- public void onDestroy() {
64
- if (ScriptLoader.isCalledFromJRuby()) {
65
- super.onDestroy();
66
- return;
67
- }
68
- if (!JRubyAdapter.isInitialized()) {
69
- Log.i("Method called before JRuby runtime was initialized: RubotoActivity#onDestroy");
70
- super.onDestroy();
71
- return;
72
- }
73
- String rubyClassName = scriptInfo.getRubyClassName();
74
- if (rubyClassName == null) {
75
- super.onDestroy();
76
- return;
77
- }
78
- ScriptLoader.callOnDestroy(this);
43
+ scriptInfo.setFromIntent(getIntent());
44
+ return false;
79
45
  }
80
46
 
81
-
82
- /****************************************************************************************
83
- *
84
- * Generated Methods
85
- */
86
-
87
47
  THE_METHODS
88
48
 
89
49
  }
@@ -12,17 +12,10 @@ public class THE_RUBOTO_CLASS THE_ACTION THE_ANDROID_CLASS {
12
12
  }
13
13
 
14
14
  public THE_RUBOTO_CLASS() {
15
- this(null);
16
- }
17
-
18
- public THE_RUBOTO_CLASS(String name) {
19
15
  super();
20
-
21
- if (name != null) {
22
- scriptInfo.setScriptName(name);
23
- if (JRubyAdapter.isInitialized()) {
24
- ScriptLoader.loadScript(this);
25
- }
16
+ scriptInfo.setRubyClassName(getClass().getSimpleName());
17
+ if (JRubyAdapter.isInitialized()) {
18
+ ScriptLoader.loadScript(this);
26
19
  }
27
20
  }
28
21
 
@@ -5,110 +5,13 @@ 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
- private final ScriptInfo scriptInfo = new ScriptInfo();
9
-
10
- public ScriptInfo getScriptInfo() {
11
- return scriptInfo;
12
- }
13
-
14
- /****************************************************************************************
15
- *
16
- * Service Lifecycle: onCreate
8
+ /**
9
+ * Called at the start of onCreate() to prepare the Activity.
17
10
  */
18
- @Override
19
- public void onCreate() {
20
- System.out.println("RubotoService onCreate(): " + getClass().getName());
21
-
22
- if (ScriptLoader.isCalledFromJRuby()) {
23
- super.onCreate();
24
- return;
25
- }
26
-
27
- if (JRubyAdapter.isInitialized() && scriptInfo.isReadyToLoad()) {
28
- ScriptLoader.loadScript(this);
29
- } else {
30
- super.onCreate();
31
- }
32
- }
33
-
34
- // FIXME(uwe): Revert to generate these methods.
35
- @Override
36
- public int onStartCommand(android.content.Intent intent, int flags, int startId) {
37
- if (ScriptLoader.isCalledFromJRuby()) return super.onStartCommand(intent, flags, startId);
38
-
39
- if (!JRubyAdapter.isInitialized()) {
40
- Log.i("Method called before JRuby runtime was initialized: RubotoService#onStartCommand");
41
- return super.onStartCommand(intent, flags, startId);
42
- }
43
-
44
- if (JRubyAdapter.isInitialized() && !scriptInfo.isLoaded()) {
45
- scriptInfo.setFromIntent(intent);
46
- ScriptLoader.loadScript(this);
47
- }
48
-
49
- String rubyClassName = scriptInfo.getRubyClassName();
50
- if (rubyClassName == null) return super.onStartCommand(intent, flags, startId);
51
- if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_start_command}")) {
52
- return (Integer) JRubyAdapter.runRubyMethod(Integer.class, scriptInfo.getRubyInstance(), "on_start_command", new Object[]{intent, flags, startId});
53
- } else {
54
- if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onStartCommand}")) {
55
- return (Integer) JRubyAdapter.runRubyMethod(Integer.class, scriptInfo.getRubyInstance(), "onStartCommand", new Object[]{intent, flags, startId});
56
- } else {
57
- return super.onStartCommand(intent, flags, startId);
58
- }
11
+ private void preOnCreate() {
12
+ System.out.println("RubotoService onCreate(): " + getClass().getName());
13
+ getScriptInfo().setRubyClassName(getClass().getSimpleName());
59
14
  }
60
- }
61
-
62
- // FIXME(uwe): Revert to generate these methods.
63
- @Override
64
- public android.os.IBinder onBind(android.content.Intent intent) {
65
- if (ScriptLoader.isCalledFromJRuby()) return null;
66
- if (!JRubyAdapter.isInitialized()) {
67
- Log.i("Method called before JRuby runtime was initialized: RubotoService#onBind");
68
- return null;
69
- }
70
-
71
- if (JRubyAdapter.isInitialized() && !scriptInfo.isLoaded()) {
72
- scriptInfo.setFromIntent(intent);
73
- ScriptLoader.loadScript(this);
74
- }
75
-
76
- String rubyClassName = scriptInfo.getRubyClassName();
77
- if (rubyClassName == null) return null;
78
- if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_bind}")) {
79
- return (android.os.IBinder) JRubyAdapter.runRubyMethod(android.os.IBinder.class, scriptInfo.getRubyInstance(), "on_bind", intent);
80
- } else {
81
- if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onBind}")) {
82
- return (android.os.IBinder) JRubyAdapter.runRubyMethod(android.os.IBinder.class, scriptInfo.getRubyInstance(), "onBind", intent);
83
- } else {
84
- return null;
85
- }
86
- }
87
- }
88
-
89
- public void onDestroy() {
90
- if (ScriptLoader.isCalledFromJRuby()) {
91
- super.onDestroy();
92
- return;
93
- }
94
- if (!JRubyAdapter.isInitialized()) {
95
- Log.i("Method called before JRuby runtime was initialized: RubotoActivity#onDestroy");
96
- super.onDestroy();
97
- return;
98
- }
99
- String rubyClassName = scriptInfo.getRubyClassName();
100
- if (rubyClassName == null) {
101
- super.onDestroy();
102
- return;
103
- }
104
- ScriptLoader.callOnDestroy(this);
105
- }
106
-
107
-
108
- /****************************************************************************************
109
- *
110
- * Generated Methods
111
- */
112
15
 
113
16
  THE_METHODS
114
17