capistrano 2.8.0 → 3.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.docker/Dockerfile +7 -0
- data/.docker/ssh_key_rsa +49 -0
- data/.docker/ssh_key_rsa.pub +1 -0
- data/.docker/ubuntu_setup.sh +23 -0
- data/.github/issue_template.md +19 -0
- data/.github/pull_request_template.md +22 -0
- data/.github/release-drafter.yml +25 -0
- data/.github/workflows/ci.yml +80 -0
- data/.github/workflows/release-drafter.yml +18 -0
- data/.gitignore +23 -8
- data/.rubocop.yml +62 -0
- data/CHANGELOG.md +1 -0
- data/CONTRIBUTING.md +63 -0
- data/DEVELOPMENT.md +112 -0
- data/Gemfile +42 -9
- data/LICENSE.txt +21 -0
- data/README.md +221 -0
- data/RELEASING.md +17 -0
- data/Rakefile +17 -8
- data/UPGRADING-3.7.md +86 -0
- data/bin/cap +2 -3
- data/bin/capify +7 -89
- data/capistrano.gemspec +29 -43
- data/docker-compose.yml +8 -0
- data/features/configuration.feature +28 -0
- data/features/deploy.feature +92 -0
- data/features/deploy_failure.feature +17 -0
- data/features/doctor.feature +11 -0
- data/features/installation.feature +21 -0
- data/features/sshconnect.feature +11 -0
- data/features/stage_failure.feature +9 -0
- data/features/step_definitions/assertions.rb +162 -0
- data/features/step_definitions/cap_commands.rb +21 -0
- data/features/step_definitions/setup.rb +91 -0
- data/features/subdirectory.feature +9 -0
- data/features/support/docker_gateway.rb +53 -0
- data/features/support/env.rb +1 -0
- data/features/support/remote_command_helpers.rb +29 -0
- data/features/support/remote_ssh_helpers.rb +33 -0
- data/lib/Capfile +3 -0
- data/lib/capistrano/all.rb +17 -0
- data/lib/capistrano/application.rb +153 -0
- data/lib/capistrano/configuration/empty_filter.rb +9 -0
- data/lib/capistrano/configuration/filter.rb +26 -0
- data/lib/capistrano/configuration/host_filter.rb +29 -0
- data/lib/capistrano/configuration/null_filter.rb +9 -0
- data/lib/capistrano/configuration/plugin_installer.rb +51 -0
- data/lib/capistrano/configuration/question.rb +76 -0
- data/lib/capistrano/configuration/role_filter.rb +29 -0
- data/lib/capistrano/configuration/scm_resolver.rb +149 -0
- data/lib/capistrano/configuration/server.rb +137 -0
- data/lib/capistrano/configuration/servers.rb +56 -96
- data/lib/capistrano/configuration/validated_variables.rb +110 -0
- data/lib/capistrano/configuration/variables.rb +79 -94
- data/lib/capistrano/configuration.rb +178 -33
- data/lib/capistrano/console.rb +1 -0
- data/lib/capistrano/defaults.rb +36 -0
- data/lib/capistrano/deploy.rb +3 -0
- data/lib/capistrano/doctor/environment_doctor.rb +19 -0
- data/lib/capistrano/doctor/gems_doctor.rb +45 -0
- data/lib/capistrano/doctor/output_helpers.rb +79 -0
- data/lib/capistrano/doctor/servers_doctor.rb +105 -0
- data/lib/capistrano/doctor/variables_doctor.rb +74 -0
- data/lib/capistrano/doctor.rb +6 -0
- data/lib/capistrano/dotfile.rb +2 -0
- data/lib/capistrano/dsl/env.rb +43 -0
- data/lib/capistrano/dsl/paths.rb +89 -0
- data/lib/capistrano/dsl/stages.rb +31 -0
- data/lib/capistrano/dsl/task_enhancements.rb +61 -0
- data/lib/capistrano/dsl.rb +95 -0
- data/lib/capistrano/framework.rb +2 -0
- data/lib/capistrano/i18n.rb +46 -0
- data/lib/capistrano/immutable_task.rb +30 -0
- data/lib/capistrano/install.rb +1 -0
- data/lib/capistrano/plugin.rb +95 -0
- data/lib/capistrano/proc_helpers.rb +13 -0
- data/lib/capistrano/scm/git.rb +105 -0
- data/lib/capistrano/scm/hg.rb +55 -0
- data/lib/capistrano/scm/plugin.rb +13 -0
- data/lib/capistrano/scm/svn.rb +56 -0
- data/lib/capistrano/scm/tasks/git.rake +84 -0
- data/lib/capistrano/scm/tasks/hg.rake +53 -0
- data/lib/capistrano/scm/tasks/svn.rake +53 -0
- data/lib/capistrano/scm.rb +115 -0
- data/lib/capistrano/setup.rb +36 -0
- data/lib/capistrano/tasks/console.rake +25 -0
- data/lib/capistrano/tasks/deploy.rake +280 -0
- data/lib/capistrano/tasks/doctor.rake +24 -0
- data/lib/capistrano/tasks/framework.rake +67 -0
- data/lib/capistrano/tasks/install.rake +41 -0
- data/lib/capistrano/templates/Capfile +38 -0
- data/lib/capistrano/templates/deploy.rb.erb +39 -0
- data/lib/capistrano/templates/stage.rb.erb +61 -0
- data/lib/capistrano/upload_task.rb +9 -0
- data/lib/capistrano/version.rb +1 -14
- data/lib/capistrano/version_validator.rb +32 -0
- data/lib/capistrano.rb +0 -3
- data/spec/integration/dsl_spec.rb +632 -0
- data/spec/integration_spec_helper.rb +5 -0
- data/spec/lib/capistrano/application_spec.rb +60 -0
- data/spec/lib/capistrano/configuration/empty_filter_spec.rb +17 -0
- data/spec/lib/capistrano/configuration/filter_spec.rb +109 -0
- data/spec/lib/capistrano/configuration/host_filter_spec.rb +71 -0
- data/spec/lib/capistrano/configuration/null_filter_spec.rb +17 -0
- data/spec/lib/capistrano/configuration/plugin_installer_spec.rb +98 -0
- data/spec/lib/capistrano/configuration/question_spec.rb +92 -0
- data/spec/lib/capistrano/configuration/role_filter_spec.rb +80 -0
- data/spec/lib/capistrano/configuration/scm_resolver_spec.rb +56 -0
- data/spec/lib/capistrano/configuration/server_spec.rb +309 -0
- data/spec/lib/capistrano/configuration/servers_spec.rb +331 -0
- data/spec/lib/capistrano/configuration_spec.rb +357 -0
- data/spec/lib/capistrano/doctor/environment_doctor_spec.rb +44 -0
- data/spec/lib/capistrano/doctor/gems_doctor_spec.rb +67 -0
- data/spec/lib/capistrano/doctor/output_helpers_spec.rb +47 -0
- data/spec/lib/capistrano/doctor/servers_doctor_spec.rb +86 -0
- data/spec/lib/capistrano/doctor/variables_doctor_spec.rb +89 -0
- data/spec/lib/capistrano/dsl/paths_spec.rb +228 -0
- data/spec/lib/capistrano/dsl/task_enhancements_spec.rb +108 -0
- data/spec/lib/capistrano/dsl_spec.rb +125 -0
- data/spec/lib/capistrano/immutable_task_spec.rb +31 -0
- data/spec/lib/capistrano/plugin_spec.rb +84 -0
- data/spec/lib/capistrano/scm/git_spec.rb +194 -0
- data/spec/lib/capistrano/scm/hg_spec.rb +109 -0
- data/spec/lib/capistrano/scm/svn_spec.rb +137 -0
- data/spec/lib/capistrano/scm_spec.rb +103 -0
- data/spec/lib/capistrano/upload_task_spec.rb +19 -0
- data/spec/lib/capistrano/version_validator_spec.rb +118 -0
- data/spec/lib/capistrano_spec.rb +7 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/support/matchers.rb +5 -0
- data/spec/support/tasks/database.rake +11 -0
- data/spec/support/tasks/fail.rake +8 -0
- data/spec/support/tasks/failed.rake +5 -0
- data/spec/support/tasks/plugin.rake +6 -0
- data/spec/support/tasks/root.rake +11 -0
- data/spec/support/test_app.rb +205 -0
- metadata +234 -208
- data/.rvmrc +0 -1
- data/CHANGELOG +0 -954
- data/README.mdown +0 -76
- data/lib/capistrano/callback.rb +0 -45
- data/lib/capistrano/cli/execute.rb +0 -85
- data/lib/capistrano/cli/help.rb +0 -125
- data/lib/capistrano/cli/help.txt +0 -81
- data/lib/capistrano/cli/options.rb +0 -243
- data/lib/capistrano/cli/ui.rb +0 -40
- data/lib/capistrano/cli.rb +0 -47
- data/lib/capistrano/command.rb +0 -286
- data/lib/capistrano/configuration/actions/file_transfer.rb +0 -51
- data/lib/capistrano/configuration/actions/inspect.rb +0 -46
- data/lib/capistrano/configuration/actions/invocation.rb +0 -298
- data/lib/capistrano/configuration/callbacks.rb +0 -148
- data/lib/capistrano/configuration/connections.rb +0 -230
- data/lib/capistrano/configuration/execution.rb +0 -143
- data/lib/capistrano/configuration/loading.rb +0 -197
- data/lib/capistrano/configuration/namespaces.rb +0 -197
- data/lib/capistrano/configuration/roles.rb +0 -73
- data/lib/capistrano/errors.rb +0 -19
- data/lib/capistrano/ext/string.rb +0 -5
- data/lib/capistrano/extensions.rb +0 -57
- data/lib/capistrano/logger.rb +0 -59
- data/lib/capistrano/processable.rb +0 -53
- data/lib/capistrano/recipes/compat.rb +0 -32
- data/lib/capistrano/recipes/deploy/assets.rb +0 -57
- data/lib/capistrano/recipes/deploy/dependencies.rb +0 -44
- data/lib/capistrano/recipes/deploy/local_dependency.rb +0 -54
- data/lib/capistrano/recipes/deploy/remote_dependency.rb +0 -111
- data/lib/capistrano/recipes/deploy/scm/accurev.rb +0 -169
- data/lib/capistrano/recipes/deploy/scm/base.rb +0 -196
- data/lib/capistrano/recipes/deploy/scm/bzr.rb +0 -86
- data/lib/capistrano/recipes/deploy/scm/cvs.rb +0 -153
- data/lib/capistrano/recipes/deploy/scm/darcs.rb +0 -96
- data/lib/capistrano/recipes/deploy/scm/git.rb +0 -282
- data/lib/capistrano/recipes/deploy/scm/mercurial.rb +0 -137
- data/lib/capistrano/recipes/deploy/scm/none.rb +0 -44
- data/lib/capistrano/recipes/deploy/scm/perforce.rb +0 -138
- data/lib/capistrano/recipes/deploy/scm/subversion.rb +0 -121
- data/lib/capistrano/recipes/deploy/scm.rb +0 -19
- data/lib/capistrano/recipes/deploy/strategy/base.rb +0 -88
- data/lib/capistrano/recipes/deploy/strategy/checkout.rb +0 -20
- data/lib/capistrano/recipes/deploy/strategy/copy.rb +0 -224
- data/lib/capistrano/recipes/deploy/strategy/export.rb +0 -20
- data/lib/capistrano/recipes/deploy/strategy/remote.rb +0 -52
- data/lib/capistrano/recipes/deploy/strategy/remote_cache.rb +0 -57
- data/lib/capistrano/recipes/deploy/strategy.rb +0 -19
- data/lib/capistrano/recipes/deploy/templates/maintenance.rhtml +0 -53
- data/lib/capistrano/recipes/deploy.rb +0 -568
- data/lib/capistrano/recipes/standard.rb +0 -37
- data/lib/capistrano/recipes/templates/maintenance.rhtml +0 -53
- data/lib/capistrano/role.rb +0 -102
- data/lib/capistrano/server_definition.rb +0 -56
- data/lib/capistrano/shell.rb +0 -260
- data/lib/capistrano/ssh.rb +0 -101
- data/lib/capistrano/task_definition.rb +0 -75
- data/lib/capistrano/transfer.rb +0 -216
- data/rvmrc.sample +0 -1
- data/test/cli/execute_test.rb +0 -132
- data/test/cli/help_test.rb +0 -165
- data/test/cli/options_test.rb +0 -329
- data/test/cli/ui_test.rb +0 -28
- data/test/cli_test.rb +0 -17
- data/test/command_test.rb +0 -289
- data/test/configuration/actions/file_transfer_test.rb +0 -61
- data/test/configuration/actions/inspect_test.rb +0 -65
- data/test/configuration/actions/invocation_test.rb +0 -247
- data/test/configuration/callbacks_test.rb +0 -220
- data/test/configuration/connections_test.rb +0 -420
- data/test/configuration/execution_test.rb +0 -175
- data/test/configuration/loading_test.rb +0 -132
- data/test/configuration/namespace_dsl_test.rb +0 -311
- data/test/configuration/roles_test.rb +0 -144
- data/test/configuration/servers_test.rb +0 -183
- data/test/configuration/variables_test.rb +0 -190
- data/test/configuration_test.rb +0 -88
- data/test/deploy/local_dependency_test.rb +0 -76
- data/test/deploy/remote_dependency_test.rb +0 -135
- data/test/deploy/scm/accurev_test.rb +0 -23
- data/test/deploy/scm/base_test.rb +0 -55
- data/test/deploy/scm/bzr_test.rb +0 -51
- data/test/deploy/scm/darcs_test.rb +0 -37
- data/test/deploy/scm/git_test.rb +0 -184
- data/test/deploy/scm/mercurial_test.rb +0 -134
- data/test/deploy/scm/none_test.rb +0 -35
- data/test/deploy/scm/subversion_test.rb +0 -32
- data/test/deploy/strategy/copy_test.rb +0 -321
- data/test/extensions_test.rb +0 -69
- data/test/fixtures/cli_integration.rb +0 -5
- data/test/fixtures/config.rb +0 -5
- data/test/fixtures/custom.rb +0 -3
- data/test/logger_test.rb +0 -123
- data/test/recipes_test.rb +0 -25
- data/test/role_test.rb +0 -11
- data/test/server_definition_test.rb +0 -121
- data/test/shell_test.rb +0 -90
- data/test/ssh_test.rb +0 -113
- data/test/task_definition_test.rb +0 -116
- data/test/transfer_test.rb +0 -160
- data/test/utils.rb +0 -37
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
require "utils"
|
|
2
|
-
require 'capistrano/recipes/deploy/scm/base'
|
|
3
|
-
|
|
4
|
-
class DeploySCMBaseTest < Test::Unit::TestCase
|
|
5
|
-
class TestSCM < Capistrano::Deploy::SCM::Base
|
|
6
|
-
default_command "floopy"
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def setup
|
|
10
|
-
@config = { }
|
|
11
|
-
def @config.exists?(name); key?(name); end
|
|
12
|
-
|
|
13
|
-
@source = TestSCM.new(@config)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def test_command_should_default_to_default_command
|
|
17
|
-
assert_equal "floopy", @source.command
|
|
18
|
-
@source.local { assert_equal "floopy", @source.command }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def test_command_should_use_scm_command_if_available
|
|
22
|
-
@config[:scm_command] = "/opt/local/bin/floopy"
|
|
23
|
-
assert_equal "/opt/local/bin/floopy", @source.command
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def test_command_should_use_scm_command_in_local_mode_if_local_scm_command_not_set
|
|
27
|
-
@config[:scm_command] = "/opt/local/bin/floopy"
|
|
28
|
-
@source.local { assert_equal "/opt/local/bin/floopy", @source.command }
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_command_should_use_local_scm_command_in_local_mode_if_local_scm_command_is_set
|
|
32
|
-
@config[:scm_command] = "/opt/local/bin/floopy"
|
|
33
|
-
@config[:local_scm_command] = "/usr/local/bin/floopy"
|
|
34
|
-
assert_equal "/opt/local/bin/floopy", @source.command
|
|
35
|
-
@source.local { assert_equal "/usr/local/bin/floopy", @source.command }
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def test_command_should_use_default_if_scm_command_is_default
|
|
39
|
-
@config[:scm_command] = :default
|
|
40
|
-
assert_equal "floopy", @source.command
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def test_command_should_use_default_in_local_mode_if_local_scm_command_is_default
|
|
44
|
-
@config[:scm_command] = "/foo/bar/floopy"
|
|
45
|
-
@config[:local_scm_command] = :default
|
|
46
|
-
@source.local { assert_equal "floopy", @source.command }
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def test_local_mode_proxy_should_treat_messages_as_being_in_local_mode
|
|
50
|
-
@config[:scm_command] = "/foo/bar/floopy"
|
|
51
|
-
@config[:local_scm_command] = :default
|
|
52
|
-
assert_equal "floopy", @source.local.command
|
|
53
|
-
assert_equal "/foo/bar/floopy", @source.command
|
|
54
|
-
end
|
|
55
|
-
end
|
data/test/deploy/scm/bzr_test.rb
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
require "utils"
|
|
2
|
-
require 'capistrano/recipes/deploy/scm/bzr'
|
|
3
|
-
|
|
4
|
-
class DeploySCMBzrTest < Test::Unit::TestCase
|
|
5
|
-
class TestSCM < Capistrano::Deploy::SCM::Bzr
|
|
6
|
-
default_command "bzr"
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def setup
|
|
10
|
-
@config = { :repository => "." }
|
|
11
|
-
|
|
12
|
-
def @config.exists?(name); key?(name); end # is this actually needed?
|
|
13
|
-
|
|
14
|
-
@source = TestSCM.new(@config)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# The bzr scm does not support pseudo-ids. The bzr adapter uses symbol :head
|
|
18
|
-
# to refer to the recently committed revision.
|
|
19
|
-
def test_head_revision
|
|
20
|
-
assert_equal(:head,
|
|
21
|
-
@source.head,
|
|
22
|
-
"Since bzr doesn't know a real head revision, symbol :head is used instead.")
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# The bzr scm does support many different ways to specify a revision. Only
|
|
26
|
-
# symbol :head triggers the bzr command 'revno'.
|
|
27
|
-
def test_query_revision
|
|
28
|
-
assert_equal("bzr revno #{@config[:repository]}",
|
|
29
|
-
@source.query_revision(:head) { |o| o },
|
|
30
|
-
"Query for :head revision should call bzr command 'revno' in repository directory.")
|
|
31
|
-
|
|
32
|
-
# Many valid revision specifications, some invalid on the last line
|
|
33
|
-
revision_samples = [ 5, -7, '2', '-4',
|
|
34
|
-
'revid:revid:aaaa@bbbb-123456789',
|
|
35
|
-
'submit:',
|
|
36
|
-
'ancestor:/path/to/branch',
|
|
37
|
-
'date:yesterday',
|
|
38
|
-
'branch:/path/to/branch',
|
|
39
|
-
'tag:trunk',
|
|
40
|
-
'revno:3:/path/to/branch',
|
|
41
|
-
'before:revid:aaaa@bbbb-1234567890',
|
|
42
|
-
'last:3',
|
|
43
|
-
nil, {}, [], true, false, 1.34, ]
|
|
44
|
-
|
|
45
|
-
revision_samples.each do |revivsion_spec|
|
|
46
|
-
assert_equal(revivsion_spec,
|
|
47
|
-
@source.query_revision(revivsion_spec),
|
|
48
|
-
"Any revision specification other than symbol :head should simply by returned.")
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require "utils"
|
|
2
|
-
require 'capistrano/recipes/deploy/scm/darcs'
|
|
3
|
-
|
|
4
|
-
class DeploySCMDarcsTest < Test::Unit::TestCase
|
|
5
|
-
class TestSCM < Capistrano::Deploy::SCM::Darcs
|
|
6
|
-
default_command "darcs"
|
|
7
|
-
end
|
|
8
|
-
def setup
|
|
9
|
-
@config = { :repository => "." }
|
|
10
|
-
# def @config.exists?(name); key?(name); end
|
|
11
|
-
|
|
12
|
-
@source = TestSCM.new(@config)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
# We should be able to pick a specific hash.
|
|
16
|
-
def test_checkout_hash
|
|
17
|
-
hsh = "*version_hash*"
|
|
18
|
-
assert_match(%r{--to-match=.hash #{Regexp.quote(hsh)}},
|
|
19
|
-
@source.checkout(hsh, "*foo_location*"),
|
|
20
|
-
"Specifying a revision hash got the --to-match option wrong.")
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# Picking the head revision should leave out the hash, because head is the
|
|
24
|
-
# default and we don't have a HEAD pseudotag
|
|
25
|
-
def test_checkout_head
|
|
26
|
-
hsh = @source.head
|
|
27
|
-
assert_no_match(%r{--to-match}, @source.checkout(hsh, "*foo_location*"),
|
|
28
|
-
"Selecting the head revision incorrectly produced a --to-match option.")
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Leaving the revision as nil shouldn't break anything.
|
|
32
|
-
def test_checkout_nil
|
|
33
|
-
assert_no_match(%r{--to-match}, @source.checkout(nil, "*foo_location*"),
|
|
34
|
-
"Leaving the revision as nil incorrectly produced a --to-match option.")
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
data/test/deploy/scm/git_test.rb
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
require "utils"
|
|
2
|
-
require 'capistrano/recipes/deploy/scm/git'
|
|
3
|
-
|
|
4
|
-
class DeploySCMGitTest < Test::Unit::TestCase
|
|
5
|
-
class TestSCM < Capistrano::Deploy::SCM::Git
|
|
6
|
-
default_command "git"
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def setup
|
|
10
|
-
@config = { :repository => "." }
|
|
11
|
-
def @config.exists?(name); key?(name); end
|
|
12
|
-
|
|
13
|
-
@source = TestSCM.new(@config)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def test_head
|
|
17
|
-
assert_equal "HEAD", @source.head
|
|
18
|
-
|
|
19
|
-
# With :branch
|
|
20
|
-
@config[:branch] = "master"
|
|
21
|
-
assert_equal "master", @source.head
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def test_origin
|
|
25
|
-
assert_equal "origin", @source.origin
|
|
26
|
-
@config[:remote] = "username"
|
|
27
|
-
assert_equal "username", @source.origin
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def test_checkout
|
|
31
|
-
@config[:repository] = "git@somehost.com:project.git"
|
|
32
|
-
dest = "/var/www"
|
|
33
|
-
rev = 'c2d9e79'
|
|
34
|
-
assert_equal "git clone -q git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy #{rev}", @source.checkout(rev, dest)
|
|
35
|
-
|
|
36
|
-
# With :scm_command
|
|
37
|
-
git = "/opt/local/bin/git"
|
|
38
|
-
@config[:scm_command] = git
|
|
39
|
-
assert_equal "#{git} clone -q git@somehost.com:project.git /var/www && cd /var/www && #{git} checkout -q -b deploy #{rev}", @source.checkout(rev, dest).gsub(/\s+/, ' ')
|
|
40
|
-
|
|
41
|
-
# with submodules
|
|
42
|
-
@config[:git_enable_submodules] = true
|
|
43
|
-
assert_equal "#{git} clone -q git@somehost.com:project.git /var/www && cd /var/www && #{git} checkout -q -b deploy #{rev} && #{git} submodule -q init && #{git} submodule -q sync && #{git} submodule -q update --init --recursive", @source.checkout(rev, dest).gsub(/\s+/, ' ')
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def test_checkout_with_verbose_should_use_q_switch
|
|
47
|
-
@config[:repository] = "git@somehost.com:project.git"
|
|
48
|
-
@config[:scm_verbose] = true
|
|
49
|
-
dest = "/var/www"
|
|
50
|
-
rev = 'c2d9e79'
|
|
51
|
-
assert_equal "git clone -q git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy #{rev}", @source.checkout(rev, dest)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def test_diff
|
|
55
|
-
assert_equal "git diff master", @source.diff('master')
|
|
56
|
-
assert_equal "git diff master..branch", @source.diff('master', 'branch')
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def test_log
|
|
60
|
-
assert_equal "git log master..", @source.log('master')
|
|
61
|
-
assert_equal "git log master..branch", @source.log('master', 'branch')
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def test_query_revision
|
|
65
|
-
revision = @source.query_revision('HEAD') do |o|
|
|
66
|
-
assert_equal "git ls-remote . HEAD", o
|
|
67
|
-
"d11006102c07c94e5d54dd0ee63dca825c93ed61\tHEAD"
|
|
68
|
-
end
|
|
69
|
-
assert_equal "d11006102c07c94e5d54dd0ee63dca825c93ed61", revision
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def test_query_revision_has_whitespace
|
|
73
|
-
revision = @source.query_revision('HEAD') do |o|
|
|
74
|
-
assert_equal "git ls-remote . HEAD", o
|
|
75
|
-
"d11006102c07c94e5d54dd0ee63dca825c93ed61\tHEAD\r"
|
|
76
|
-
end
|
|
77
|
-
assert_equal "d11006102c07c94e5d54dd0ee63dca825c93ed61", revision
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def test_query_revision_deprecation_error
|
|
81
|
-
assert_raise(ArgumentError) do
|
|
82
|
-
revision = @source.query_revision('origin/release') {}
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def test_command_should_be_backwards_compatible
|
|
87
|
-
# 1.x version of this module used ":git", not ":scm_command"
|
|
88
|
-
@config[:git] = "/srv/bin/git"
|
|
89
|
-
assert_equal "/srv/bin/git", @source.command
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def test_sync
|
|
93
|
-
dest = "/var/www"
|
|
94
|
-
rev = 'c2d9e79'
|
|
95
|
-
assert_equal "cd #{dest} && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard #{rev} && git clean -q -d -x -f", @source.sync(rev, dest)
|
|
96
|
-
|
|
97
|
-
# With :scm_command
|
|
98
|
-
git = "/opt/local/bin/git"
|
|
99
|
-
@config[:scm_command] = git
|
|
100
|
-
assert_equal "cd #{dest} && #{git} fetch -q origin && #{git} fetch --tags -q origin && #{git} reset -q --hard #{rev} && #{git} clean -q -d -x -f", @source.sync(rev, dest)
|
|
101
|
-
|
|
102
|
-
# with submodules
|
|
103
|
-
@config[:git_enable_submodules] = true
|
|
104
|
-
assert_equal "cd #{dest} && #{git} fetch -q origin && #{git} fetch --tags -q origin && #{git} reset -q --hard #{rev} && #{git} submodule -q init && for mod in `#{git} submodule status | awk '{ print $2 }'`; do #{git} config -f .git/config submodule.${mod}.url `#{git} config -f .gitmodules --get submodule.${mod}.url` && echo Synced $mod; done && #{git} submodule -q sync && #{git} submodule -q update --init --recursive && #{git} clean -q -d -x -f", @source.sync(rev, dest)
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
def test_sync_with_remote
|
|
108
|
-
dest = "/var/www"
|
|
109
|
-
rev = 'c2d9e79'
|
|
110
|
-
remote = "username"
|
|
111
|
-
repository = "git@somehost.com:project.git"
|
|
112
|
-
|
|
113
|
-
@config[:repository] = repository
|
|
114
|
-
@config[:remote] = remote
|
|
115
|
-
|
|
116
|
-
assert_equal "cd #{dest} && git config remote.#{remote}.url #{repository} && git config remote.#{remote}.fetch +refs/heads/*:refs/remotes/#{remote}/* && git fetch -q #{remote} && git fetch --tags -q username && git reset -q --hard #{rev} && git clean -q -d -x -f", @source.sync(rev, dest)
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
def test_shallow_clone
|
|
120
|
-
@config[:repository] = "git@somehost.com:project.git"
|
|
121
|
-
@config[:git_shallow_clone] = 1
|
|
122
|
-
dest = "/var/www"
|
|
123
|
-
rev = 'c2d9e79'
|
|
124
|
-
assert_equal "git clone -q --depth 1 git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy #{rev}", @source.checkout(rev, dest)
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
def test_remote_clone
|
|
128
|
-
@config[:repository] = "git@somehost.com:project.git"
|
|
129
|
-
@config[:remote] = "username"
|
|
130
|
-
dest = "/var/www"
|
|
131
|
-
rev = 'c2d9e79'
|
|
132
|
-
assert_equal "git clone -q -o username git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy #{rev}", @source.checkout(rev, dest)
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
def test_remote_clone_with_submodules
|
|
136
|
-
@config[:repository] = "git@somehost.com:project.git"
|
|
137
|
-
@config[:remote] = "username"
|
|
138
|
-
@config[:git_enable_submodules] = true
|
|
139
|
-
dest = "/var/www"
|
|
140
|
-
rev = 'c2d9e79'
|
|
141
|
-
assert_equal "git clone -q -o username git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy #{rev} && git submodule -q init && git submodule -q sync && git submodule -q update --init --recursive", @source.checkout(rev, dest)
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
# Tests from base_test.rb, makin' sure we didn't break anything up there!
|
|
145
|
-
def test_command_should_default_to_default_command
|
|
146
|
-
assert_equal "git", @source.command
|
|
147
|
-
@source.local { assert_equal "git", @source.command }
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
def test_command_should_use_scm_command_if_available
|
|
151
|
-
@config[:scm_command] = "/opt/local/bin/git"
|
|
152
|
-
assert_equal "/opt/local/bin/git", @source.command
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
def test_command_should_use_scm_command_in_local_mode_if_local_scm_command_not_set
|
|
156
|
-
@config[:scm_command] = "/opt/local/bin/git"
|
|
157
|
-
@source.local { assert_equal "/opt/local/bin/git", @source.command }
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
def test_command_should_use_local_scm_command_in_local_mode_if_local_scm_command_is_set
|
|
161
|
-
@config[:scm_command] = "/opt/local/bin/git"
|
|
162
|
-
@config[:local_scm_command] = "/usr/local/bin/git"
|
|
163
|
-
assert_equal "/opt/local/bin/git", @source.command
|
|
164
|
-
@source.local { assert_equal "/usr/local/bin/git", @source.command }
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
def test_command_should_use_default_if_scm_command_is_default
|
|
168
|
-
@config[:scm_command] = :default
|
|
169
|
-
assert_equal "git", @source.command
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
def test_command_should_use_default_in_local_mode_if_local_scm_command_is_default
|
|
173
|
-
@config[:scm_command] = "/foo/bar/git"
|
|
174
|
-
@config[:local_scm_command] = :default
|
|
175
|
-
@source.local { assert_equal "git", @source.command }
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
def test_local_mode_proxy_should_treat_messages_as_being_in_local_mode
|
|
179
|
-
@config[:scm_command] = "/foo/bar/git"
|
|
180
|
-
@config[:local_scm_command] = :default
|
|
181
|
-
assert_equal "git", @source.local.command
|
|
182
|
-
assert_equal "/foo/bar/git", @source.command
|
|
183
|
-
end
|
|
184
|
-
end
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
require "utils"
|
|
2
|
-
require 'capistrano/recipes/deploy/scm/mercurial'
|
|
3
|
-
|
|
4
|
-
class DeploySCMMercurialTest < Test::Unit::TestCase
|
|
5
|
-
class TestSCM < Capistrano::Deploy::SCM::Mercurial
|
|
6
|
-
default_command "hg"
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def setup
|
|
10
|
-
@config = { }
|
|
11
|
-
def @config.exists?(name); key?(name); end
|
|
12
|
-
|
|
13
|
-
@source = TestSCM.new(@config)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def test_head
|
|
17
|
-
assert_equal "tip", @source.head
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def test_different_head
|
|
21
|
-
@config[:branch] = "staging"
|
|
22
|
-
assert_equal "staging", @source.head
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def test_checkout
|
|
26
|
-
@config[:repository] = "http://example.com/project-hg"
|
|
27
|
-
dest = "/var/www"
|
|
28
|
-
assert_equal "hg clone --noupdate http://example.com/project-hg /var/www && hg update --repository /var/www --clean 8a8e00b8f11b", @source.checkout('8a8e00b8f11b', dest)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_diff
|
|
32
|
-
assert_equal "hg diff --rev tip", @source.diff('tip')
|
|
33
|
-
assert_equal "hg diff --rev 1 --rev 2", @source.diff('1', '2')
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def test_log
|
|
37
|
-
assert_equal "hg log --rev 8a8e00b8f11b", @source.log('8a8e00b8f11b')
|
|
38
|
-
assert_equal "hg log --rev 0:3", @source.log('0', '3')
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def test_query_revision
|
|
42
|
-
assert_equal "hg log -r 8a8e00b8f11b --template '{node|short}'", @source.query_revision('8a8e00b8f11b') { |o| o }
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def test_username_should_be_backwards_compatible
|
|
46
|
-
# older versions of this module required :scm_user var instead
|
|
47
|
-
# of the currently preferred :scm_username
|
|
48
|
-
require 'capistrano/logger'
|
|
49
|
-
@config[:scm_user] = "fred"
|
|
50
|
-
text = "user:"
|
|
51
|
-
assert_equal "fred\n", @source.handle_data(mock_state, :test_stream, text)
|
|
52
|
-
# :scm_username takes priority
|
|
53
|
-
@config[:scm_username] = "wilma"
|
|
54
|
-
assert_equal "wilma\n", @source.handle_data(mock_state, :test_stream, text)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def test_sync
|
|
58
|
-
dest = "/var/www"
|
|
59
|
-
assert_equal "hg pull --repository /var/www && hg update --repository /var/www --clean 8a8e00b8f11b", @source.sync('8a8e00b8f11b', dest)
|
|
60
|
-
|
|
61
|
-
# With :scm_command
|
|
62
|
-
@config[:scm_command] = "/opt/local/bin/hg"
|
|
63
|
-
assert_equal "/opt/local/bin/hg pull --repository /var/www && /opt/local/bin/hg update --repository /var/www --clean 8a8e00b8f11b", @source.sync('8a8e00b8f11b', dest)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def test_export
|
|
67
|
-
dest = "/var/www"
|
|
68
|
-
assert_raise(NotImplementedError) { @source.export('8a8e00b8f11b', dest) }
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def test_sends_password_if_set
|
|
72
|
-
require 'capistrano/logger'
|
|
73
|
-
text = "password:"
|
|
74
|
-
@config[:scm_password] = "opensesame"
|
|
75
|
-
assert_equal "opensesame\n", @source.handle_data(mock_state, :test_stream, text)
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def test_prompts_for_password_if_preferred
|
|
79
|
-
require 'capistrano/logger'
|
|
80
|
-
require 'capistrano/cli'
|
|
81
|
-
Capistrano::CLI.stubs(:password_prompt).with("hg password: ").returns("opensesame")
|
|
82
|
-
@config[:scm_prefer_prompt] = true
|
|
83
|
-
text = "password:"
|
|
84
|
-
assert_equal "opensesame\n", @source.handle_data(mock_state, :test_stream, text)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
# Tests from base_test.rb, makin' sure we didn't break anything up there!
|
|
89
|
-
def test_command_should_default_to_default_command
|
|
90
|
-
assert_equal "hg", @source.command
|
|
91
|
-
@source.local { assert_equal "hg", @source.command }
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def test_command_should_use_scm_command_if_available
|
|
95
|
-
@config[:scm_command] = "/opt/local/bin/hg"
|
|
96
|
-
assert_equal "/opt/local/bin/hg", @source.command
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
def test_command_should_use_scm_command_in_local_mode_if_local_scm_command_not_set
|
|
100
|
-
@config[:scm_command] = "/opt/local/bin/hg"
|
|
101
|
-
@source.local { assert_equal "/opt/local/bin/hg", @source.command }
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
def test_command_should_use_local_scm_command_in_local_mode_if_local_scm_command_is_set
|
|
105
|
-
@config[:scm_command] = "/opt/local/bin/hg"
|
|
106
|
-
@config[:local_scm_command] = "/usr/local/bin/hg"
|
|
107
|
-
assert_equal "/opt/local/bin/hg", @source.command
|
|
108
|
-
@source.local { assert_equal "/usr/local/bin/hg", @source.command }
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
def test_command_should_use_default_if_scm_command_is_default
|
|
112
|
-
@config[:scm_command] = :default
|
|
113
|
-
assert_equal "hg", @source.command
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
def test_command_should_use_default_in_local_mode_if_local_scm_command_is_default
|
|
117
|
-
@config[:scm_command] = "/foo/bar/hg"
|
|
118
|
-
@config[:local_scm_command] = :default
|
|
119
|
-
@source.local { assert_equal "hg", @source.command }
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def test_local_mode_proxy_should_treat_messages_as_being_in_local_mode
|
|
123
|
-
@config[:scm_command] = "/foo/bar/hg"
|
|
124
|
-
@config[:local_scm_command] = :default
|
|
125
|
-
assert_equal "hg", @source.local.command
|
|
126
|
-
assert_equal "/foo/bar/hg", @source.command
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
private
|
|
130
|
-
|
|
131
|
-
def mock_state
|
|
132
|
-
{ :channel => { :host => "abc" } }
|
|
133
|
-
end
|
|
134
|
-
end
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
require 'utils'
|
|
2
|
-
require 'capistrano/recipes/deploy/scm/none'
|
|
3
|
-
|
|
4
|
-
class DeploySCMNoneTest < Test::Unit::TestCase
|
|
5
|
-
class TestSCM < Capistrano::Deploy::SCM::None
|
|
6
|
-
default_command 'none'
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def setup
|
|
10
|
-
@config = {}
|
|
11
|
-
def @config.exists?(name); key?(name); end
|
|
12
|
-
@source = TestSCM.new(@config)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def test_the_truth
|
|
16
|
-
assert true
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def test_checkout_on_linux
|
|
20
|
-
Capistrano::Deploy::LocalDependency.stubs(:on_windows?).returns(false)
|
|
21
|
-
@config[:repository] = '.'
|
|
22
|
-
rev = ''
|
|
23
|
-
dest = '/var/www'
|
|
24
|
-
assert_equal "cp -R . /var/www", @source.checkout(rev, dest)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def test_checkout_on_windows
|
|
28
|
-
Capistrano::Deploy::LocalDependency.stubs(:on_windows?).returns(true)
|
|
29
|
-
@config[:repository] = '.'
|
|
30
|
-
rev = ''
|
|
31
|
-
dest = 'c:/Documents and settings/admin/tmp'
|
|
32
|
-
assert_equal "xcopy . \"c:/Documents and settings/admin/tmp\" /S/I/Y/Q/E", @source.checkout(rev, dest)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
require "utils"
|
|
2
|
-
require 'capistrano/recipes/deploy/scm/subversion'
|
|
3
|
-
|
|
4
|
-
class DeploySCMSubversionTest < Test::Unit::TestCase
|
|
5
|
-
class TestSCM < Capistrano::Deploy::SCM::Subversion
|
|
6
|
-
default_command "svn"
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def setup
|
|
10
|
-
@config = { :repository => "." }
|
|
11
|
-
def @config.exists?(name); key?(name); end
|
|
12
|
-
|
|
13
|
-
@source = TestSCM.new(@config)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def test_query_revision
|
|
17
|
-
revision = @source.query_revision('HEAD') do |o|
|
|
18
|
-
assert_equal "svn info . -rHEAD", o
|
|
19
|
-
%Q{Path: rails_2_3
|
|
20
|
-
URL: svn+ssh://example.com/var/repos/project/branches/rails_2_3
|
|
21
|
-
Repository Root: svn+ssh://example.com/var/repos
|
|
22
|
-
Repository UUID: 2d86388d-c40f-0410-ad6a-a69da6a65d20
|
|
23
|
-
Revision: 2095
|
|
24
|
-
Node Kind: directory
|
|
25
|
-
Last Changed Author: sw
|
|
26
|
-
Last Changed Rev: 2064
|
|
27
|
-
Last Changed Date: 2009-03-11 11:04:25 -0700 (Wed, 11 Mar 2009)
|
|
28
|
-
}
|
|
29
|
-
end
|
|
30
|
-
assert_equal 2095, revision
|
|
31
|
-
end
|
|
32
|
-
end
|