Module: Capistrano::Hg::DefaultStrategy

Defined in:
lib/capistrano/hg.rb

Instance Method Summary collapse

Instance Method Details

#checkObject



17
18
19
# File 'lib/capistrano/hg.rb', line 17

def check
  hg "id", repo_url
end

#cloneObject



21
22
23
# File 'lib/capistrano/hg.rb', line 21

def clone
  hg "clone", "--noupdate", repo_url, repo_path
end

#fetch_revisionObject



39
40
41
# File 'lib/capistrano/hg.rb', line 39

def fetch_revision
  context.capture(:hg, "log --rev #{fetch(:branch)} --template \"{node}\n\"")
end

#releaseObject



29
30
31
32
33
34
35
36
37
# File 'lib/capistrano/hg.rb', line 29

def release
  if tree = fetch(:repo_tree)
    tree = tree.slice %r#^/?(.*?)/?$#, 1
    components = tree.split('/').size
    hg "archive --type tgz -p . -I", tree, "--rev", fetch(:branch), "| tar -x --strip-components #{components} -f - -C", release_path
  else
    hg "archive", release_path, "--rev", fetch(:branch)
  end
end

#testObject



13
14
15
# File 'lib/capistrano/hg.rb', line 13

def test
  test! " [ -d #{repo_path}/.hg ] "
end

#updateObject



25
26
27
# File 'lib/capistrano/hg.rb', line 25

def update
  hg "pull"
end