»
S
I
D
E
B
A
R
«
Evejob Development Environment Installation Part #5: Ruby, JRuby and Rails + AppEngine Installation
Oct 28th, 2009 by evereq

Ruby installation

Let’s start from Ruby installation. We can download Windows One-Click Installer from http://rubyforge.org/frs/?group_id=167, for example ruby186-27_rc2.exe

During installation, make sure that you select at least “Enable RubyGems” option:

RubyInstallation

You can leave default installation folder (C:\Ruby).

Ones you finish installation, you can run both “ruby” and “gem”  from withing your command line.

So it’s time to install Rails, just type in command prompt:

gem install rails

and wait few minutes to finish installation.

JRuby installation

Download installation package from http://jruby.org/download. We will need binary Windows version, for example JRuby 1.4.0RC1 Binary .zip. Extract folder content to C:\JRuby folder and add path to the JRuby to your PATH variable:

JRubyPath

Let’s test installation:

JRubyTestInstallation

Now both Ruby and JRuby installed.

The problems starts when we will try to simultaneously use them (side by side)… First of all, make sure that you delete RUBYOPT environment variable (because it seems like JRuby gems did not work correctly if this variable setup). Now you can invoke each “gem” using following commands:

For Ruby:   ruby -S gem

For JRuby:  jruby -S gem

For example this is what I get on my machine:

GemSideBySide

Note: it is actually not a big problem that I had 2 different versions of Gem on my machine – both versions (1.3.1 and 1.3.5 works well for me… update of gem 1.3.1 fails for some reasons on my machine, so I decide to leave this for now…)

One small thing to do: it is possible that you have old version 1.3.1 of RubyGems like me (in the moment when I write this, latest version is 1.3.5 like was installed for JRuby). If we leave it, we can face some problems in future with IDEA etc, so let’s just update it:

UpdateRubyGems

Also, let’s install jruby-openssl (IDEA generate Error if this gem not installed):

OpenSSLforJRuby

Rails Installation

Next step is installation of Rails – just type following commands (it is better to just install Rails twice than to share same installation for both Ruby and JRuby):

ruby -S gem install rails
jruby -S gem install rails

EvejobRoR and EvejobRoRG Project

We going to create 2 separate projects now:

EvejobRoR – will use Rails build in ActiveRecord + MySQL database

EvejobRoRG – will use App Engine hosting, datastore and Google Accounts for user authentication APIs

Let’s start from more simple EvejobRoR:

cd c:\evejob
rails EvejobRoR -d mysql

Now let’s open this “template” project in IDEA:

File -> New Project -> Create project from scratch:

CreateRubyProjectInIDEA

Change here “Project files location” to the “C:\evejob\EvejobRoR”, select “Ruby Module” and press next (see screenshot above)

Now you need to specify the Ruby SDK (current version of IDEA can’t detect SDK locations from environment variables). Press “Configure…” button and press “+” button in “Configure JDK” window:

AddRubySDK

Select “Ruby SDK” in popup and than select Ruby interpreter path:

SetRubyPath

I Hope you will get something like this:

RubySDKAddedToIDEA

If so, just press “OK” and continue IDEA project creation Wizard:

ContinueRubyProjectCreationWizardInIDEA

Select “Ruby on Rails” on next screen and press “More…”  for Rails Facet configuration:

SelectRubyOnRailsTechnology

RailsFacetSettings

Make sure that you select “Use existing Rails application” and “Preconfigure for selected database” to “mysql” like (see picture above)

Now fill free to finish project creation Wizard. Done! We get EvejobRoR project loaded into IDEA.

Same steps we need to made for EvejobRoRG project, with small difference that this time we need to add JRuby SDK, instead of Ruby SDK like before and that we don’t want to support mysql as we are going to use Google App Engine API instead.

So, first type:

cd c:\evejob
rails EvejobRoRG

Then same like before, create new project in IDEA, put here “C:\evejob\EvejobRoRG” path and in “Specify the Ruby SDK” press “Configure…” and add JRuby SDK:

JRubySDKInIDEA

After made same steps like was done for EvejobRoR project, just make sure that you unselect “Preconfigure for selected database” check box in Rails Facet Settings dialog and process steps like before to finish Wizard.

Hopefully you get EvejobRoRG project opened in IDEA!

Prepare JRuby / Rails for Google App Engine

Google App Engine runs Java applications, so we need to make sure that we can assemble our JRails applications into a Java Web Archive (.war). To do such tasks easy, let’s first install “warbler” gem:

jruby -S gem install warbler

Now it is time to check that you add Java JDK path to windows PATH environment variable (because “warbler” gem use JDK):

JDKPathToPATHVariable

Next step, to run following commands from application root folder (c:\evejob\EvejobRoRG):

jruby -S warble pluginize
jruby -S warble config

(make sure you type “warble”, not “warbler” that is just Gem name)

Now you can just check that “Warbler” works:

jruby -S warble

As result you must see EvejobRoRG.war file generated in application root folder (c:\evejob\EvejobRoRG)

We can’t use this .war file directly for Google App Engine for few reasons, but at least we see that we can get some .war file :)

I specially not use all appengine-jruby project gems for few reasons:

  • google-appengine gem install own “tuned” version of JRuby that we want to avoid for reasons, for example for quick updates as we don’t want to depend on this special version of JRuby etc (means that project must be installed using Ruby, not JRuby! And only after installation it download and install customized, ‘frozen’ version of JRuby)
  • google-appengine helps to run JRuby on Google App Engine, but not to run Rails on Google App Engine ! :) All problems related to Rails on App Engine are still exists (read more at http://code.google.com/p/appengine-jruby/wiki/RunningRails)

But what I do use is one of the gems from appengine-ruby project – “appengine-apis”, so let’s install it:

jruby -S gem install appengine-apis

Read this for now to get more information about Rails and Google App Engine specific things:

http://olabini.com/blog/2009/04/jruby-on-rails-on-google-app-engine/

http://www.railshacks.com/2009/4/25/run-your-ruby-on-rails-app-on-google-app-engine

We will get back to this later…

Evejob Development Environment Installation Part #2: IntelliJ IDEA and Plugins Installation
Oct 21st, 2009 by evereq

Let’s start with installation and configuration of the IntelliJ IDEA IDE for RoR / GoG / Django and Google App Engine development.

At the time I write this article, version 8 is available and version 9 (Maia) only at pre-release stages… So we start development in version 8 (but with really huge interest we will wait for version 9!). Also please note that community version of IDE is lack some important functions, so we going to use commercial version (30 day trial will be enough to start)

So go to http://www.jetbrains.com/idea/, download and start installation of Windows version of IntelliJ IDEA. During installation you need to select the plugins to enable. Made following selection (I am going to use Git and Subversion version controls systems in Evejob project)

SelectVCS

On next screen, when IDEA will ask you about Web/JavaEE plugins I recommend to leave all options selected (unless you know that you not going to use some of Java technologies in near future) dues to the fact that when we move to Grails development, some of this plug ins will be in used.

On “Select Application Server Plugins” I also recommend to leave all options, as probably we will want to test hosting of application on as much Web Servers as possible (unless you know specific server requirements) – it is exactly way I am going to develop Evejob!

Same way, I recommend to leave all HTML / JavaScript development Plugins and Other Plugins selected (unless you know for sure which one you going to use and which one not… seems effort to enable them later can be more then performance issues in case if you just leave everything enabled, at least on latest hardware).

In case if you have only one developer machine, on next screen with “IDEA Server Account details” you can just select “Do not login”, press “Skip”

DontLogin

and move forward to the end of installation.

Finish!

But wait – it’s not all – we need also to install plugins for RoR, Django and even Google AppEngine (Grails support build in to IntelliJ IDEA 8)…

Let’s start:
- go to File / Settings
- in Settings window found at left list box “Plugins” item and select it.

- open tab Available

- wait few seconds, until get a list of all available plugins in JetBrains database.

- in search box, start typing “Python”.

- select “Python” plugin in filtered list

- right click and press “Download and Install” link

IntelliJPythonPlugin

Plugin will be downloaded and installed for you (usually takes few minutes)!

Now it is time to install same way “Ruby” and “Google App Engine” plugins…

After you install all 3 plugins, press “Apply” button and answer “Yes” to the question about restart IDEA to activate changes in plugins.

That’s it with IntelliJ IDEA installation!

Evejob Development Environment Installation Part #4: Groovy, Grails + AppEngine Installation
Oct 18th, 2009 by evereq

Grails Installation

To install Grails follow steps:

1) Download and install JDK from http://java.sun.com/javase/downloads. Make sure that you use following version

Java SE Development Kit (JDK)

JDK 6 Update X

Note: You don’t need Bundles packages. Also make sure that you download Windows x64 version of JDK, like on screenshot bellow:

JDKDownload

Let’s assume that you download and install JDK to following default location: C:\Program Files\Java\jdk1.6.0_16

2) Download latest stable Grails Binary ZIP Release from http://www.grails.org/Download, for example: grails-bin-1.1.1.zip. We not going to install Grails from sources (build it) due to the fact that Grails support “grails update” command, which can update your Grails version to latest one.

3) Extract Grails archive to the following folder: C:\Grails

4) Create JAVA_HOME environment variable that points to the path where you have installed JDK and create a GRAILS_HOME environment variable that points to the C:\Grails folder:

JAVA_HOME_variable GRAILS_HOME_variable

Note, make sure you enter your system path to JDK and JDK version that you install before.

5) Append %GRAILS_HOME%\bin to the PATH variable:

GrailsPath

6) Check that Grails installed successfully - just type “Grails” in command prompt and check that you get a help message like:

GrailsWelcome

OK, installation of Grails finishes here, let’s move to the next task…

EvejobGoG and EvejobGoGG projects configuration

So let’s start to create EvejobGoG project that is build on  Grails and EvejobGoGG also build on Grails but specially adjusted to be hosted by Google App Engine.

First Start IntelliJ IDEA, open “Create New Project”, select “Grails Application” and enter project files location as “C:\evejob\EvejobGoG”:

EvejobGoGCreate

Press Next and on Grails SDK window, press “New” to add new one and in “Select Path” window select “C:\Grails” folder (where you install Grails before):

GrailsSDKSelectionInIDEA

You will get something like this (your version of Grails can be different):

GrailsSDKSelectionFinished

Press “Next” and on next window (Select the desired technologies) leave all options unselected. After you press “Finish” you will get new Grails project opened in IDEA (if during this phrase IDEA will ask you about some updates in Grails Tool Window, press “y” to do so):

GrailsEvejobGoGProjectInIDEA

Now you can repeat same steps to create EvejobGoGG project that will use Google App Engine.

But first let’s install Google App Engine SDK for Java.

Go to the http://code.google.com/appengine/downloads.html#Google_App_Engine_SDK_for_Java and download Zip file that contains SDK (usually file have name like “appengine-java-sdk-1.2.6.zip”). Than create folder C:\Google\google_appengine_java_sdk and unzip archive content to this folder. That’s it – Google App Engine Java SDK installed.

Let’s setup environment variable which is used by Grails plugin to locate App Engine Java SDK – APPENGINE_HOME (in our system we install it to C:\Google\google_appengine_java_sdk folder):

APPENGINE_HOME_variable

Let’s reload IDEA so environment changes takes effect (we will use APPENGINE_HOME variable in a second).

Now let’s continue with IDEA and setup EvejobGoGG project same way like we create and setup EvejobGoG (all step exactly same like above).

IntelliJ Idea provide great support of Grails development build-in. For example it is very simple to install Grails Plug-ins directly from IDE (make sure that you select EvejobGoGG project in IDEA window):

GrailsPluginsInIDEA

Ones you open Grails plugins window, probably you will need to press “Reload Grails Plugin” button, to get a full list of available plugins:

GrailsPluginsReload

Type “app” in search box and select “app-engine” plugin (”Grails AppEngine plugin”). Check check box “Enable” and press “Apply Changes”. Than select latest release version of the plugin, for example:

GrailsAppEnginePluginVersion

OK, let’s back to plugin installation – press “OK” on plugin installation window and in Grails window you will probably get question “Do you want to use JPA or JDO for persistence”. Let’s for now just answer “jpa” and finish plugin installation.

Finished… Ah, ups… Let’s just check that project structure is OK – go to “File / Project Structure” window:

ProjectStructureCheck

Sometimes (looks like due to some bug in IDEA currently???) you will not get Project SDK configured:

ProjectSDKNotConfigured

If you in this situation (hopefully not, but just in case), press “New” button,  select “JSDK” in drop down and browse to your JDK path:

JDKPath

After, press “Apply” and you will add JDK to EvejobGoGG project.

Do the same check (and probably fix) for EvejobGoG project.

Evejob Development Environment Installation Part #3: IntelliJ IDEA Python Plugin Configuration
Oct 18th, 2009 by evereq

Let’s configure IDEA plugins so we can actually start coding on Django :)

1) Press “Create New Project” and select “Create project from scratch” option.

2) Select “Python Module” in project type.

3) Simple select project files location to “C:\evejob\EvejobDJ” but pressing “…” button and you will get all other fields filled for you by IDEA

PythonModuleAdd

4) Press next and select Python Interpreter:

PythonInterpreter

5) Now you need to select Python SDK path (C:\Python)

SelectHomeDirectoryForPythonSDK

6) Ones you press Ok on “Select Path” window you will get following:

PythonSDKFinish

Press Ok and Finish and you will open Django project in IDEA

IDEAAfterSetup

Now it make sense to repeat same steps for EvejobDJG project so we can manage it by IDEA

»  Substance: WordPress   »  Style: Ahren Ahimsa
© Copyright 2008–2009 EvereQ.com All rights reserved.