Wednesday Sep 24, 2008
Two weeks ago, before I left for vacation, Sun launched the new project collaboration site I am working on. You can learn more about Project Kenai and how it differs from similar project hosting sites like sourceforge.net and Google Code in Tim's interview with Nick, the lead developer.
Tuesday Aug 12, 2008
I've been working on a new project for the past six months. It's a new web site built using Ruby on Rails that will be going public as a beta real soon now. Ruby on Rails is a webapp framework that's built on top of the Ruby scripting language so I've also been working in Ruby. It's a pretty cool language compared to others I've used. I'll write more once the project has been released to the public.
Tuesday Dec 11, 2007
As part of a demo, I wanted to deploy a Ruby on Rails application into a Rails Virtual Appliance using Capistrano. A Rails Virtual Appliance is a Virtual Machine that contains a complete stack of software from the Operating System up to Ruby on Rails itself. If you are using NetBeans 6 as your IDE, you can create a file such as $PROJECT/lib/tasks/demo.rake containing something like the following:
# Rake task to deploy to a production server for virtual appliance demo
# 2007-12-10eeg
# File that contains IP address of virtual appliance. If this file cannot
# be read, then the user will be prompted for the information.
TARGET_IP_FILE = '/ApplianceShare/ipfile.txt'
namespace :demo do
desc 'Print the target IP address'
task :print_target_ip do
puts "Target host IP: #{get_target_host}"
end
desc 'Show the coolstack page'
task :show_coolstack do
sh "open http://#{get_target_host}/"
end
desc 'Show the main depot web application page'
task :show_app do
sh "open http://#{get_target_host}:8000/store/"
end
desc 'Deploy to production'
task :deploy do
target_host = get_target_host
sh "cap -S target=#{target_host} deploy:setup"
sh "cap -S target=#{target_host} deploy:cold"
end
desc 'Deploy and run the application'
task :run => [:deploy, :show_app]
end
def get_target_host
if File.readable?(TARGET_IP_FILE)
f = File.new(TARGET_IP_FILE)
line = f.readline
host_ip = line.chomp
else
print "Target host: "
line = $stdin.gets
host_ip = line.chomp
end
host_ip
end
### Local Variables:
### mode: ruby
### End:
Note that the rake task uses sh to call Capistrano via the cap command to deploy the app into the production machine which in this case is a Virtual Appliance.
Then, within NetBeans, you can invoke the context menu on the project node in the Projects Window and select "Run Rake Task" and navigate to the task you want to invoke. See this blog entry or wiki page for more information on NetBeans and Rake.