mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Use more intelligence in setting the :scm variable based on known version control directory names
This commit is contained in:
parent
e82de1c6be
commit
26490e97f3
2 changed files with 29 additions and 2 deletions
|
@ -51,7 +51,7 @@ files = {
|
|||
"config/deploy.rb" => 'set :application, "set your application name 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`
|
||||
|
||||
role :web, "your web-server here" # Your HTTP server, Apache/etc
|
||||
|
|
|
@ -22,7 +22,7 @@ _cset(:repository) { abort "Please specify the repository that houses your appl
|
|||
# are not sufficient.
|
||||
# =========================================================================
|
||||
|
||||
_cset :scm, :subversion
|
||||
_cset :scm, scm_default
|
||||
_cset :deploy_via, :checkout
|
||||
|
||||
_cset(:deploy_to) { "/u/apps/#{application}" }
|
||||
|
@ -79,6 +79,33 @@ _cset(:latest_release) { exists?(:deploy_timestamped) ? release_path : current_r
|
|||
# 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
|
||||
# own dependencies.
|
||||
def depend(location, type, *args)
|
||||
|
|
Loading…
Reference in a new issue