GithubHelp home page GithubHelp logo

ruboto-irb's Introduction

Ruboto 2

Ruboto 2 is a redesign based on an Android Studio workflow. This means that the JRuby and Ruboto components will integrate into the standard gradle tooling used by regular Android Studio projects.

Starting a new Ruboto project

  • Download and install Android studio.

  • Choose "Create New Project" in the startup screen.

    • Choose "Phone and Tablet" and "No Activity" for the project template.
    • Choose "Java" for your language and "Minimum SDK" should be "API 27: Android 8.1 (Oreo)" or higher.
  • Add a jcenter to the dependencyResolutionManagement/repositories section of your settings.gradle file:

    dependencyResolutionManagement {
        ...
        repositories {
            ...
            jcenter()
        }
    }
  • Add the these dependencies to your app/build.gradle file:

    dependencies {
      ...
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'com.linkedin.dexmaker:dexmaker:2.19.1'
      implementation 'me.qmx.jitescript:jitescript:0.4.1'
      implementation 'com.jakewharton.android.repackaged:dalvik-dx:7.1.0_r7'
    }
  • Add gems.rb file:

    source 'https://rubygems.org/'
    
    gem 'ruboto', '~>2.0.dev', git: 'https://github.com/ruboto/ruboto.git'
  • Ensure you are using JRuby on the command line

    Create a .ruby-version file:

      jruby
    
  • Initialize Ruboto:

    jruby -S bundle
    jruby -S bundle exec ruboto init

    This will copy the core files to your project.

  • Add app/gems.rb

    source 'https://rubygems.org/'
    
    gem 'activerecord', '~>7.0'
    gem 'activerecord-jdbc-adapter', '~>70.1'
    gem 'sqldroid', '~>1.0'
  • Add app/update_jruby_jar.sh:

    #!/usr/bin/env bash
    set -e
    
    VERSION="9.4.2.0"
    FULL_VERSION="${VERSION}"
    # FULL_VERSION="${VERSION}-SNAPSHOT" # Uncomment to use a local snapshot
    # FULL_VERSION="${VERSION}-20190822.050313-17" # Uncomment to use a remote snapshot
    JAR_FILE="jruby-complete-${FULL_VERSION}.jar"
    DOWNLOAD_DIR="$HOME/Downloads"
    DOWNLOADED_JAR="${DOWNLOAD_DIR}/${JAR_FILE}"
    SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
    
    cd $SCRIPT_DIR
    
    [ ! -d $HOME/Downloads ] && mkdir $HOME/Downloads  # Create the directory if we don't find it
    [ ! -d ./libs ] && mkdir ./libs                    # Create the directory if we don't find it
    
    cd libs
    rm -f bcpkix-jdk15on-*.jar bcprov-jdk15on-*.jar bctls-jdk15on-*.jar cparse-jruby.jar generator.jar jline-*.jar jopenssl.jar jruby-complete-*.jar parser.jar psych.jar readline.jar snakeyaml-*.jar
    
    if test -f "${DOWNLOADED_JAR}"; then
      echo "Found downloaded JAR"
    else
      echo No "${DOWNLOADED_JAR}" - Downloading.
      curl "https://oss.sonatype.org/service/local/repositories/releases/content/org/jruby/jruby-complete/${VERSION}/jruby-complete-${VERSION}.jar" -o "${DOWNLOADED_JAR}"
    fi
    cp ${DOWNLOADED_JAR} .
    
    unzip -o -j ${JAR_FILE} '*.jar'
    
    # FIXME(uwe): Why do we delete these files?
    zip generator.jar -d json/ext/ByteListTranscoder.class
    zip generator.jar -d json/ext/OptionsReader.class
    zip generator.jar -d json/ext/Utils.class
    zip generator.jar -d json/ext/RuntimeInfo.class
    
    cd - >/dev/null
    
    cd src/main/java
    find * -type f | grep "org/jruby/" | sed -e 's/\.java//g' | sort > ../../../overridden_classes.txt
    cd - >/dev/null
    
    while read p; do
      unzip -Z1 libs/${JAR_FILE} | grep "$p\\.class" > classes.txt
      unzip -Z1 libs/${JAR_FILE} | egrep "$p(\\\$[^$]+)*\\.class" >> classes.txt
      if [[ -s classes.txt ]] ; then
        zip -d -@ libs/${JAR_FILE} <classes.txt
        if [[ ! "$?" == "0" ]] ; then
          zip -d libs/${JAR_FILE} "$p\\.class"
        fi
      fi
      rm classes.txt
    done < overridden_classes.txt
    
    rm overridden_classes.txt
    
    cd libs
    rm -f digest.jar
    cd - >/dev/null
  • Make app/update_jruby_jar.sh executable:

      chmod u+x app/update_jruby_jar.sh
  • Generate jruby.jar:

      app/update_jruby_jar.sh
  • Generate the startup activity:

      bundle exec ruboto gen class Activity --name StartupActivity
  • Add the startup activity intent filter to the new activity tag in app/src/main/AndroidManifest.xml:

    <activity android:name='StartupActivity' android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <action android:name="android.intent.action.VIEW" />
        </intent-filter>
    </activity>
  • Declare the Ruboto components and SplashActivity in app/src/main/AndroidManifest.xml

    <activity android:name='org.ruboto.RubotoActivity' />
    <activity android:name='org.ruboto.RubotoDialog' android:theme='@android:style/Theme.Dialog' />
    <service
        android:name='org.ruboto.RubotoService'
        android:exported='false' />
    <activity
        android:name='org.ruboto.SplashActivity'
        android:configChanges='orientation|screenSize'
        android:exported='false'
        android:noHistory='true' />

    Rember to sync the gradle config after the changes.

  • Start your app!

Updating app gems

Update your app/gems.rb (or app/Gemfile) and run

bundle exec rake bundle

Adding Ruboto to an existing Android Studio project

HOWTO missing. Pull requests welcome!

Ruboto 1.x

Looking for Ruboto 1.x? Switch to the ruboto_1.x branch.

ruboto-irb's People

Contributors

akshay2047 avatar argilo avatar benjaminoakes avatar dlachausse avatar donv avatar gadtfly avatar headius avatar jackowayed avatar jberkel avatar michael-zinn avatar neurogami avatar rscottm avatar techhumans-com avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruboto-irb's Issues

Port to Ruboto Core

As of version 0.4, Ruboto Core offers to share the JRuby jars between apps. ruboto-irb should utilize this.

rake error on linux

I tried to compile but i received this message

rake aborted!
Command failed with status (1): [ant debug...]
/home/superuser/quickstart/rakelib/ruboto.rake:949:in 'build_apk'
/home/superuser/quickstart/rakelib/ruboto.rake:540:in 'block in <top (required)>'
Task: TOP => default => debug => /home/superuser/quickstart/bin/Quickstart-debug.apk

after that I tried with:
sudo rake

and i received this message
rake aborted!
Errno::ENOENT: No such file or directory -adb version
/home/superuser/quickstart/rakelib/ruboto.rake:32:in '''
/home/superuser/quickstart/rakelib/ruboto.rake:32:in 'block in <top (required)>'

What i need to do to fix it?

Website Tweaks

Make it look a little better
Perhaps add more text
Perhaps make a "these are not the droids you're looking for" joke for the 404 page
Blog?

Weird error with open-uri

Code:

require'open-uri'
u='https://www.google.com/search?q=stackexchange&ie=utf-8&oe=utf-8'
puts open(u).read

Error screenshots:

Top half
Bottom half.

Update to Ruboto 0.8.0

To get good feedback on the changes in Ruboto, we should update Ruboto IRB in Ruboto 0.8.0.

I can do it, but I think you can do it faster, @rscottm :) Do you have the time for this?

I think this should be done well before the next release of Ruboto, scheduled for the first week of september.

Build failing

I'm trying to build ruboto-irb for a more modern SDK version, android-15 (Android 4.0.3 Ice Cream Sandwich). When I run rake install, I get lots of errors.

Trace:

$ rake install

...

    [javac]                                              ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 100 errors

BUILD FAILED
/Users/andrew/adt-bundle-mac/sdk/tools/ant/build.xml:705: The following error occurred while executing this line:
/Users/andrew/adt-bundle-mac/sdk/tools/ant/build.xml:718: Compile failed; see the compiler error output for details.

Total time: 3 seconds
rake aborted!
Command failed with status (1): [ant debug...]
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:995:in `sh'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:1010:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:1010:in `sh'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:1094:in `sh'
/Users/andrew/Desktop/src/ruboto-irb/rakelib/ruboto.rake:409:in `build_apk'
/Users/andrew/Desktop/src/ruboto-irb/rakelib/ruboto.rake:165
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:634:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:634:in `execute'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:631:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:631:in `execute'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:590:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:607:in `invoke_prerequisites'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:604:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:604:in `invoke_prerequisites'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:590:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:583:in `invoke'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2051:in `invoke_task'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2029:in `top_level'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2029:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2029:in `top_level'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2023:in `top_level'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2001:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:1998:in `run'
/usr/bin/rake:31

Specs:

ruboto --version
0.10.0

jruby --version
jruby 1.7.1 (1.9.3p327) 2012-12-03 30a153b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_37-b06-434-11M3909 [darwin-x86_64]

java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)

system_profiler SPSoftwareDataType | grep 'System Version'
      System Version: OS X 10.8.2 (12C60)

Ruboto IRB console doesn't accept input

When launching a script with a line such as
'input = gets' the console just ignores the line as if it is an empty variable declaration, no error/message is thrown whatsoever.

Unnecessary dialog for Toggle Usable Screen on Android 3.0/4.0

The Toggle Usable Screen menu item hides the tabs. It also shows a dialog "Title Visibility Change" "Reorient the screen for this to take effect [OK]", but the tabs are already gone when the dialog appears. This behavior is new on Android 3.0/4.0. The dialog could be removed.

See issue #14 for more details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.