I have fooled around with Ruboto but I don’t want to build native Android apps. I just want to start an irb session without 3 apps.
Here comes Termux. This is its official description:
Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically - additional packages are available using the APT package manager.
The definition of a gold mine if you ask me. And yeah, they have a lot of packages, including the latest stable version of Ruby. Go and see for yourself on their github repository.
Get it from Google Play, update the packages list and install Ruby in one line.
Formidable! Now let’s put it to the test.
Isn’t that wonderful?
I have a OnePlus 2 and 2 GiB of RAM are free most of the time. That’s much more than you can get from Heroku’s free dyno. Let’s see if we can run a Rails app on Android.
First step: bundler
Now for the painful part, installing nokogiri’s dependencies.
We need something to build our native extensions.
And these should do the trick:
Say a prayer and hit return after the following line.
Good. I spent quite some time gathering all of them (more than I care to admit as a matter of fact).
We will need a database for our app. Rails comes by default with a sqlite database and it carries along some dependencies that are not satisfied by default on our android device.
And something for our asset pipeline:
We need to add a couple of gems for timezones. Open Gemfile with vi and add(be carefull with their order and platform options if any):
The moment of truth:
You can find a working demo app on my GitHub profile.
update 14.01.2018: Updated Rails version and added demo app and pictures.