Hey everyone! Yesterday, I released my first public RubyGem. It's a small utility to use along with Capistrano. Nothing fancy, but my first. :)

History

I was impatient to hard code different env values in configuration files like NginX, Monit conf. Specially things like application path and so on.

So I wrote a small snippet to make them dynamic. But copying it in every project was another pain. The birth of Capistrano ERB Uploader.

Installation

Add this line to your application's Gemfile:

gem 'capistrano-erb-uplader'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capistrano-erb-uplader

Then add this line in your Capfile

require 'capistrano/erb-uploader'

Usage

You can list a bunch of ERB templates to parse and upload in your deploy.rb file.

set :erb_files, fetch(:erb_files, []).push('config/nginx.conf.erb', 'config/app.monit.erb')

You might also use this on your own task:

namespace :some do
  desc 'Some task to upload specialised erb files'
  task :task do
    on rolse(:app)
      upload_erb 'config/deploy/templates/some.conf.erb', 'config/some.conf'
      execute :sudo, 'service some restart'
    end
  end
end

Any suggestion to improve is most welcome. You can find the source at GitHub - Capistrano ERB Uploader.




What's on your mind?


336 Comments