Sha256: c91366789c49d3f4c961102729311934ce865c22bf56a8e1ce5d6d7e6b5b3360

Contents?: true

Size: 967 Bytes

Versions: 6

Compression:

Stored size: 967 Bytes

Contents

load File.expand_path("../tasks/hg.rake", __FILE__)

require 'capistrano/scm'

class Capistrano::Hg < Capistrano::SCM
  # execute hg in context with arguments
  def hg(*args)
    args.unshift(:hg)
    context.execute *args
  end

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

    def check
      hg "id", repo_url
    end

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

    def update
      hg "pull"
    end

    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

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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
capistrano-3.4.1 lib/capistrano/hg.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/capistrano-3.4.0/lib/capistrano/hg.rb
capistrano-3.4.0 lib/capistrano/hg.rb
capistrano-3.3.5 lib/capistrano/hg.rb
capistrano-3.3.4 lib/capistrano/hg.rb
capistrano-3.3.3 lib/capistrano/hg.rb