Class: Capistrano::SCM::Hg
- Defined in:
- lib/capistrano/scm/hg.rb
Instance Method Summary collapse
- #archive_to_release_path ⇒ Object
- #check_repo_is_reachable ⇒ Object
- #clone_repo ⇒ Object
- #define_tasks ⇒ Object
- #fetch_revision ⇒ Object
- #hg(*args) ⇒ Object
- #register_hooks ⇒ Object
- #repo_mirror_exists? ⇒ Boolean
- #update_mirror ⇒ Object
Methods inherited from Plugin
Instance Method Details
#archive_to_release_path ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/capistrano/scm/hg.rb', line 36 def archive_to_release_path if (tree = fetch(:repo_tree)) tree = tree.slice %r#^/?(.*?)/?$#, 1 components = tree.split("/").size temp_tar = "#{fetch(:tmp_dir)}/#{SecureRandom.hex(10)}.tar" hg "archive -p . -I", tree, "--rev", fetch(:branch), temp_tar backend.execute :mkdir, "-p", release_path backend.execute :tar, "-x --strip-components #{components} -f", temp_tar, "-C", release_path backend.execute :rm, temp_tar else hg "archive", release_path, "--rev", fetch(:branch) end end |
#check_repo_is_reachable ⇒ Object
24 25 26 |
# File 'lib/capistrano/scm/hg.rb', line 24 def check_repo_is_reachable hg "id", repo_url end |
#clone_repo ⇒ Object
28 29 30 |
# File 'lib/capistrano/scm/hg.rb', line 28 def clone_repo hg "clone", "--noupdate", repo_url, repo_path.to_s end |
#define_tasks ⇒ Object
11 12 13 |
# File 'lib/capistrano/scm/hg.rb', line 11 def define_tasks eval_rakefile File.("../tasks/hg.rake", __FILE__) end |
#fetch_revision ⇒ Object
52 53 54 |
# File 'lib/capistrano/scm/hg.rb', line 52 def fetch_revision backend.capture(:hg, "log --rev #{fetch(:branch)} --template \"{node}\n\"") end |
#hg(*args) ⇒ Object
15 16 17 18 |
# File 'lib/capistrano/scm/hg.rb', line 15 def hg(*args) args.unshift(:hg) backend.execute(*args) end |
#register_hooks ⇒ Object
5 6 7 8 9 |
# File 'lib/capistrano/scm/hg.rb', line 5 def register_hooks after "deploy:new_release_path", "hg:create_release" before "deploy:check", "hg:check" before "deploy:set_current_revision", "hg:set_current_revision" end |
#repo_mirror_exists? ⇒ Boolean
20 21 22 |
# File 'lib/capistrano/scm/hg.rb', line 20 def repo_mirror_exists? backend.test " [ -d #{repo_path}/.hg ] " end |
#update_mirror ⇒ Object
32 33 34 |
# File 'lib/capistrano/scm/hg.rb', line 32 def update_mirror hg "pull" end |