class Capistrano::SCM::Fossil

Public Instance Methods

define_tasks() click to toggle source
# File lib/capistrano/scm/fossil.rb, line 14
def define_tasks
  

  namespace :fossil do
    
    desc "Extract repository on release"
    task :create_release do
      %x{fossil tarball --name . #{fetch(:fossil_branch)} #{fetch(:fossil_tarball_path)}}
      
      on release_roles :all do
        tmp_file = capture("mktemp")
        execute :mkdir, "-p", release_path
        upload!(fetch(:fossil_tarball_path), tmp_file)
        execute :tar, "-xzf", tmp_file, "-C", release_path
      end
    end

    task :set_current_revision do
      revision = %x{fossil info}[/checkout:([^\n]+)/,1].strip
      on release_roles :all do
        set :current_revision, revision
      end
    end
    
  end
end
register_hooks() click to toggle source
# File lib/capistrano/scm/fossil.rb, line 41
def register_hooks
  after "deploy:new_release_path", "fossil:create_release"
  after "deploy:set_current_revision", "fossil:set_current_revision"
end
set_defaults() click to toggle source
# File lib/capistrano/scm/fossil.rb, line 6
def set_defaults
  set_if_empty :fossil_branch, "trunk"
  set_if_empty :fossil_tarball_path, lambda {
    suffix = fetch(:application)
    File.join(fetch(:tmp_dir), "fossil-#{suffix}.tar")
  }
end