capistrano 2.8.0 → 3.19.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,183 +0,0 @@
|
|
1
|
-
require "utils"
|
2
|
-
require 'capistrano/task_definition'
|
3
|
-
require 'capistrano/configuration/servers'
|
4
|
-
|
5
|
-
class ConfigurationServersTest < Test::Unit::TestCase
|
6
|
-
class MockConfig
|
7
|
-
attr_reader :roles
|
8
|
-
attr_accessor :preserve_roles
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@roles = {}
|
12
|
-
@preserve_roles = false
|
13
|
-
end
|
14
|
-
|
15
|
-
include Capistrano::Configuration::Servers
|
16
|
-
end
|
17
|
-
|
18
|
-
def setup
|
19
|
-
@config = MockConfig.new
|
20
|
-
role(@config, :app, "app1", :primary => true)
|
21
|
-
role(@config, :app, "app2", "app3")
|
22
|
-
role(@config, :web, "web1", "web2")
|
23
|
-
role(@config, :report, "app2", :no_deploy => true)
|
24
|
-
role(@config, :file, "file", :no_deploy => true)
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_task_without_roles_should_apply_to_all_defined_hosts
|
28
|
-
task = new_task(:testing)
|
29
|
-
assert_equal %w(app1 app2 app3 web1 web2 file).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_task_with_explicit_role_list_should_apply_only_to_those_roles
|
33
|
-
task = new_task(:testing, @config, :roles => %w(app web))
|
34
|
-
assert_equal %w(app1 app2 app3 web1 web2).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_task_with_single_role_should_apply_only_to_that_role
|
38
|
-
task = new_task(:testing, @config, :roles => :web)
|
39
|
-
assert_equal %w(web1 web2).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_task_with_unknown_role_should_raise_exception
|
43
|
-
task = new_task(:testing, @config, :roles => :bogus)
|
44
|
-
assert_raises(ArgumentError) do
|
45
|
-
@config.find_servers_for_task(task)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_task_with_hosts_option_should_apply_only_to_those_hosts
|
50
|
-
task = new_task(:testing, @config, :hosts => %w(foo bar))
|
51
|
-
assert_equal %w(foo bar).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_task_with_single_hosts_option_should_apply_only_to_that_host
|
55
|
-
task = new_task(:testing, @config, :hosts => "foo")
|
56
|
-
assert_equal %w(foo).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_task_with_roles_as_environment_variable_should_apply_only_to_that_role
|
60
|
-
ENV['ROLES'] = "app,file"
|
61
|
-
task = new_task(:testing)
|
62
|
-
assert_equal %w(app1 app2 app3 file).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
63
|
-
ensure
|
64
|
-
ENV.delete('ROLES')
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_task_with_roles_as_environment_variable_and_preserve_roles_should_apply_only_to_existant_task_role
|
68
|
-
ENV['ROLES'] = "app,file"
|
69
|
-
@config.preserve_roles = true
|
70
|
-
task = new_task(:testing,@config, :roles => :app)
|
71
|
-
assert_equal %w(app1 app2 app3).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
72
|
-
ensure
|
73
|
-
ENV.delete('ROLES')
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_task_with_roles_as_environment_variable_and_preserve_roles_should_apply_only_to_existant_task_roles
|
77
|
-
ENV['ROLES'] = "app,file,web"
|
78
|
-
@config.preserve_roles = true
|
79
|
-
task = new_task(:testing,@config, :roles => [ :app,:file ])
|
80
|
-
assert_equal %w(app1 app2 app3 file).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
81
|
-
ensure
|
82
|
-
ENV.delete('ROLES')
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_task_with_roles_as_environment_variable_and_preserve_roles_should_not_apply_if_not_exists_those_task_roles
|
86
|
-
ENV['ROLES'] = "file,web"
|
87
|
-
@config.preserve_roles = true
|
88
|
-
task = new_task(:testing,@config, :roles => [ :app ])
|
89
|
-
assert_equal [], @config.find_servers_for_task(task).map { |s| s.host }.sort
|
90
|
-
ensure
|
91
|
-
ENV.delete('ROLES')
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_task_with_hosts_as_environment_variable_should_apply_only_to_those_hosts
|
95
|
-
ENV['HOSTS'] = "foo,bar"
|
96
|
-
task = new_task(:testing)
|
97
|
-
assert_equal %w(foo bar).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
98
|
-
ensure
|
99
|
-
ENV.delete('HOSTS')
|
100
|
-
end
|
101
|
-
|
102
|
-
def test_task_with_hosts_as_environment_variable_should_not_inspect_roles_at_all
|
103
|
-
ENV['HOSTS'] = "foo,bar"
|
104
|
-
task = new_task(:testing, @config, :roles => :bogus)
|
105
|
-
assert_equal %w(foo bar).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
106
|
-
ensure
|
107
|
-
ENV.delete('HOSTS')
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_task_with_hostfilter_environment_variable_should_apply_only_to_those_hosts
|
111
|
-
ENV['HOSTFILTER'] = "app1,web1"
|
112
|
-
task = new_task(:testing)
|
113
|
-
assert_equal %w(app1 web1).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
114
|
-
ensure
|
115
|
-
ENV.delete('HOSTFILTER')
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_task_with_hostfilter_environment_variable_should_filter_hosts_option
|
119
|
-
ENV['HOSTFILTER'] = "foo"
|
120
|
-
task = new_task(:testing, @config, :hosts => %w(foo bar))
|
121
|
-
assert_equal %w(foo).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
122
|
-
ensure
|
123
|
-
ENV.delete('HOSTFILTER')
|
124
|
-
end
|
125
|
-
|
126
|
-
def test_task_with_hostfilter_environment_variable_and_skip_hostfilter_should_not_filter_hosts_option
|
127
|
-
ENV['HOSTFILTER'] = "foo"
|
128
|
-
task = new_task(:testing, @config, :hosts => %w(foo bar), :skip_hostfilter => true)
|
129
|
-
assert_equal %w(foo bar).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
130
|
-
ensure
|
131
|
-
ENV.delete('HOSTFILTER')
|
132
|
-
end
|
133
|
-
|
134
|
-
def test_task_with_hostrolefilter_environment_variable_should_apply_only_to_those_hosts
|
135
|
-
ENV['HOSTROLEFILTER'] = "web"
|
136
|
-
task = new_task(:testing)
|
137
|
-
assert_equal %w(web1 web2).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
138
|
-
ensure
|
139
|
-
ENV.delete('HOSTROLEFILTER')
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_task_with_only_should_apply_only_to_matching_tasks
|
143
|
-
task = new_task(:testing, @config, :roles => :app, :only => { :primary => true })
|
144
|
-
assert_equal %w(app1), @config.find_servers_for_task(task).map { |s| s.host }
|
145
|
-
end
|
146
|
-
|
147
|
-
def test_task_with_except_should_apply_only_to_matching_tasks
|
148
|
-
task = new_task(:testing, @config, :except => { :no_deploy => true })
|
149
|
-
assert_equal %w(app1 app2 app3 web1 web2).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
|
150
|
-
end
|
151
|
-
|
152
|
-
def test_options_to_find_servers_for_task_should_override_options_in_task
|
153
|
-
task = new_task(:testing, @config, :roles => :web)
|
154
|
-
assert_equal %w(app1 app2 app3).sort, @config.find_servers_for_task(task, :roles => :app).map { |s| s.host }.sort
|
155
|
-
end
|
156
|
-
|
157
|
-
def test_find_servers_with_lambda_for_hosts_should_be_evaluated
|
158
|
-
assert_equal %w(foo), @config.find_servers(:hosts => lambda { "foo" }).map { |s| s.host }.sort
|
159
|
-
assert_equal %w(bar foo), @config.find_servers(:hosts => lambda { %w(foo bar) }).map { |s| s.host }.sort
|
160
|
-
end
|
161
|
-
|
162
|
-
def test_find_servers_with_lambda_for_roles_should_be_evaluated
|
163
|
-
assert_equal %w(app1 app2 app3), @config.find_servers(:roles => lambda { :app }).map { |s| s.host }.sort
|
164
|
-
assert_equal %w(app2 file), @config.find_servers(:roles => lambda { [:report, :file] }).map { |s| s.host }.sort
|
165
|
-
end
|
166
|
-
|
167
|
-
def test_find_servers_with_hosts_nil_or_empty
|
168
|
-
assert_equal [], @config.find_servers(:hosts => nil)
|
169
|
-
assert_equal [], @config.find_servers(:hosts => [])
|
170
|
-
result = @config.find_servers(:hosts => @config.find_servers(:roles => :report)[0])
|
171
|
-
assert_equal 1, result.size
|
172
|
-
result = @config.find_servers(:hosts => "app1")
|
173
|
-
assert_equal 1, result.size
|
174
|
-
end
|
175
|
-
|
176
|
-
def test_find_servers_with_rolees_nil_or_empty
|
177
|
-
assert_equal [], @config.find_servers(:roles => nil)
|
178
|
-
assert_equal [], @config.find_servers(:roles => [])
|
179
|
-
result = @config.find_servers(:roles => :report)
|
180
|
-
assert_equal 1, result.size
|
181
|
-
end
|
182
|
-
|
183
|
-
end
|
@@ -1,190 +0,0 @@
|
|
1
|
-
require "utils"
|
2
|
-
require 'capistrano/configuration/variables'
|
3
|
-
|
4
|
-
class ConfigurationVariablesTest < Test::Unit::TestCase
|
5
|
-
class MockConfig
|
6
|
-
attr_reader :original_initialize_called
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@original_initialize_called = true
|
10
|
-
end
|
11
|
-
|
12
|
-
include Capistrano::Configuration::Variables
|
13
|
-
end
|
14
|
-
|
15
|
-
def setup
|
16
|
-
MockConfig.any_instance.stubs(:logger).returns(stub_everything)
|
17
|
-
@config = MockConfig.new
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_initialize_should_initialize_variables_hash
|
21
|
-
assert @config.original_initialize_called
|
22
|
-
assert_equal({:ssh_options => {}, :logger => @config.logger}, @config.variables)
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_set_should_add_variable_to_hash
|
26
|
-
@config.set :sample, :value
|
27
|
-
assert_equal :value, @config.variables[:sample]
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_set_should_convert_variable_name_to_symbol
|
31
|
-
@config.set "sample", :value
|
32
|
-
assert_equal :value, @config.variables[:sample]
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_set_should_be_aliased_to_square_brackets
|
36
|
-
@config[:sample] = :value
|
37
|
-
assert_equal :value, @config.variables[:sample]
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_variables_should_be_accessible_as_read_accessors
|
41
|
-
@config[:sample] = :value
|
42
|
-
assert_equal :value, @config.sample
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_method_missing_should_raise_error_if_no_variable_matches
|
46
|
-
assert_raises(NoMethodError) do
|
47
|
-
@config.sample
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_respond_to_should_look_for_variables
|
52
|
-
assert !@config.respond_to?(:sample)
|
53
|
-
@config[:sample] = :value
|
54
|
-
assert @config.respond_to?(:sample)
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_respond_to_should_be_true_when_passed_a_string
|
58
|
-
assert !@config.respond_to?('sample')
|
59
|
-
@config[:sample] = :value
|
60
|
-
assert @config.respond_to?('sample')
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_respond_to_with_include_priv_paramter
|
64
|
-
assert !@config.respond_to?(:sample, true)
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_set_should_require_value
|
68
|
-
assert_raises(ArgumentError) do
|
69
|
-
@config.set(:sample)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_set_should_allow_value_to_be_omitted_if_block_is_given
|
74
|
-
assert_nothing_raised do
|
75
|
-
@config.set(:sample) { :value }
|
76
|
-
end
|
77
|
-
assert_instance_of Proc, @config.variables[:sample]
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_set_should_not_allow_multiple_values
|
81
|
-
assert_raises(ArgumentError) do
|
82
|
-
@config.set(:sample, :value, :another)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_set_should_not_allow_both_a_value_and_a_block
|
87
|
-
assert_raises(ArgumentError) do
|
88
|
-
@config.set(:sample, :value) { :block }
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_set_should_not_allow_capitalized_variables
|
93
|
-
assert_raises(ArgumentError) do
|
94
|
-
@config.set :Sample, :value
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_unset_should_remove_variable_from_hash
|
99
|
-
@config.set :sample, :value
|
100
|
-
assert @config.variables.key?(:sample)
|
101
|
-
@config.unset :sample
|
102
|
-
assert !@config.variables.key?(:sample)
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_unset_should_clear_memory_of_original_proc
|
106
|
-
@config.set(:sample) { :value }
|
107
|
-
@config.fetch(:sample)
|
108
|
-
@config.unset(:sample)
|
109
|
-
assert_equal false, @config.reset!(:sample)
|
110
|
-
end
|
111
|
-
|
112
|
-
def test_exists_should_report_existance_of_variable_in_hash
|
113
|
-
assert !@config.exists?(:sample)
|
114
|
-
@config[:sample] = :value
|
115
|
-
assert @config.exists?(:sample)
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_reset_should_do_nothing_if_variable_does_not_exist
|
119
|
-
assert_equal false, @config.reset!(:sample)
|
120
|
-
assert !@config.variables.key?(:sample)
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_reset_should_do_nothing_if_variable_is_not_a_proc
|
124
|
-
@config.set(:sample, :value)
|
125
|
-
assert_equal false, @config.reset!(:sample)
|
126
|
-
assert_equal :value, @config.variables[:sample]
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_reset_should_do_nothing_if_proc_variable_has_not_been_dereferenced
|
130
|
-
@config.set(:sample) { :value }
|
131
|
-
assert_equal false, @config.reset!(:sample)
|
132
|
-
assert_instance_of Proc, @config.variables[:sample]
|
133
|
-
end
|
134
|
-
|
135
|
-
def test_reset_should_restore_variable_to_original_proc_value
|
136
|
-
@config.set(:sample) { :value }
|
137
|
-
assert_instance_of Proc, @config.variables[:sample]
|
138
|
-
@config.fetch(:sample)
|
139
|
-
assert_instance_of Symbol, @config.variables[:sample]
|
140
|
-
assert @config.reset!(:sample)
|
141
|
-
assert_instance_of Proc, @config.variables[:sample]
|
142
|
-
end
|
143
|
-
|
144
|
-
def test_fetch_should_return_stored_non_proc_value
|
145
|
-
@config.set(:sample, :value)
|
146
|
-
assert_equal :value, @config.fetch(:sample)
|
147
|
-
end
|
148
|
-
|
149
|
-
def test_fetch_should_raise_index_error_if_variable_does_not_exist
|
150
|
-
assert_raises(IndexError) do
|
151
|
-
@config.fetch(:sample)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
def test_fetch_should_return_default_if_variable_does_not_exist_and_default_is_given
|
156
|
-
assert_nothing_raised do
|
157
|
-
assert_equal :default_value, @config.fetch(:sample, :default_value)
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
def test_fetch_should_invoke_block_if_variable_does_not_exist_and_block_is_given
|
162
|
-
assert_nothing_raised do
|
163
|
-
assert_equal :default_value, @config.fetch(:sample) { :default_value }
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
def test_fetch_should_raise_argument_error_if_both_default_and_block_are_given
|
168
|
-
assert_raises(ArgumentError) do
|
169
|
-
@config.fetch(:sample, :default1) { :default2 }
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
def test_fetch_should_dereference_proc_values
|
174
|
-
@config.set(:sample) { :value }
|
175
|
-
assert_instance_of Proc, @config.variables[:sample]
|
176
|
-
assert_equal :value, @config.fetch(:sample)
|
177
|
-
assert_instance_of Symbol, @config.variables[:sample]
|
178
|
-
end
|
179
|
-
|
180
|
-
def test_square_brackets_should_alias_fetch
|
181
|
-
@config.set(:sample, :value)
|
182
|
-
assert_equal :value, @config[:sample]
|
183
|
-
end
|
184
|
-
|
185
|
-
def test_square_brackets_should_return_nil_for_non_existant_variable
|
186
|
-
assert_nothing_raised do
|
187
|
-
assert_nil @config[:sample]
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
data/test/configuration_test.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
require "utils"
|
2
|
-
require 'capistrano/configuration'
|
3
|
-
|
4
|
-
# These tests are only for testing the integration of the various components
|
5
|
-
# of the Configuration class. To test specific features, please look at the
|
6
|
-
# tests under test/configuration.
|
7
|
-
|
8
|
-
class ConfigurationTest < Test::Unit::TestCase
|
9
|
-
def setup
|
10
|
-
@config = Capistrano::Configuration.new
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_connections_execution_loading_namespaces_roles_and_variables_modules_should_integrate_correctly
|
14
|
-
Capistrano::SSH.expects(:connect).with { |s,c| s.host == "www.capistrano.test" && c == @config }.returns(:session)
|
15
|
-
|
16
|
-
process_args = Proc.new do |tree, session, opts|
|
17
|
-
tree.fallback.command == "echo 'hello world'" &&
|
18
|
-
session == [:session] &&
|
19
|
-
opts == { :logger => @config.logger }
|
20
|
-
end
|
21
|
-
|
22
|
-
Capistrano::Command.expects(:process).with(&process_args)
|
23
|
-
|
24
|
-
@config.load do
|
25
|
-
role :test, "www.capistrano.test"
|
26
|
-
set :message, "hello world"
|
27
|
-
namespace :testing do
|
28
|
-
task :example, :roles => :test do
|
29
|
-
run "echo '#{message}'"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
@config.testing.example
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_tasks_in_nested_namespace_should_be_able_to_call_tasks_in_same_namespace
|
38
|
-
@config.namespace(:outer) do
|
39
|
-
task(:first) { set :called_first, true }
|
40
|
-
namespace(:inner) do
|
41
|
-
task(:first) { set :called_inner_first, true }
|
42
|
-
task(:second) { first }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
@config.outer.inner.second
|
47
|
-
assert !@config[:called_first]
|
48
|
-
assert @config[:called_inner_first]
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_tasks_in_nested_namespace_should_be_able_to_call_tasks_in_parent_namespace
|
52
|
-
@config.namespace(:outer) do
|
53
|
-
task(:first) { set :called_first, true }
|
54
|
-
namespace(:inner) do
|
55
|
-
task(:second) { first }
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
@config.outer.inner.second
|
60
|
-
assert @config[:called_first]
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_tasks_in_nested_namespace_should_be_able_to_call_shadowed_tasks_in_parent_namespace
|
64
|
-
@config.namespace(:outer) do
|
65
|
-
task(:first) { set :called_first, true }
|
66
|
-
namespace(:inner) do
|
67
|
-
task(:first) { set :called_inner_first, true }
|
68
|
-
task(:second) { parent.first }
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
@config.outer.inner.second
|
73
|
-
assert @config[:called_first]
|
74
|
-
assert !@config[:called_inner_first]
|
75
|
-
end
|
76
|
-
|
77
|
-
def test_hooks_for_default_task_should_be_found_if_named_after_the_namespace
|
78
|
-
@config.namespace(:outer) do
|
79
|
-
task(:default) { set :called_default, true }
|
80
|
-
task(:before_outer) { set :called_before_outer, true }
|
81
|
-
task(:after_outer) { set :called_after_outer, true }
|
82
|
-
end
|
83
|
-
@config.outer.default
|
84
|
-
assert @config[:called_before_outer]
|
85
|
-
assert @config[:called_default]
|
86
|
-
assert @config[:called_after_outer]
|
87
|
-
end
|
88
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
require "utils"
|
2
|
-
require 'capistrano/recipes/deploy/local_dependency'
|
3
|
-
|
4
|
-
class LocalDependencyTest < Test::Unit::TestCase
|
5
|
-
def setup
|
6
|
-
@config = { }
|
7
|
-
@dependency = Capistrano::Deploy::LocalDependency.new(@config)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_should_use_standard_error_message
|
11
|
-
setup_for_one_path_entry(false)
|
12
|
-
@dependency.command("cat")
|
13
|
-
assert_equal "`cat' could not be found in the path on the local host", @dependency.message
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_should_use_alternative_message_if_provided
|
17
|
-
setup_for_one_path_entry(false)
|
18
|
-
@dependency.command("cat").or("Sorry")
|
19
|
-
assert_equal "Sorry", @dependency.message
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_env_with_no_path_should_never_find_command
|
23
|
-
ENV.expects(:[]).with("PATH").returns(nil)
|
24
|
-
assert !@dependency.command("cat").pass?
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_env_with_one_path_entry_should_fail_if_command_not_found
|
28
|
-
setup_for_one_path_entry(false)
|
29
|
-
assert !@dependency.command("cat").pass?
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_env_with_one_path_entry_should_pass_if_command_found
|
33
|
-
setup_for_one_path_entry(true)
|
34
|
-
assert @dependency.command("cat").pass?
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_env_with_three_path_entries_should_fail_if_command_not_found
|
38
|
-
setup_for_three_path_entries(false)
|
39
|
-
assert !@dependency.command("cat").pass?
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_env_with_three_path_entries_should_pass_if_command_found
|
43
|
-
setup_for_three_path_entries(true)
|
44
|
-
assert @dependency.command("cat").pass?
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_env_with_one_path_entry_on_windows_should_pass_if_command_found_with_extension
|
48
|
-
setup_for_one_path_entry_on_windows(true)
|
49
|
-
assert @dependency.command("cat").pass?
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def setup_for_one_path_entry(command_found)
|
55
|
-
Capistrano::Deploy::LocalDependency.expects(:on_windows?).returns(false)
|
56
|
-
ENV.expects(:[]).with("PATH").returns("/bin")
|
57
|
-
File.expects(:executable?).with("/bin/cat").returns(command_found)
|
58
|
-
end
|
59
|
-
|
60
|
-
def setup_for_three_path_entries(command_found)
|
61
|
-
Capistrano::Deploy::LocalDependency.expects(:on_windows?).returns(false)
|
62
|
-
path = %w(/bin /usr/bin /usr/local/bin).join(File::PATH_SEPARATOR)
|
63
|
-
ENV.expects(:[]).with("PATH").returns(path)
|
64
|
-
File.expects(:executable?).with("/usr/bin/cat").returns(command_found)
|
65
|
-
File.expects(:executable?).at_most(1).with("/bin/cat").returns(false)
|
66
|
-
File.expects(:executable?).at_most(1).with("/usr/local/bin/cat").returns(false)
|
67
|
-
end
|
68
|
-
|
69
|
-
def setup_for_one_path_entry_on_windows(command_found)
|
70
|
-
Capistrano::Deploy::LocalDependency.expects(:on_windows?).returns(true)
|
71
|
-
ENV.expects(:[]).with("PATH").returns("/cygwin/bin")
|
72
|
-
File.stubs(:executable?).returns(false)
|
73
|
-
first_executable_extension = Capistrano::Deploy::LocalDependency.windows_executable_extensions.first
|
74
|
-
File.expects(:executable?).with("/cygwin/bin/cat#{first_executable_extension}").returns(command_found)
|
75
|
-
end
|
76
|
-
end
|
@@ -1,135 +0,0 @@
|
|
1
|
-
require "utils"
|
2
|
-
require 'capistrano/recipes/deploy/remote_dependency'
|
3
|
-
|
4
|
-
class RemoteDependencyTest < Test::Unit::TestCase
|
5
|
-
def setup
|
6
|
-
@config = { }
|
7
|
-
@dependency = Capistrano::Deploy::RemoteDependency.new(@config)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_should_use_standard_error_message_for_directory
|
11
|
-
setup_for_a_configuration_run("test -d /data", false)
|
12
|
-
@dependency.directory("/data")
|
13
|
-
assert_equal "`/data' is not a directory (host)", @dependency.message
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_should_use_standard_error_message_for_file
|
17
|
-
setup_for_a_configuration_run("test -f /data/foo.txt", false)
|
18
|
-
@dependency.file("/data/foo.txt")
|
19
|
-
assert_equal "`/data/foo.txt' is not a file (host)", @dependency.message
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_should_use_standard_error_message_for_writable
|
23
|
-
setup_for_a_configuration_run("test -w /data/foo.txt", false)
|
24
|
-
@dependency.writable("/data/foo.txt")
|
25
|
-
assert_equal "`/data/foo.txt' is not writable (host)", @dependency.message
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_should_use_standard_error_message_for_command
|
29
|
-
setup_for_a_configuration_run("which cat", false)
|
30
|
-
@dependency.command("cat")
|
31
|
-
assert_equal "`cat' could not be found in the path (host)", @dependency.message
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_should_use_standard_error_message_for_gem
|
35
|
-
setup_for_a_configuration_gem_run("capistrano", "9.9", false)
|
36
|
-
@dependency.gem("capistrano", 9.9)
|
37
|
-
assert_equal "gem `capistrano' 9.9 could not be found (host)", @dependency.message
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_should_use_standard_error_message_for_deb
|
41
|
-
setup_for_a_configuration_deb_run("dpkg", "1.15", false)
|
42
|
-
@dependency.deb("dpkg", "1.15")
|
43
|
-
assert_equal "package `dpkg' 1.15 could not be found (host)", @dependency.message
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_should_fail_if_directory_not_found
|
47
|
-
setup_for_a_configuration_run("test -d /data", false)
|
48
|
-
assert !@dependency.directory("/data").pass?
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_should_pass_if_directory_found
|
52
|
-
setup_for_a_configuration_run("test -d /data", true)
|
53
|
-
assert @dependency.directory("/data").pass?
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_should_fail_if_file_not_found
|
57
|
-
setup_for_a_configuration_run("test -f /data/foo.txt", false)
|
58
|
-
assert !@dependency.file("/data/foo.txt").pass?
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_should_pass_if_file_found
|
62
|
-
setup_for_a_configuration_run("test -f /data/foo.txt", true)
|
63
|
-
assert @dependency.file("/data/foo.txt").pass?
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_should_fail_if_writable_not_found
|
67
|
-
setup_for_a_configuration_run("test -w /data/foo.txt", false)
|
68
|
-
assert !@dependency.writable("/data/foo.txt").pass?
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_should_pass_if_writable_found
|
72
|
-
setup_for_a_configuration_run("test -w /data/foo.txt", true)
|
73
|
-
assert @dependency.writable("/data/foo.txt").pass?
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_should_fail_if_command_not_found
|
77
|
-
setup_for_a_configuration_run("which cat", false)
|
78
|
-
assert !@dependency.command("cat").pass?
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_should_pass_if_command_found
|
82
|
-
setup_for_a_configuration_run("which cat", true)
|
83
|
-
assert @dependency.command("cat").pass?
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_should_fail_if_gem_not_found
|
87
|
-
setup_for_a_configuration_gem_run("capistrano", "9.9", false)
|
88
|
-
assert !@dependency.gem("capistrano", 9.9).pass?
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_should_pass_if_gem_found
|
92
|
-
setup_for_a_configuration_gem_run("capistrano", "9.9", true)
|
93
|
-
assert @dependency.gem("capistrano", 9.9).pass?
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_should_pass_if_deb_found
|
97
|
-
setup_for_a_configuration_deb_run("dpkg", "1.15", true)
|
98
|
-
assert @dependency.deb("dpkg", "1.15").pass?
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_should_fail_if_deb_not_found
|
102
|
-
setup_for_a_configuration_deb_run("dpkg", "1.15", false)
|
103
|
-
assert !@dependency.deb("dpkg", "1.15").pass?
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_should_use_alternative_message_if_provided
|
107
|
-
setup_for_a_configuration_run("which cat", false)
|
108
|
-
@dependency.command("cat").or("Sorry")
|
109
|
-
assert_equal "Sorry (host)", @dependency.message
|
110
|
-
end
|
111
|
-
|
112
|
-
private
|
113
|
-
|
114
|
-
def setup_for_a_configuration_run(command, passing)
|
115
|
-
expectation = @config.expects(:invoke_command).with(command, {})
|
116
|
-
if passing
|
117
|
-
expectation.returns(true)
|
118
|
-
else
|
119
|
-
error = Capistrano::CommandError.new
|
120
|
-
error.expects(:hosts).returns(["host"])
|
121
|
-
expectation.raises(error)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
def setup_for_a_configuration_gem_run(name, version, passing)
|
126
|
-
@config.expects(:fetch).with(:gem_command, "gem").returns("gem")
|
127
|
-
find_gem_cmd = "gem specification --version '#{version}' #{name} 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }'"
|
128
|
-
setup_for_a_configuration_run(find_gem_cmd, passing)
|
129
|
-
end
|
130
|
-
|
131
|
-
def setup_for_a_configuration_deb_run(name, version, passing)
|
132
|
-
find_deb_cmd = "dpkg -s #{name} | grep '^Version: #{version}'"
|
133
|
-
setup_for_a_configuration_run(find_deb_cmd, passing)
|
134
|
-
end
|
135
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require "utils"
|
2
|
-
require 'capistrano/recipes/deploy/scm/accurev'
|
3
|
-
|
4
|
-
class AccurevTest < Test::Unit::TestCase
|
5
|
-
include Capistrano::Deploy::SCM
|
6
|
-
|
7
|
-
def test_internal_revision_to_s
|
8
|
-
assert_equal 'foo/1', Accurev::InternalRevision.new('foo', 1).to_s
|
9
|
-
assert_equal 'foo/highest', Accurev::InternalRevision.new('foo', 'highest').to_s
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_internal_revision_parse
|
13
|
-
revision = Accurev::InternalRevision.parse('foo')
|
14
|
-
assert_equal 'foo', revision.stream
|
15
|
-
assert_equal 'highest', revision.transaction_id
|
16
|
-
assert_equal 'foo/highest', revision.to_s
|
17
|
-
|
18
|
-
revision = Accurev::InternalRevision.parse('foo/1')
|
19
|
-
assert_equal 'foo', revision.stream
|
20
|
-
assert_equal '1', revision.transaction_id
|
21
|
-
assert_equal 'foo/1', revision.to_s
|
22
|
-
end
|
23
|
-
end
|