“Working Directory doesn’t exist” in Rubymine! ARRRGGGHHH!!

So a few weeks back I created a Rubymine Ruby on Rails Project I was kicking off. I got it running, did some scaffolding, started customizing that for what I needed. I had created this project on Windows 7 and did not realize the implications of this. I did a clone via github of the code on a Mac via bash. I then opened Rubymine and opened the project. That’s when I got this error message, “Working Directory doesn’t exist”. I thought, well what the… ¬† no reason for this. I’ve barely edited the project!!

I checked out the Jetbrains Forums and didn’t find an answer at the time, but did find others having the problem. Just today, Tyler Williams posted what had happened. Being that I don’t delete my projects, even slightly broken, for many days I went back to look at the .idea files as Tyler Williams suggested. Sure enough, my setting was hard coded (I suppose by the IDE??).

Which leads me to my recent thought that maybe I’ll be using TextMate more and Rubymine a little less. Even though, I do love the refactorings, code completion, and all that. But since I’m in the learning stage, and I’m doing hard core TDD (best I can with Ruby ūüôā ) I ought to not use the IDE as a crutch and instead force myself to learn the language well & the Rails Technology Framework! I’m getting there, but the battle still exists for me. At this point, I do my Ruby & Rails work about 1/2 in TextMate and 1/2 in Rubymine. Anyway, if you run into “Working Directory doesn’t exist” in Rubymine, now you have a good lead on what to do.

The Bus Ride Home, Sinatra Singing on OS-X

This is just a quick getting started I walked through to get Sinatra going on OS-X.

[sourcecode language=”bash”]
sudo gem install sinatra
sudo gem install shotgun
sudo gem install haml
sudo gem install unicorn
[/sourcecode]

After installing these things I created a new folder in a Rubymine Project.

New Empty Project in Rubymine
New Empty Project in Rubymine

I added a Ruby Class named SinatraSingsOsx to the project. I then realized that Rubymine did not detect that I had installed Sinatra, so I did a quick find in Rubymine to find and get it synced/installed so that Rubymine was aware of the gems.

Rubymine IDE
Rubymine IDE

Using the gem quick install in Rubymine I chose the documentation and dependent gems.

Rubymine Gem Quick Install
Rubymine Gem Quick Install

Once those were synced up I added the following Ruby Code to the file I created in the project.

[sourcecode language=”ruby”]
require ‘rubygems’
require ‘sinatra’

get ‘/’ do
"Verified: Server is up and running!"
end
[/sourcecode]

I then right clicked on the ruby file and selected the “Run the sinatra_singing_osx” which starts up the webrick web server and such.

Rubymine Run Page Dialog
Rubymine Run Page Dialog

Then navigate to http://localhost:4567 and you’ll see the results of the code.

Sinatra Web Application Running in Chrome
Sinatra Web Application Running in Chrome

Now that I’ve run the application in Rubymine I wanted to do the same with Shotgun using the same Ruby code. The first thing I needed to do was stop the server running that Rubymine had launched. If you look at the bottom of the IDE you’ll see the window displaying the current server status.

Web Server Executing
Web Server Executing

On the left hand side of this status window click on the large red button. This will stop the service. To verify just scroll to the bottom of this status window and you will see the message “Process finished with exit code 1“.

Now that I had the server cleaned up and stopped, I started a terminal again and navigated to the directory that the *.rb file is in that I want to start (host/run/execute, I’m not really sure what the appropriate word would really be at this point). So once at the appropriate path (machineName:SinatraSingingOSX adron$) I typed:

[sourcecode language=”bash”]
shotgun -p 4567 sinatra_singing_osx.rb
[/sourcecode]

Once this executes the same server that Rubymine uses, the WEBrick, will startup the application again. I launched the browser to assure this ran as expected and got the same results as if running it through Rubymine. I guess, it all really depends, want to just start building and checking things out or want to build with an IDE like Rubymine. It all really boils down to taste and what you’re working with. I’ve been going back and forth between pure text editor and IDE just to familiarize myself with both avenues of using Rails and coding with Ruby.

After the verification I hit Ctrl + C to stop the web server. This basically works on the msysgit in Windows, on OS-X, or on whatever distro of Linux you have running. The cool thing is, so does Rubymine. I figured if I was going to work toward familiarization of an IDE and using the terminal I’d use commands and IDEs that would work on whatever OS I’m running. It’s all good synergies that way. ūüôā

I wanted to keep this entry pretty short. With that in mind I simply logged what I worked on while en route home on the bus one evening. So on the next bus ride I’m going to tackle getting some specific notes with Sinatra, getting this all pushed into Heroku (of course, I’m all about the Cloud, you didn’t think I’d put it up on a shared host did you!) Until then, chow.

My Day @ Seattle Mobile Hackathon (#mobileappSEA) The Morning

I arrived around 8:20am “ish”. @juliaferraioli & cohort were registering people. The @AWSstartups crew was there including @Jeffbarr, also @shanley, @Alex_donn, @JamesPearce, and others were already getting things put together. I decided to happily plunk down in a chair and get going. I had zero plan, but only a single goal. Make a web app that isn’t device proprietary, but is mobile centric, and get it live on the web.

My initial dev machine load that I intended to get this accomplished with I posted yesterday. ¬†So here’s my first push…

First a quick run thru of WebStorm and RubyMine IDEs.

{Edited this part on Apr 20th to provider more information regarding Java Installation} If you’re on Ubuntu, open up the Synaptic Package Manager and search for java6, which should bring up the sun-java6-jre. ¬†Mark it for installation and apply so that the JDK will install with the required components. ¬†If the Java 6 isn’t available in the Synaptic Package Manager open up the Settings -> Repositories, and then the Software Sources Dialog will appear. ¬†Click on the Other Software tab and select Canonical Partners. ¬†Close the dialog and Reload the packages. ¬†When a search is done now, the sun-java6-jdk should be available.

Next edit the profile at /etc/profile by entering the command:

[sourcecode language=”bash”]
sudo gedit /etc/profile
[/sourcecode]

Add the following to the bottom of the file:

[sourcecode language=”bash”]
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export JDK_HOME=$JAVA_HOME
export RUBYMINE_JDK=$JAVA_HOME
[/sourcecode]

After this is done, restart your X-Windows/Gnome Instance or simply just reboot. I don’t really like to suggest rebooting since it usually isn’t needed with Linux. ūüėČ

Unzip both packages downloaded from Jetbrains.

[sourcecode language=”bash”]
tar -xvzf WebStorm-2.0.1.tar.gz
tar -xvzf RubyMine-3.1.1.tar.gz
[/sourcecode]

You may want to put your new applications into a specific directory. I placed mine in a folder I made within my user folder called apps. Just a little easier to keep up with things that way.

Creating a Launcher
Creating a Launcher

Once these are unzipped right click on your desktop and choose “Create Launcher…”. Click on the Browser to bring up a folder navigation dialog, find the bin directory of the app your creating a launcher for. In my case it is /home/adron/apps/WebStorm-103.243/bin/ which has the WebStorm App Files needed for the Launcher. Find the WebStorm.sh file and select it.

Once the app file is selected then check ok. For a more step by step, check out Tomi’s Blog Entry. ¬†Do the same for both apps.

With both of those apps, simply launch the IDE and enter your key (or select 30 day trial) and you’re up and running.

RubyMine Startup (click for full size image)
RubyMine Startup (click for full size image)

With the awesome Jetbrains IDEs installed I was really ready to dive into something.  Next I went straight for a new project in RubyMine.  File -> New or just click on the Create New Project on the main RubyMine Startup Screen.

New Project Dialog
New Project Dialog

Pick your name, I’ve decided to go for some sushi with a project type of Rails application, and click enter. ¬†The next dialog that comes up asks some standard settings information options.

Rails Settings
Rails Settings

If you click on the ellipsis button to the right of the Rails Version, a prompt will come up to select which rails version you want to use. ¬†Ruby Mine will then install that version if it isn’t installed already.

Install Rails Version
Install Rails Version

I decided to check “Generate RDoc and ri documentation” also, and then clicked on Install.

Installing Rails Version
Installing Rails Version

Once the options and settings are made for the new project, click to create the project.  RubyMine will work for a few seconds, maybe 20 or 30 on slower machines, and eventually the IDE will display with the newly created project.  When I created it the first time I was informed I was missing some gems.

RubyMine Project (Click for larger image)
RubyMine Project (Click for larger image)

I clicked on the More… option near the¬†Install and attach missing gems using bundler…¬†warning to get the additional gems I needed. ¬†This brings up a dialog specific to maintaining the Ruby SDK and Gems.

Settings (Click for larger image)
Settings (Click for larger image)

I clicked on Install Gems and found the the sqllite3 and sqllite3-ruby gems to install. ¬†I clicked on install and then apply and OK (ok, old habit, not sure WHY apply gets put on these dialogs) on the settings screen. ¬†Once done getting those last bits installed click on the Development: SomeSushi (or whatever you’ve named the project) and select Edit Configurations.

Development: SomeSushi
Development: SomeSushi

On the Edit Configurations Dialog screen check Run Browser from the bottom of the options and click on OK. ¬†Then click on run button (the green play button on the button bar) to run the Ruby on Rails Web Application. ¬†Within a second or two you’ll see the default Ruby on Rails + RubyMine Run the site in the browser.

RubyMine Ruby on Rails Default Web App
RubyMine Ruby on Rails Default Web App

At this point in the day I took a break, ate lunch, talked to¬†@AWSstartups crew @rodica & @Jeffbarr. ¬†Introduced myself formally in person to @shanley and chit chatted about our respective efforts with @lazycoder and¬†@juliaferraioli. ¬†The food was great, as in, it was actually really good. ¬†Not some random junk. ¬†Super tender chicken with¬†spaghetti¬†sauce and little round funny shaped pastas (I’m sure there is an appropriate name for em’). ¬†I was honestly impressed by the food brought in.

After lunch I dived back in for the next phase of development. ¬†For that though, I have another blog entry coming… ¬†(stay tuned).