mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Merge pull request #233 from czarneckid/intelligent-scm-setting
Intelligent :scm setting
This commit is contained in:
commit
7f184598f2
2 changed files with 29 additions and 2 deletions
|
@ -49,7 +49,7 @@ files = {
|
||||||
"config/deploy.rb" => 'set :application, "set your application name here"
|
"config/deploy.rb" => 'set :application, "set your application name here"
|
||||||
set :repository, "set your repository location here"
|
set :repository, "set your repository location here"
|
||||||
|
|
||||||
set :scm, :subversion
|
# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
|
||||||
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
|
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
|
||||||
|
|
||||||
role :web, "your web-server here" # Your HTTP server, Apache/etc
|
role :web, "your web-server here" # Your HTTP server, Apache/etc
|
||||||
|
|
|
@ -23,7 +23,7 @@ _cset(:repository) { abort "Please specify the repository that houses your appl
|
||||||
# are not sufficient.
|
# are not sufficient.
|
||||||
# =========================================================================
|
# =========================================================================
|
||||||
|
|
||||||
_cset :scm, :subversion
|
_cset :scm, scm_default
|
||||||
_cset :deploy_via, :checkout
|
_cset :deploy_via, :checkout
|
||||||
|
|
||||||
_cset(:deploy_to) { "/u/apps/#{application}" }
|
_cset(:deploy_to) { "/u/apps/#{application}" }
|
||||||
|
@ -80,6 +80,33 @@ _cset(:latest_release) { exists?(:deploy_timestamped) ? release_path : current_r
|
||||||
# These are helper methods that will be available to your recipes.
|
# These are helper methods that will be available to your recipes.
|
||||||
# =========================================================================
|
# =========================================================================
|
||||||
|
|
||||||
|
# Checks known version control directories to intelligently set the version
|
||||||
|
# control in-use. For example, if a .svn directory exists in the project,
|
||||||
|
# it will set the :scm variable to :subversion, if a .git directory exists
|
||||||
|
# in the project, it will set the :scm variable to :git and so on. If no
|
||||||
|
# directory is found, it will default to :git.
|
||||||
|
def scm_default
|
||||||
|
if File.exist? '.git'
|
||||||
|
:git
|
||||||
|
elsif File.exist? '.accurev'
|
||||||
|
:accurev
|
||||||
|
elsif File.exist? '.bzr'
|
||||||
|
:bzr
|
||||||
|
elsif File.exist? '.cvs'
|
||||||
|
:cvs
|
||||||
|
elsif File.exist? '_darcs'
|
||||||
|
:darcs
|
||||||
|
elsif File.exist? '.hg'
|
||||||
|
:mercurial
|
||||||
|
elsif File.exist? '.perforce'
|
||||||
|
:perforce
|
||||||
|
elsif File.exist? '.svn'
|
||||||
|
:subversion
|
||||||
|
else
|
||||||
|
:none
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Auxiliary helper method for the `deploy:check' task. Lets you set up your
|
# Auxiliary helper method for the `deploy:check' task. Lets you set up your
|
||||||
# own dependencies.
|
# own dependencies.
|
||||||
def depend(location, type, *args)
|
def depend(location, type, *args)
|
||||||
|
|
Loading…
Reference in a new issue