Skip to content

Instantly share code, notes, and snippets.

@wilson
Created Sep 30, 2008
Embed
What would you like to do?
##
# Sets all the default values. Should only be called once. Use reset
# if you need to restore values.
def self.set_defaults
@@default_env ||= {}
self.reset
mandatory :repository, "repository path"
mandatory :deploy_to, "deploy path"
mandatory :domain, "server domain"
simple_set(:deploy_timestamped, true,
:deploy_via, :export,
:keep_releases, 5,
:migrate_args, "",
:migrate_target, :latest,
:rails_env, "production",
:rake_cmd, "rake",
:revision, "head",
:rsync_cmd, "rsync",
:rsync_flags, ['-azP', '--delete'],
:ssh_cmd, "ssh",
:ssh_flags, [],
:sudo_cmd, "sudo",
:sudo_flags, nil,
:umask, '02')
set(:current_release) { File.join(releases_path, releases[-1]) }
set(:latest_release) { deploy_timestamped ?release_path: current_release }
set(:previous_release) { File.join(releases_path, releases[-2]) }
set(:release_name) { Time.now.utc.strftime("%Y%m%d%H%M%S") }
set(:release_path) { File.join(releases_path, release_name) }
set(:releases) { task.run("ls -x #{releases_path}").split.sort }
set_path :current_path, "current"
set_path :releases_path, "releases"
set_path :scm_path, "scm"
set_path :shared_path, "shared"
set(:sudo_password) do
state = `stty -g`
raise Vlad::Error, "stty(1) not found" unless $?.success?
begin
system "stty -echo"
$stdout.print "sudo password: "
$stdout.flush
sudo_password = $stdin.gets
$stdout.puts
ensure
system "stty #{state}"
end
sudo_password
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment