Created
September 30, 2008 20:30
-
-
Save wilson/13938 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# 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