Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rscottm committed Sep 11, 2010
0 parents commit cd13fdd
Show file tree
Hide file tree
Showing 38 changed files with 4,760 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/jruby-stdlib.jar"/>
<classpathentry kind="lib" path="libs/jruby.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
bin
gen
tmp
nbproject/private
local.properties
generated_libs
.rvmrc
.DS_Store
33 changes: 33 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>IRB</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
69 changes: 69 additions & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.ruboto.irb"
android:versionCode="4"
android:versionName="0.4dev"
android:installLocation="preferExternal">

<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:name="IRB"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:host="*" />
<data android:pathPattern=".*\\.rb" />
</intent-filter>
</activity>
<activity android:name="ShortcutBuilder">
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="org.ruboto.RubotoActivity">
</activity>
<activity android:name="org.ruboto.RubotoDialog" android:theme="@android:style/Theme.Dialog">
</activity>
<activity android:name="ScriptLaunch">
<intent-filter>
<action android:name="org.ruboto.intent.action.LAUNCH_SCRIPT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

</application>

<!-- uses-sdk android:minSdkVersion="3" android:targetSdkVersion="8"/-->
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>

<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.PERSISTENT_ACTIVITY"/>
<uses-permission android:name="android.permission.RESTART_PACKAGES"/>
<uses-permission android:name="android.permission.GET_TASKS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>

</manifest>
38 changes: 38 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#Ruboto-IRB

[http://ruboto.org](http://ruboto.org)

To get this working on Android, you'll need to do two things:

Copy local.properties.EXAMPLE to local.properties and adjust the SDK location.

This is particularly true if you are doing development with the command line and vi, and not wussing out by using some girlyman IDE. Just sayin'.

For example,

$ cp local.properties.EXAMPLE local.properties
$ vi local.properties

Modify the "dx" tool for the target platform to support 1024M of memory. Edit SDK_PATH/platforms/android-1.x/tools/dx, uncomment javaopts and set it to javaOpts="-Xmx1024M" (you may need a higher value than 1024 on some systems). This is only needed for API SDK Version 4, more recent SDKs default to 1GB.

$ ant debug # build package
$ ant install # build and install package
$ adb -[e|d] install -r bin/IRB-debug.apk # manual install (emulator, device)

There are also some prebuilt packages available: [github.com/ruboto/ruboto-irb/downloads](http://github.com/ruboto/ruboto-irb/downloads).

NOTE: To install it to an emulator image, you need to have the emulator running.

You can also check out the [JRuby on Android](http://groups.google.com/group/ruboto) Google group for more information.

That's it! Have fun!

##Screenshot

![Ruboto-IRB screenshot](http://cloud.github.com/downloads/ruboto/ruboto-irb/ruboto-screenshot-landscape.png)

##Credits

Ruby Icon obtained from [Ruby Visual Identity Team](http://rubyidentity.org/), CC ShareAlike 2.5.
Editor/script support from Pascal Chatterjee's [jruby-for-android](http://code.google.com/p/jruby-for-android/) project, adapted by [Scott Moyer](http://github.com/rscottm/).

94 changes: 94 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# callback_reflection.rb creates the interfaces.txt (JRuby can't do YAML with ruby 1.8, so it's just
# and inspect on the hash) on a device. Bring it off the device and put it in the callback_gen dir.
#
# Move this into a rake task later.
#


raise "Needs JRuby 1.5" unless RUBY_PLATFORM =~ /java/
require 'ant'
require 'rake/clean'
require 'rexml/document'

generated_libs = 'generated_libs'
jars = Dir['libs/*.jar']
stdlib = jars.grep(/stdlib/).first #libs/jruby-stdlib-VERSION.jar
jruby_jar = jars.grep(/core/).first #libs/jruby-core-VERSION.jar
stdlib_precompiled = File.join(generated_libs, 'jruby-stdlib-precompiled.jar')
jruby_ruboto_jar = File.join(generated_libs, 'jruby-ruboto.jar')
ant.property :name=>'external.libs.dir', :value => generated_libs
dirs = ['tmp/ruby', 'tmp/precompiled', generated_libs]
dirs.each { |d| directory d }

CLEAN.include('tmp', 'bin', generated_libs)

ant_import

file stdlib_precompiled => :compile_stdlib
file jruby_ruboto_jar => generated_libs do
ant.zip(:destfile=>jruby_ruboto_jar) do
zipfileset(:src=>jruby_jar) do
exclude(:name=>'jni/**')
end
end
end

desc "precompile ruby stdlib"
task :compile_stdlib => [:clean, *dirs] do
ant.unzip(:src=>stdlib, :dest=>'tmp/ruby')
Dir.chdir('tmp/ruby') { sh "jrubyc . -t ../precompiled" }
ant.zip(:destfile=>stdlib_precompiled, :basedir=>'tmp/precompiled')
end

task :generate_libs => [generated_libs, jruby_ruboto_jar] do
cp stdlib, generated_libs
end

task :debug => :generate_libs
task :release => :generate_libs

task :default => :debug

task :tag => :release do
unless `git branch` =~ /^\* master$/
puts "You must be on the master branch to release!"
exit!
end
sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git tag #{version}"
sh "git push origin master --tags"
#sh "gem push pkg/#{name}-#{version}.gem"
end

task :sign => :release do
sh "jarsigner -keystore #{ENV['RUBOTO_KEYSTORE']} -signedjar bin/#{build_project_name}.apk bin/#{build_project_name}-unsigned.apk #{ENV['RUBOTO_KEY_ALIAS']}"
end

task :align => :sign do
sh "zipalign 4 bin/#{build_project_name}.apk #{build_project_name}.apk"
end

task :publish => :align do
puts "#{build_project_name}.apk is ready for the market!"
end

task :update_scripts do
Dir['assets/scripts/*.rb'].each do |script|
`adb push #{script} /data/data/#{package}/files/scripts`
end
end

def manifest
@manifest ||= REXML::Document.new(File.read('AndroidManifest.xml'))
end

def strings(name)
@strings ||= REXML::Document.new(File.read('res/values/strings.xml'))
value = @strings.elements["//string[@name='#{name.to_s}']"] or raise "string '#{name}' not found in strings.xml"
value.text
end

def package() manifest.root.attribute('package') end
def version() strings :version_name end
def app_name() strings :app_name end
def build_project_name() @build_project_name ||= REXML::Document.new(File.read('build.xml')).elements['project'].attribute(:name).value end
7 changes: 7 additions & 0 deletions assets/demo-scripts/call.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#prepare number for dialing
import "android.content.Intent"
import "android.net.Uri"

intent = Intent.new(Intent::ACTION_VIEW)
intent.setData(Uri.parse("tel:123"))
$activity.startActivity(intent)
Loading

0 comments on commit cd13fdd

Please sign in to comment.