Java Magazine, July/August 2016
ORACLE COM JAVAMAGAZINE JULY AUGUST 2016 63 jvm languages load and install the latest JRuby implementation rvm install jruby 9120 Searching for binary rubies this might take some time Found remote file Users headius rvm Checking requirements for osx Requirements installation successful jruby 9120 configure jruby 9120 download jruby 9120 validate archive jruby 9120 extract jruby 9120 validate binary jruby 9120 setup See RVMs home page for more details or try out one of the other Ruby switchers For folks who prefer a more direct approach you can simply download a tarball tar gz or a zip file containing a full JRuby distribution Unpack it add the bin directory to your PATH and youre off to the races JRuby also comes in a Windows installer that can optionally install a JRE for you as well JRuby also publishes a full complement of Maven artifacts under the org jruby group which is useful for embedded applications that will not need a complete on filesystem JRuby distribution Once installed JRubys command line matches CRubys jruby v jruby 9120 230 2016 05 26 jruby e puts Hello Ruby Hello Ruby And Rubys interactive console IRB is available as well irb jruby 9120 001 puts hello hello Ruby on Rails Every web developer should have heard of Ruby on Rails by now It changed the way developers do web development from introducing the idea of sensible defaults convention over configuration to rich code generation scaffolding and database agnostic schema versioning migrations Most web frameworks today copy some aspect of Rails in some cases even mimicking the filesystem layout of Rails applications or reusing Rails inspired terms for similar features Next I walk through getting a simple Rails app running on JRuby But first I need to install Rails using the gem install command Most libraries for Ruby are distributed as gems hosted on RubyGems org From a Java perspective think of a Ruby gem as a Maven library plus some executable scripts for the command line gem install rails Fetching rack 164 gem 100 Successfully installed rack 164 Fetching sprockets 360 gem 100 Successfully installed sprockets 360 Fetching rails 426 gem 100 Successfully installed rails 426 23 gems installed rails new my_ app create create README rdoc create Rakefile
You must have JavaScript enabled to view digital editions.