mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Merging out some changes we applied here, which were already merged into Net:SSH
This commit is contained in:
parent
731034d864
commit
b96507cbf6
4 changed files with 2 additions and 61 deletions
|
@ -1,9 +1,3 @@
|
||||||
== 2.5.10 / 25 October 2009
|
|
||||||
|
|
||||||
* Fixes Darcs remote repository problem when using the copy strategy [Alex `regularfry` Young]
|
|
||||||
* Allows the specification of :copy_via for use by the copy strategy [Emily `duien` Price]
|
|
||||||
* Documentation improvements for embedding Capistrano [Lee Hambley]
|
|
||||||
|
|
||||||
== 2.5.9 / 1 August 2009
|
== 2.5.9 / 1 August 2009
|
||||||
|
|
||||||
* Adds support for customizing which `tar` command to use. [Jeremy Wells]
|
* Adds support for customizing which `tar` command to use. [Jeremy Wells]
|
||||||
|
|
|
@ -18,22 +18,11 @@ module Capistrano
|
||||||
:head
|
:head
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_match(revision)
|
|
||||||
if revision.nil? || revision == self.head
|
|
||||||
nil
|
|
||||||
else
|
|
||||||
"--to-match='hash #{revision}'"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns the command that will check out the given revision to the
|
# Returns the command that will check out the given revision to the
|
||||||
# given destination. The 'revision' parameter must be the 'hash' value
|
# given destination. The 'revision' parameter must be the 'hash' value
|
||||||
# for the revision in question, as given by 'darcs changes --xml-output'.
|
# for the revision in question, as given by 'darcs changes --xml-output'.
|
||||||
def checkout(revision, destination)
|
def checkout(revision, destination)
|
||||||
scm :get, *[verbose,
|
scm :get, verbose, "--repo-name=#{destination}", "--to-match='hash #{revision}'", repository
|
||||||
"--repo-name=#{destination}",
|
|
||||||
to_match(revision),
|
|
||||||
repository].compact
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Tries to update the destination repository in-place, to bring it up
|
# Tries to update the destination repository in-place, to bring it up
|
||||||
|
|
|
@ -38,10 +38,6 @@ module Capistrano
|
||||||
# :copy_compression, which must be one of :gzip, :bz2, or
|
# :copy_compression, which must be one of :gzip, :bz2, or
|
||||||
# :zip, and which specifies how the source should be compressed for
|
# :zip, and which specifies how the source should be compressed for
|
||||||
# transmission to each host.
|
# transmission to each host.
|
||||||
#
|
|
||||||
# It also supports the variable :copy_via, which must be one of :sftp or
|
|
||||||
# :scp, and which specifies the method used to transfer the compressed
|
|
||||||
# code to the remote server. It defaults to :sftp.
|
|
||||||
class Copy < Base
|
class Copy < Base
|
||||||
# Obtains a copy of the source code locally (via the #command method),
|
# Obtains a copy of the source code locally (via the #command method),
|
||||||
# compresses it to a single file, copies that file to all target
|
# compresses it to a single file, copies that file to all target
|
||||||
|
@ -100,8 +96,7 @@ module Capistrano
|
||||||
logger.trace "compressing #{destination} to #{filename}"
|
logger.trace "compressing #{destination} to #{filename}"
|
||||||
Dir.chdir(tmpdir) { system(compress(File.basename(destination), File.basename(filename)).join(" ")) }
|
Dir.chdir(tmpdir) { system(compress(File.basename(destination), File.basename(filename)).join(" ")) }
|
||||||
|
|
||||||
upload(filename, remote_filename, {:via => configuration[:copy_via]})
|
upload(filename, remote_filename)
|
||||||
# FIXED Allow specifying transfer mode
|
|
||||||
run "cd #{configuration[:releases_path]} && #{decompress(remote_filename).join(" ")} && rm #{remote_filename}"
|
run "cd #{configuration[:releases_path]} && #{decompress(remote_filename).join(" ")} && rm #{remote_filename}"
|
||||||
ensure
|
ensure
|
||||||
FileUtils.rm filename rescue nil
|
FileUtils.rm filename rescue nil
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
require "utils"
|
|
||||||
require 'capistrano/recipes/deploy/scm/darcs'
|
|
||||||
|
|
||||||
class DeploySCMDarcsTest < Test::Unit::TestCase
|
|
||||||
class TestSCM < Capistrano::Deploy::SCM::Darcs
|
|
||||||
default_command "darcs"
|
|
||||||
end
|
|
||||||
def setup
|
|
||||||
@config = { :repository => "." }
|
|
||||||
# def @config.exists?(name); key?(name); end
|
|
||||||
|
|
||||||
@source = TestSCM.new(@config)
|
|
||||||
end
|
|
||||||
|
|
||||||
# We should be able to pick a specific hash.
|
|
||||||
def test_checkout_hash
|
|
||||||
hsh = "*version_hash*"
|
|
||||||
assert_match(%r{--to-match=.hash #{Regexp.quote(hsh)}},
|
|
||||||
@source.checkout(hsh, "*foo_location*"),
|
|
||||||
"Specifying a revision hash got the --to-match option wrong.")
|
|
||||||
end
|
|
||||||
|
|
||||||
# Picking the head revision should leave out the hash, because head is the
|
|
||||||
# default and we don't have a HEAD pseudotag
|
|
||||||
def test_checkout_head
|
|
||||||
hsh = @source.head
|
|
||||||
assert_no_match(%r{--to-match}, @source.checkout(hsh, "*foo_location*"),
|
|
||||||
"Selecting the head revision incorrectly produced a --to-match option.")
|
|
||||||
end
|
|
||||||
|
|
||||||
# Leaving the revision as nil shouldn't break anything.
|
|
||||||
def test_checkout_nil
|
|
||||||
assert_no_match(%r{--to-match}, @source.checkout(nil, "*foo_location*"),
|
|
||||||
"Leaving the revision as nil incorrectly produced a --to-match option.")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
Loading…
Reference in a new issue