Piku’s Blog

May 1, 2008

Braid 0.4

Filed under: Git, News, Ruby on Rails, Uncategorized — Tags: , , , , , , — Mihai @ 2:10 pm

Braid 0.4 has been released, Braid is a simple tool to help track git and svn vendor branches in a git repository. I had a previous coverage of Braid 0.3.

The new features include squashed mode, in which you have only one commit when adding a mirror instead of having all the history and a team mode. It also requires Git version 1.5.4.5 or higher (see my post on updating git). If you hit any bug please report them.

The wiki has usage and examples. You can install it with rubygems (don’t forget to upgrade to RubyGems 1.1.1):

gem sources -a http://gems.github.com/
gem install evilchelu-braid

Or you can get it from the Git repository.

If you used my previous Braid tutorial here’s how to upgrade Rspec to the git repository and get the latest version. If you do not have rspec svn setup you can skip this part.

braid remove vendor/plugins/rspec
braid remove vendor/plugins/rspec_on_rails
git merge braid/track

I think I hit a bug and had to delete the folders manually:

 rm -rf vendor/plugins/rspec vendor/plugins/rspec_on_rails

Now to install the git repositories:

braid add -p -t git git://github.com/dchelimsky/rspec.git
braid add -p -t git git://github.com/dchelimsky/rspec-rails.git
git merge braid/track

February 29, 2008

Playing with capistrano and git

Filed under: Programming, Ruby on Rails — Tags: , , , , — Mihai @ 8:50 pm

Today I wanted to see how easy it is to use capistrano to deploy apps.

Because I’m using git it was a bit harder but not impossible, I am using the latest capistrano version (2.2.0). It’s not very hard and I like to edit something locally, git commit, git push then cap deploy and the new version is on the server immediately.

My config/deploy.rb file:

set :application, "myapp"
set :repository,  "ssh://myserver/git/app.git"
set :deploy_to, "/home/mihai/apps/#{application}"
set :scm, "git"
ssh_options[:paranoid] = false
set :domain, "myserver.net"
role :app, domain
role :web, domain
role :db, domain, :primary => true
default_run_options[:pty] = true
set :user, "mihai"
set :runner, "mihai"
set :use_sudo, false
set :deploy_via, :remote_cache
set :mongrel_port, "3001"

And my config/mongrel.rb (loaded from Capfile) that is just a plain mongrel controller (no clustering):

namespace :deploy do
 task :start, :roles => :app do
  run "cd #{current_path} && mongrel_rails start -e production -p #{mongrel_port} -d"
 end
 task :restart, :roles => :app do
   run "cd #{current_path} && mongrel_rails restart"
 end
 task :stop, :roles => :app do
   run "cd #{current_path} && mongrel_rails stop"
 end
end

If you are interested I can post a full tutorial including setting up apache and git on the server.

February 4, 2008

Installing rspec with Braid [Updated]

Filed under: Git, Ruby on Rails — Tags: , , , , , , , , , — Mihai @ 7:08 pm

See my Braid 0.4 post for informations about how to upgrade.

Updated to work with the latest version (0.3.1)

Braid is a tool made by Cristi Balan and is a simple tool to help track vendor branches across different SCMs.

It was originally named giston, and was providing functionality similar to piston for git. Braid, however, will work with most SCMs as both source and host.

Warning, Braid is still under development and may change in the future.

To start you need to get and install, on a linux like my ubuntu you can do it by writing:

mihai@mihai-laptop:~$ sudo gem install main open4
mihai@mihai-laptop:~$ git clone git://github.com/evilchelu/braid.git braid
mihai@mihai-laptop:~$ cd braid
mihai@mihai-laptop:~$ sudo ruby setup.rb

For this example I will use it to install rspec (the development version) on a Rails project. Go to your project root and type:
(more…)

January 29, 2008

JRuby on Rails deployed at Sun

Filed under: News, Ruby on Rails — Tags: , , — Mihai @ 9:30 pm

Sun’s Mediacast 2.0 was rewritten using JRuby on Rails. It’s another successful deployment of JRuby after Oracle Mix (see implementation details).

Our development environment is based on a self-contained JRuby (1.0.3) on Rails (1.2.6) application stored in a Mercurial repository. The IDE we use is NetBeans 6 with Ruby support and Mercurial plugin. The DB of our choice is MySQL and servers we use during development are WEBrick and Glassfish v2ur1.

As for production environment they use “a pair of load-balanced T2000 with Solaris 10, JDK6 and SJSAS 9.1u1. These two servers share a nfs NAS drive used for file storage and fragment cache storage. The DB backend is a MySQL database server, which we access through a connection pool set up in the app server.”

They comment that most C-based ruby gems are not compatible with JRuby but the support is improving with the work of jruby-extras project. They used Java for SOAP-over-HTTPS based authentication webservice and for long-running processes by using a servlet filter.

JRuby is starting to enter the enterprise space, dominated by Java. Sun is investing much in Ruby by supporting the JRuby project, JRuby in Glassfish and NetBeans Ruby support. I think the number of JRuby-powered applications will increase this year and Ruby be considered a serious language.

January 27, 2008

Testing subdomains as account keys

Filed under: Ruby on Rails — Tags: , , , — Mihai @ 6:49 pm

I am using subdomains as account keys and some tests failed for controllers, they were looking for the account but didn’t find it.

The trick is to rewrite the host in the tests. Here’s the code for rspec.



  before(:each) do

    @request.host = 'piku.mysite.net'

  end

Here, before each test the url is rewritten and the filter that finds the account happily does it job.

Older Posts »

Create a free website or blog at WordPress.com.