ruboto-core 0.0.1 → 0.0.2
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.
data/README.md
CHANGED
@@ -181,12 +181,12 @@ Mirah, formerly known as Duby, is a language with Ruby-like syntax that compiles
|
|
181
181
|
Garrett is a "playground for Mirah exploration on Android."
|
182
182
|
|
183
183
|
|
184
|
-
|
184
|
+
Domo Arigato
|
185
185
|
-----
|
186
186
|
|
187
187
|
Thanks go to:
|
188
188
|
|
189
|
-
* Charles Nutter, a member of the JRuby core team, for
|
189
|
+
* Charles Nutter, a member of the JRuby core team, for mentoring this RSoC project and starting the Ruboto project in the first place with an [irb](http://github.com/ruboto/ruboto-irb)
|
190
190
|
* All of Ruby Summer of Code's [sponsors](http://rubysoc.org/sponsors)
|
191
191
|
* [Engine Yard](http://engineyard.com/) in particular for sponsoring RSoC and heavily sponsoring JRuby, which is obviously critical to the project.
|
192
192
|
* All [contributors](http://github.com/ruboto/ruboto-core/contributors) and [contributors to the ruboto-irb project](http://github.com/ruboto/ruboto-irb/contributors), as much of this code was taken from ruboto-irb.
|
@@ -17,7 +17,7 @@ require 'java'
|
|
17
17
|
|
18
18
|
|
19
19
|
|
20
|
-
%w(Activity BroadcastReceiver Service).map do |klass|
|
20
|
+
%w(Activity Dialog BroadcastReceiver Service View).map do |klass|
|
21
21
|
java_import "org.ruboto.Ruboto#{klass}"
|
22
22
|
end
|
23
23
|
|
@@ -25,8 +25,6 @@ RUBOTO_CLASSES = [RubotoActivity, RubotoBroadcastReceiver, RubotoService]
|
|
25
25
|
$init_methods = Hash.new 'create'
|
26
26
|
$init_methods[RubotoBroadcastReceiver] = 'receive'
|
27
27
|
|
28
|
-
java_import "org.ruboto.RubotoView"
|
29
|
-
|
30
28
|
java_import "android.app.Activity"
|
31
29
|
java_import "android.content.Intent"
|
32
30
|
java_import "android.os.Bundle"
|
@@ -63,10 +61,10 @@ class Activity
|
|
63
61
|
attr_accessor :init_block
|
64
62
|
|
65
63
|
def start_ruboto_dialog(remote_variable, &block)
|
66
|
-
start_ruboto_activity(remote_variable,
|
64
|
+
start_ruboto_activity(remote_variable, RubotoDialog, &block)
|
67
65
|
end
|
68
66
|
|
69
|
-
def start_ruboto_activity(remote_variable,
|
67
|
+
def start_ruboto_activity(remote_variable, klass=RubotoActivity, &block)
|
70
68
|
@@init_block = block
|
71
69
|
|
72
70
|
if @initialized or not self.is_a?(RubotoActivity)
|
@@ -76,8 +74,7 @@ class Activity
|
|
76
74
|
b.putString("Initialize Script", "#{remote_variable}.initialize_activity")
|
77
75
|
|
78
76
|
i = Intent.new
|
79
|
-
i.
|
80
|
-
"THE_PACKAGE.ACTIVITY_NAME"
|
77
|
+
i.setClass self, klass.java_class
|
81
78
|
i.putExtra("RubotoActivity Config", b)
|
82
79
|
|
83
80
|
self.startActivity i
|
@@ -19,7 +19,7 @@ import org.jruby.runtime.builtin.IRubyObject;
|
|
19
19
|
import org.jruby.javasupport.JavaUtil;
|
20
20
|
import org.jruby.exceptions.RaiseException;
|
21
21
|
|
22
|
-
public
|
22
|
+
public class RubotoActivity extends Activity
|
23
23
|
implements
|
24
24
|
android.content.DialogInterface.OnCancelListener,
|
25
25
|
android.widget.TabHost.TabContentFactory,
|
data/bin/ruboto
CHANGED
@@ -6,6 +6,7 @@ begin
|
|
6
6
|
rescue LoadError
|
7
7
|
end
|
8
8
|
|
9
|
+
require 'rubygems'
|
9
10
|
require 'main'
|
10
11
|
require 'fileutils'
|
11
12
|
require 'rexml/document'
|
@@ -109,26 +110,65 @@ Main {
|
|
109
110
|
package = params['package'].value
|
110
111
|
activity = params['activity'].value
|
111
112
|
|
112
|
-
|
113
|
+
abort "path must be to a directory that does not yet exist. it will be created" if
|
114
|
+
File.exists?(path)
|
115
|
+
|
116
|
+
abort "Currently you must set target to 'android-8' (Froyo) for ruboto to work" unless
|
117
|
+
target == 'android-8'
|
118
|
+
|
113
119
|
root = File.expand_path(path)
|
120
|
+
print "\nGenerating Android app #{name} in #{root}..."
|
121
|
+
`android create project -n #{name} -t #{target} -p #{path} -k #{package} -a #{activity}`
|
122
|
+
puts "Done"
|
114
123
|
|
124
|
+
puts "\nCopying files:"
|
115
125
|
copier = AssetCopier.new $assets, root
|
116
|
-
|
126
|
+
|
127
|
+
%w{Rakefile .gitignore assets}.each do |f|
|
128
|
+
print "#{f}..."
|
129
|
+
copier.copy f
|
130
|
+
puts "Done"
|
131
|
+
end
|
132
|
+
|
133
|
+
print "JRuby jars..."
|
117
134
|
copier.copy_from_absolute_path JRubyJars::core_jar_path, "libs"
|
118
135
|
copier.copy_from_absolute_path JRubyJars::stdlib_jar_path, "libs"
|
119
|
-
|
120
|
-
|
136
|
+
puts "Done"
|
137
|
+
|
138
|
+
print "Ruboto java classes..."
|
121
139
|
copier.copy "src/org/ruboto/*.java", "src/org/ruboto"
|
140
|
+
puts "Done"
|
141
|
+
|
142
|
+
print "\nAdding RubotoActivity and RubotoDialog to the manifest..."
|
143
|
+
file = File.join(root, "AndroidManifest.xml")
|
144
|
+
text = File.read(file)
|
145
|
+
File.open(file, 'w') do |f|
|
146
|
+
f << text.gsub("</application>",
|
147
|
+
%Q{
|
148
|
+
<activity android:name="org.ruboto.RubotoActivity">
|
149
|
+
</activity>
|
150
|
+
<activity android:name="org.ruboto.RubotoDialog" android:theme="@android:style/Theme.Dialog">
|
151
|
+
</activity>
|
152
|
+
</application>
|
153
|
+
})
|
154
|
+
end
|
155
|
+
puts "Done"
|
122
156
|
|
123
|
-
|
157
|
+
print "Setting the package name in ruboto.rb..."
|
158
|
+
java_files = [File.join(root, "assets/scripts/ruboto.rb")]
|
124
159
|
java_files.each do |file|
|
125
160
|
text = File.read(file)
|
126
161
|
File.open(file, 'w') do |f|
|
127
162
|
f << text.gsub("THE_PACKAGE", package).gsub("ACTIVITY_NAME", activity)
|
128
163
|
end
|
129
164
|
end
|
165
|
+
puts "Done"
|
130
166
|
|
167
|
+
print "Generating the default Activity and script..."
|
131
168
|
generate_inheriting_file "Activity", activity, package, "#{underscore(activity)}.rb", path
|
169
|
+
puts "Done"
|
170
|
+
|
171
|
+
puts "\nHello, #{name}\n"
|
132
172
|
end
|
133
173
|
end
|
134
174
|
|
@@ -151,6 +191,9 @@ Main {
|
|
151
191
|
|
152
192
|
|
153
193
|
def run
|
194
|
+
abort "cannot find your AndroidManifest.xml to extract info from it. Make sure you're in the root directory of your app" unless
|
195
|
+
File.exists? 'AndroidManifest.xml'
|
196
|
+
|
154
197
|
package = REXML::Document.new(File.read('AndroidManifest.xml')).root.attribute('package').value
|
155
198
|
name = params['name'].value
|
156
199
|
script_name = params['script_name'].value || "#{underscore(name)}.rb"
|
@@ -21,7 +21,7 @@ import org.jruby.runtime.builtin.IRubyObject;
|
|
21
21
|
import org.jruby.javasupport.JavaUtil;
|
22
22
|
import org.jruby.exceptions.RaiseException;
|
23
23
|
|
24
|
-
public abstract class Ruboto<%= @class %> extends <%= @class %>
|
24
|
+
public<%= @class == "Activity" ? "" : " abstract" %> class Ruboto<%= @class %> extends <%= @class %>
|
25
25
|
%##############################################################################################
|
26
26
|
%#
|
27
27
|
%# Implement all interfaces
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboto-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Jackoway
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-07-29 00:00:00 -
|
20
|
+
date: 2010-07-29 00:00:00 -07:00
|
21
21
|
default_executable: ruboto
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- assets/src/InheritingService.java
|
75
75
|
- assets/src/org/ruboto/RubotoActivity.java
|
76
76
|
- assets/src/org/ruboto/RubotoBroadcastReceiver.java
|
77
|
+
- assets/src/org/ruboto/RubotoDialog.java
|
77
78
|
- assets/src/org/ruboto/RubotoService.java
|
78
79
|
- assets/src/org/ruboto/RubotoView.java
|
79
80
|
- assets/src/org/ruboto/Script.java
|