How to have an old version of Ruby on Cloud9 - mysql

I have a source code that I want to test on Cloud9 hosting (I have premium account). However, the problem is that the source code is bade on Ruby 1.8, mysql-essential-5.0 and other old libraries.
How can I create a plain VM on cloud9 and install ruby and other version by myself ? So far all i see that all vms are pre-configured with ruby 4

Cloud9 IDE comes with rvm preinstalled, so this is nice. Otherwise, all VM are pre-configured with Ruby 2.1.5 (not 4) and Rails 4.1.6
The only thing you have to do in your console is :
# Check your actual Ruby version
ruby -v
# ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
# Install ruby 1.8 (if it's not already done)
rvm install ruby-1.8
# Switch ruby version
rvm use 1.8
For MySQL I would first do an uninstallation of your current version of mysql with sudo apt-get uninstall mysql* and then install it from source. You can check this link for more info.

Related

Gem::InstallError: The 'json' native gem requires installed build tools. Please update your PATH to include build tools or download the DevKit

I'm having trouble building a Ruby project on Windows 7 Enterprise SP1.
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Using awesome_print 1.7.0
Installing json 2.1.0 with native extensions
Using mini_portile2 2.1.0
Using ffi 1.9.18 (x64-mingw32)
Using rubyzip 1.2.1
Using websocket 1.2.4
Using tomlrb 1.2.4
Using bundler 1.14.6
Gem::InstallError: The 'json' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing json (2.1.0), and Bundler cannot continue.
Make sure that `gem install json -v '2.1.0'` succeeds before bundling.
I've included both Ruby and the DevKit in my PATH environment variable, i.e. C:\Ruby22-x64\bin;C:\Ruby-DevKit\bin. What could be going wrong?
The command I'm running is bundle install in the ..\tindermation\node_modules\.bin directory of this project: https://github.com/feelobot/tindermation
I didn't initialize and bind the ruby installations in my DevKit to my PATH:
Downloaded it, ran it to extract it somewhere (permanent). Then cd to it, run ruby dk.rb init and ruby dk.rb install. The bundle install command worked after following these steps.

how can i install jruby alongside ruby

i first installed jruby using the sudo apt-get install jruby command, which succeeded but it did gave me 1.5.6 version when i wanted a later version. So i uninstalled it and used rvm install jruby command and i was able to install jruby version 1.7.19 but after installing it, my ruby applications,which were funtioning right started producing errors complaining of missing gems like mysql2 gem missing,run bundle install. i run bundle install but nothing i did seemed to help, i was getting nowhere.
When i asked for the ruby version, i was receiving the jruby version instead, its lyk jruby over shadowing ruby,,,, So i decided to uninstall jruby, reinstall ruby and now ruby is functioning as well as before.
Can anyone help me with the ubuntu commands which can help me install jruby alongside ruby, so that both work well without any errors???
Am requesting for serious help please
I usually prefer rbenv over rvm for running multiple versions of Ruby on the same machine. Here is sample install/usage steps:
Install rbenv git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
Install ruby-build git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
Modify your .bashrc echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Restart your shell
Install rubies. e.g. rbenv install jruby-1.7.20
Rehash (create new rbenv shims. You'll need to run this anytime you install a gem that adds a command) rbenv rehash
You can list the Ruby versions available to install with rbenv install -l
You can set the default global ruby version with rbenv global jruby-1.7.20.
You can also pass "system" instead of an installed Ruby if you want the default to be the OS installed version of Ruby.
You can change Ruby version on the fly with rbenv shell 1.9.3-p551
See here (https://github.com/sstephenson/rbenv#command-reference) for a lot more detail and documentation.
Edit: I was assuming you're using Ubuntu, hence the edit of .bashrc. If you're using another OS you may need to change that to .bash_profile
Thanks for that answer. I have also found out that it is soo possible to have jruby and ruby installed concurrently using rvm. After installing the various versions or languages say ruby and jruby, only the default language and version is running in the terminal as current so you have to run the command 'rvm list' to show you the various installed versions after which you run 'rvm use language-X.X.XX' say rvm use jruby-1.7.20.1 to make jruby-1.7.20.1 run as the current in that terminal.
You can also run another version in a different terminal concurrently but please note, you have to run the command rvm use every time you open up a new terminal, else you make that version default.

Where to start for Jruby on rails?

Any tutorials or blog are available to start with JRuby on Rails
which guide me to the installation and small JRuby on Rails application ?
I have gone through this Walkthroughs And Tutorials(https://github.com/jruby/jruby/wiki/WalkthroughsAndTutorials) link but most of the JRuby on Rails links are broken.
JRuby and Rails Installation
The easiest way to set up JRuby is using rvm. The following command installs rvm, the latest version if JRuby, and gets the latest version of rails:
$ curl -L https://get.rvm.io | bash -s stable --autolibs=3 --ruby=jruby --gems=rails
On Windows, you can download an installer which will set up JRuby for you. You then need to install rails by running the following command:
jruby -S gem install rails
Set up a Rails project
JRuby’s wiki page JRuby on Rails is a great collection of resources on the topic; it contains in particular a link to that good blog post: http://blog.rubyrockers.com/2011/03/rails3-application-jruby/
In a nutshell, to create a rails project based on JRuby, use the following command, replacing my_app with the name of your project:
rails new my_app -m https://www.jruby.org/templates/default.rb
Rails Development
Once your project is set up, any Rails 3 tutorial will do — it is Ruby after all!
Deployment
For deployment, have a look at:
“specific” solutions like Torquebox or Trinidad,
or warbler to package your app as a war and deploy in traditional Java app server (WebSphere, Weblogic, etc.).
Further Resources
Finally, it is also worth mentioning that Charles Nutter et al's book Using JRuby has a chapter dedicated to JRuby on Rails, and is an invaluable help in JRuby developments.

How to install Ruby on Rails with mysql and get it working, a step by step guide?

Some time ago I managed to get RoR working on Windows XP.
I've been trying to get it working on Windows 7 for 2 days but there's just no way, there's always a problem, one that google can't answer, no matter what I try.
Can someone give me a guide or something to get it working on Windows 7 or XP ? Even Ubuntu but I'd rather not go through that maze again.
I figure I'm going to install Windows XP on a virtual machine and start from there.
I need RoR and mysql - what versions, where do I download them from and what steps do I take ?
On a side note, how do you install mysql2 (version < 0.3) on rails 3.0.7 ? Because it automatically tries something over 0.3 which doesn't work on rails 3.0.7 and if I try the gemfile bundle trick with 0.2.7 I don't know how to specify configuration options and of course it doesn't work if I don't give it the location of mysql lib and include directories.
Also I tried using rails 3.1 beta and everything goes smoothly until I start the server and the website never loads on localhost:3000.
This is basically what I do to install on Windows 7:
Download and install latest mysql from http://dev.mysql.com/downloads/mysql/
Install Ruby http://rubyinstaller.org/downloads/ (check the box to update PATH)
Install Ruby Devkit http://rubyinstaller.org/downloads/ (for example extract to C:\DevKit)
Setup Devkit
cd [MY_DEVKIT_INSTALL_DIR]
ruby dk.rb init
ruby dk.rb install
Copy libmysql.dll from your mysql/bin install to C:\Ruby192\bin
gem install rails
gem install mysql2 -v 0.2.6
rails new my_test_app -d mysql
To setup Rails on windows, just download and click:
http://railsinstaller.org/
Take a look at http://rubyinstaller.org/ it should get you up and running.
I like Aptana Studio 3 for developping with RoR on Windows 7. The book "Agile Web Development with Rails" is also full of good advices.
Here are the steps I followed:
1- Installing Ruby via RubyInstaller
2- Install MySQL (follow #Reuben Mallaby instructions)
3- Install Rails
With the Built-in Terminal, make dev' easy. You should take a look: Aptana Studio

RVM, JRuby setting specific java environment

Ubuntu 10.04LTS
Netbeans 6.9.1 (with embedded JRuby 1.5.1)
JDK6u17 (installed in /opt)
GlassFish Gem 1.0.2
I am using a old JDK because of this bug: http://jira.codehaus.org/browse/JRUBY-4785
I want to install RVM and install another instance of JRuby. But i cant find any information how to set JRuby Java environment to JDK6u17(directory /opt).
I would be grateful for the help.
JRuby on default use system Java. So if i change "system" Java, JRuby will use that one.
I have figured two ways to set specific Java environment.
Set JAVA_HOME.
Here is a good one tutorial:
http://vietpad.sourceforge.net/javaonlinux.html
Update java setting from terminal(works only for JVM installed from apt-get or aptitude).
sudo update-alternatives --config java
That JRuby bug is marked as fixed for JRuby 1.6RC1, so you no longer need to use the old JDK.
I am using RVM and JRuby 1.6RC1 on Ubuntu 10.04 LTS just fine. There are instructions on my website for working with this version of Ubuntu, RVM and JRuby.
You don't need all the instructions, but some of the commands might help, if you get stuck.
http://www.scottlowe.eu/deploying-rails-3-with-jruby-daemonized-glass
(It does tell you how to get a modern JDK installed)