Automator Workflows for Rails Development
I have just put together two Automator workflows for loading my Rails environment for development. I did this because whenever I want to work on a rails application I have to do the same things: Load Textmate, Launch Lighttpd, and open the default location in Firefox. As I mentioned, I made two workflows, one for launching the environment from the right-click menu in Finder and the other one that I can launch via QuickSilver or by double-clicking.
The first lets me navigate to the root folder of my rails application in Finder, right-click, and choose Open in Rails under the Automator sub-menu. Just save the workflow as a Finder Plug-in and it will automagically show up in the menu. The meat of this workflow is the AppleScript:on run {input, parameters}set railspath to POSIX path of input as text
tell application "Terminal"
do script "cd " & railspath in window 1
do script "script/server" in window 1
set miniaturized of front window to true
end tell
do shell script "mate " & railspath
delay 5
tell application "Firefox"
OpenURL "http://localhost:3000"
end tell
return input
end runThe "delay 5" statement is to wait for lighttpd to load. The rest is pretty self explanatory.
Here is a picture of the workflow:
The second workflow allows me to choose the root folder of my Rails application. The AppleScript is the same, I just used a different workfow action. It looks like this:
No comments:
Post a Comment