capistrano 2.5.8 → 2.5.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,15 @@
1
+ == 2.5.9 / 12 September 2009
2
+
3
+ * #105 - Adds skip_hostfilter option to find_servers() [Eric]
4
+ * #103 - Fixes Using non-master branch fails with Ruby 1.9 [Suraj Kurapati]
5
+ * #96 - Tweak for 1.9 Compatibility
6
+ * #79 - Fixes Capistrano hangs on shell command for many computers
7
+ * #77 - Fixes Copy command doesn't work on Solaris due to tar/gtar
8
+ * #76 - Fixes Invalid Subversion URL
9
+ * Improved web:disable task, now suggests a .htaccess block to use suggested by Rafael García
10
+ * Includes more logger options (can now select stdout, stderr of a file) [Rafael García]
11
+ * Fixes a couple of documentation problems, typos and worse. [Lee Hambley]
12
+
1
13
  == 2.5.8 / July 2009
2
14
 
3
15
  * Fixes a problem in 2.5.7 where deploy:finalize_update had been badly merged.
@@ -5,10 +17,15 @@
5
17
  == 2.5.6 & 2.5.7 / July 2009
6
18
 
7
19
  * 2.5.7 masks a broken 2.5.6 release that was accidentally mirrored via Rubyforge.
20
+
8
21
  * Clean the cached git repository [Graeme Mathieson]
22
+
9
23
  * Fixes perforce issues reported at http://bit.ly/wt0es [Scott Johnson]
24
+
10
25
  * Improved back-tick handling code in relation to the above.
26
+
11
27
  * Fixes a Git issue when submodules update upstream. (via mailing list) [sneakin]
28
+
12
29
  * Capify now creates the config directory in directories without one.
13
30
 
14
31
  == 2.5.5 / 24 Feb 2009
@@ -64,8 +64,8 @@ If you want to try Capistrano code that hasn't been formerly released yet, this
64
64
 
65
65
  git clone git://github.com/capistrano/capistrano.git capistrano-capistrano
66
66
  cd capistrano-capsitrano
67
- gem build capistrano.gemspec
68
- sudo gem install capistrano-*.gem
67
+ rake package
68
+ sudo gem install pkg/capistrano-*.gem
69
69
 
70
70
  This will install the most recent version of capistrano and make it available for both cap, and capify.
71
71
 
data/Rakefile CHANGED
@@ -15,8 +15,8 @@ Echoe.new('capistrano', version) do |p|
15
15
  p.include_gemspec = true
16
16
  p.changelog = "CHANGELOG.rdoc"
17
17
 
18
- p.author = "Jamis Buck"
19
- p.email = "jamis@jamisbuck.org"
18
+ p.author = ["Jamis Buck", "Lee Hambley"]
19
+ p.email = ["jamis@jamisbuck.org", "lee.hambley@gmail.com"]
20
20
 
21
21
  p.summary = <<-DESC.strip.gsub(/\n\s+/, " ")
22
22
  Capistrano is a utility and framework for executing commands in parallel
@@ -27,7 +27,7 @@ Echoe.new('capistrano', version) do |p|
27
27
  p.need_zip = true
28
28
  p.rdoc_pattern = /^(lib|README.rdoc|CHANGELOG.rdoc)/
29
29
 
30
- p.dependencies = ["net-ssh >=2.0.10",
30
+ p.dependencies = ["net-ssh >=2.0.14",
31
31
  "net-sftp >=2.0.0",
32
32
  "net-scp >=1.0.0",
33
33
  "net-ssh-gateway >=1.0.0",
data/bin/capify CHANGED
@@ -39,59 +39,46 @@ files = {
39
39
  "Capfile" => unindent(<<-FILE),
40
40
  load 'deploy' if respond_to?(:namespace) # cap2 differentiator
41
41
  Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
42
- load 'config/deploy'
42
+
43
+ load 'config/deploy' # remove this line to skip loading any of the default tasks
43
44
  FILE
44
45
 
45
- "config/deploy.rb" => unindent(<<-FILE),
46
- set :application, "set your application name here"
47
- set :repository, "set your repository location here"
46
+ "config/deploy.rb" => 'set :application, "set your application name here"
47
+ set :repository, "set your repository location here"
48
48
 
49
- # If you have previously been relying upon the code to start, stop
50
- # and restart your mongrel application, or if you rely on the database
51
- # migration code, please uncomment the lines you require below
52
-
53
- # If you are deploying a rails app you probably need these:
54
-
55
- # load 'ext/rails-database-migrations.rb'
56
- # load 'ext/rails-shared-directories.rb'
57
-
58
- # There are also new utility libaries shipped with the core these
59
- # include the following, please see individual files for more
60
- # documentation, or run `cap -vT` with the following lines commented
61
- # out to see what they make available.
62
-
63
- # load 'ext/spinner.rb' # Designed for use with script/spin
64
- # load 'ext/passenger-mod-rails.rb' # Restart task for use with mod_rails
65
- # load 'ext/web-disable-enable.rb' # Gives you web:disable and web:enable
49
+ set :scm, :subversion
50
+ # Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
66
51
 
67
- # If you aren't deploying to /u/apps/\#{application} on the target
68
- # servers (which is the default), you can specify the actual location
69
- # via the :deploy_to variable:
70
- # set :deploy_to, "/var/www/\#{application}"
52
+ role :web, "your web-server here" # Your HTTP server, Apache/etc
53
+ role :app, "your app-server here" # This may be the same as your `Web` server
54
+ role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
55
+ role :db, "your slave db-server here"
71
56
 
72
- # If you aren't using Subversion to manage your source code, specify
73
- # your SCM below:
74
- # set :scm, :subversion
75
- # see a full list by running "gem contents capistrano | grep 'scm/'"
57
+ # If you are using Passenger mod_rails uncomment this:
58
+ # if you\'re still using the script/reapear helper you will need
59
+ # these http://github.com/rails/irs_process_scripts
76
60
 
77
- role :web, "your web-server here"
78
-
79
- FILE
80
- }
61
+ # namespace :deploy do
62
+ # task :start {}
63
+ # task :stop {}
64
+ # task :restart, :roles => :app, :except => { :no_release => true } do
65
+ # run "#{try_sudo} touch #{File.join(current_path,\'tmp\',\'restart.txt\')}"
66
+ # end
67
+ # end'}
81
68
 
82
69
  base = ARGV.shift
83
70
  files.each do |file, content|
84
71
  file = File.join(base, file)
85
72
  if File.exists?(file)
86
- warn "[skip] `#{file}' already exists"
73
+ warn "[skip] '#{file}' already exists"
87
74
  elsif File.exists?(file.downcase)
88
- warn "[skip] `#{file.downcase}' exists, which could conflict with `#{file}'"
89
- elsif !File.exists?(File.dirname(file))
90
- FileUtils.mkdir(File.dirname(file))
91
- retry
92
- warn "[skip] directory `#{File.dirname(file)}' did not exist, created."
75
+ warn "[skip] '#{file.downcase}' exists, which could conflict with `#{file}'"
93
76
  else
94
- puts "[add] writing `#{file}'"
77
+ unless File.exists?(File.dirname(file))
78
+ puts "[add] making directory '#{File.dirname(file)}'"
79
+ FileUtils.mkdir(File.dirname(file))
80
+ end
81
+ puts "[add] writing '#{file}'"
95
82
  File.open(file, "w") { |f| f.write(content) }
96
83
  end
97
84
  end
@@ -0,0 +1,48 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{capistrano}
5
+ s.version = "2.5.9"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Jamis Buck, Lee Hambley"]
9
+ s.date = %q{2009-09-12}
10
+ s.description = %q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
11
+ s.email = ["jamis@jamisbuck.org", "lee.hambley@gmail.com"]
12
+ s.executables = ["cap", "capify"]
13
+ s.extra_rdoc_files = ["CHANGELOG.rdoc", "lib/capistrano/callback.rb", "lib/capistrano/cli/execute.rb", "lib/capistrano/cli/help.rb", "lib/capistrano/cli/help.txt", "lib/capistrano/cli/options.rb", "lib/capistrano/cli/ui.rb", "lib/capistrano/cli.rb", "lib/capistrano/command.rb", "lib/capistrano/configuration/actions/file_transfer.rb", "lib/capistrano/configuration/actions/inspect.rb", "lib/capistrano/configuration/actions/invocation.rb", "lib/capistrano/configuration/callbacks.rb", "lib/capistrano/configuration/connections.rb", "lib/capistrano/configuration/execution.rb", "lib/capistrano/configuration/loading.rb", "lib/capistrano/configuration/namespaces.rb", "lib/capistrano/configuration/roles.rb", "lib/capistrano/configuration/servers.rb", "lib/capistrano/configuration/variables.rb", "lib/capistrano/configuration.rb", "lib/capistrano/errors.rb", "lib/capistrano/extensions.rb", "lib/capistrano/logger.rb", "lib/capistrano/processable.rb", "lib/capistrano/recipes/compat.rb", "lib/capistrano/recipes/deploy/dependencies.rb", "lib/capistrano/recipes/deploy/local_dependency.rb", "lib/capistrano/recipes/deploy/remote_dependency.rb", "lib/capistrano/recipes/deploy/scm/accurev.rb", "lib/capistrano/recipes/deploy/scm/base.rb", "lib/capistrano/recipes/deploy/scm/bzr.rb", "lib/capistrano/recipes/deploy/scm/cvs.rb", "lib/capistrano/recipes/deploy/scm/darcs.rb", "lib/capistrano/recipes/deploy/scm/git.rb", "lib/capistrano/recipes/deploy/scm/mercurial.rb", "lib/capistrano/recipes/deploy/scm/none.rb", "lib/capistrano/recipes/deploy/scm/perforce.rb", "lib/capistrano/recipes/deploy/scm/subversion.rb", "lib/capistrano/recipes/deploy/scm.rb", "lib/capistrano/recipes/deploy/strategy/base.rb", "lib/capistrano/recipes/deploy/strategy/checkout.rb", "lib/capistrano/recipes/deploy/strategy/copy.rb", "lib/capistrano/recipes/deploy/strategy/export.rb", "lib/capistrano/recipes/deploy/strategy/remote.rb", "lib/capistrano/recipes/deploy/strategy/remote_cache.rb", "lib/capistrano/recipes/deploy/strategy.rb", "lib/capistrano/recipes/deploy/templates/maintenance.rhtml", "lib/capistrano/recipes/deploy.rb", "lib/capistrano/recipes/standard.rb", "lib/capistrano/recipes/templates/maintenance.rhtml", "lib/capistrano/recipes/upgrade.rb", "lib/capistrano/role.rb", "lib/capistrano/server_definition.rb", "lib/capistrano/shell.rb", "lib/capistrano/ssh.rb", "lib/capistrano/task_definition.rb", "lib/capistrano/transfer.rb", "lib/capistrano/version.rb", "lib/capistrano.rb", "README.rdoc"]
14
+ s.files = ["bin/cap", "bin/capify", "CHANGELOG.rdoc", "examples/sample.rb", "lib/capistrano/callback.rb", "lib/capistrano/cli/execute.rb", "lib/capistrano/cli/help.rb", "lib/capistrano/cli/help.txt", "lib/capistrano/cli/options.rb", "lib/capistrano/cli/ui.rb", "lib/capistrano/cli.rb", "lib/capistrano/command.rb", "lib/capistrano/configuration/actions/file_transfer.rb", "lib/capistrano/configuration/actions/inspect.rb", "lib/capistrano/configuration/actions/invocation.rb", "lib/capistrano/configuration/callbacks.rb", "lib/capistrano/configuration/connections.rb", "lib/capistrano/configuration/execution.rb", "lib/capistrano/configuration/loading.rb", "lib/capistrano/configuration/namespaces.rb", "lib/capistrano/configuration/roles.rb", "lib/capistrano/configuration/servers.rb", "lib/capistrano/configuration/variables.rb", "lib/capistrano/configuration.rb", "lib/capistrano/errors.rb", "lib/capistrano/extensions.rb", "lib/capistrano/logger.rb", "lib/capistrano/processable.rb", "lib/capistrano/recipes/compat.rb", "lib/capistrano/recipes/deploy/dependencies.rb", "lib/capistrano/recipes/deploy/local_dependency.rb", "lib/capistrano/recipes/deploy/remote_dependency.rb", "lib/capistrano/recipes/deploy/scm/accurev.rb", "lib/capistrano/recipes/deploy/scm/base.rb", "lib/capistrano/recipes/deploy/scm/bzr.rb", "lib/capistrano/recipes/deploy/scm/cvs.rb", "lib/capistrano/recipes/deploy/scm/darcs.rb", "lib/capistrano/recipes/deploy/scm/git.rb", "lib/capistrano/recipes/deploy/scm/mercurial.rb", "lib/capistrano/recipes/deploy/scm/none.rb", "lib/capistrano/recipes/deploy/scm/perforce.rb", "lib/capistrano/recipes/deploy/scm/subversion.rb", "lib/capistrano/recipes/deploy/scm.rb", "lib/capistrano/recipes/deploy/strategy/base.rb", "lib/capistrano/recipes/deploy/strategy/checkout.rb", "lib/capistrano/recipes/deploy/strategy/copy.rb", "lib/capistrano/recipes/deploy/strategy/export.rb", "lib/capistrano/recipes/deploy/strategy/remote.rb", "lib/capistrano/recipes/deploy/strategy/remote_cache.rb", "lib/capistrano/recipes/deploy/strategy.rb", "lib/capistrano/recipes/deploy/templates/maintenance.rhtml", "lib/capistrano/recipes/deploy.rb", "lib/capistrano/recipes/standard.rb", "lib/capistrano/recipes/templates/maintenance.rhtml", "lib/capistrano/recipes/upgrade.rb", "lib/capistrano/role.rb", "lib/capistrano/server_definition.rb", "lib/capistrano/shell.rb", "lib/capistrano/ssh.rb", "lib/capistrano/task_definition.rb", "lib/capistrano/transfer.rb", "lib/capistrano/version.rb", "lib/capistrano.rb", "Rakefile", "README.rdoc", "setup.rb", "test/cli/execute_test.rb", "test/cli/help_test.rb", "test/cli/options_test.rb", "test/cli/ui_test.rb", "test/cli_test.rb", "test/command_test.rb", "test/configuration/actions/file_transfer_test.rb", "test/configuration/actions/inspect_test.rb", "test/configuration/actions/invocation_test.rb", "test/configuration/callbacks_test.rb", "test/configuration/connections_test.rb", "test/configuration/execution_test.rb", "test/configuration/loading_test.rb", "test/configuration/namespace_dsl_test.rb", "test/configuration/roles_test.rb", "test/configuration/servers_test.rb", "test/configuration/variables_test.rb", "test/configuration_test.rb", "test/deploy/local_dependency_test.rb", "test/deploy/remote_dependency_test.rb", "test/deploy/scm/accurev_test.rb", "test/deploy/scm/base_test.rb", "test/deploy/scm/git_test.rb", "test/deploy/scm/mercurial_test.rb", "test/deploy/strategy/copy_test.rb", "test/extensions_test.rb", "test/fixtures/cli_integration.rb", "test/fixtures/config.rb", "test/fixtures/custom.rb", "test/logger_test.rb", "test/role_test.rb", "test/server_definition_test.rb", "test/shell_test.rb", "test/ssh_test.rb", "test/task_definition_test.rb", "test/transfer_test.rb", "test/utils.rb", "Manifest", "capistrano.gemspec", "test/deploy/scm/none_test.rb", "test/deploy/scm/subversion_test.rb"]
15
+ s.has_rdoc = true
16
+ s.homepage = %q{http://www.capify.org}
17
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Capistrano", "--main", "README.rdoc"]
18
+ s.require_paths = ["lib"]
19
+ s.rubyforge_project = %q{capistrano}
20
+ s.rubygems_version = %q{1.3.1}
21
+ s.summary = %q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
22
+ s.test_files = ["test/cli/execute_test.rb", "test/cli/help_test.rb", "test/cli/options_test.rb", "test/cli/ui_test.rb", "test/cli_test.rb", "test/command_test.rb", "test/configuration/actions/file_transfer_test.rb", "test/configuration/actions/inspect_test.rb", "test/configuration/actions/invocation_test.rb", "test/configuration/callbacks_test.rb", "test/configuration/connections_test.rb", "test/configuration/execution_test.rb", "test/configuration/loading_test.rb", "test/configuration/namespace_dsl_test.rb", "test/configuration/roles_test.rb", "test/configuration/servers_test.rb", "test/configuration/variables_test.rb", "test/configuration_test.rb", "test/deploy/local_dependency_test.rb", "test/deploy/remote_dependency_test.rb", "test/deploy/scm/accurev_test.rb", "test/deploy/scm/base_test.rb", "test/deploy/scm/git_test.rb", "test/deploy/scm/mercurial_test.rb", "test/deploy/scm/none_test.rb", "test/deploy/scm/subversion_test.rb", "test/deploy/strategy/copy_test.rb", "test/extensions_test.rb", "test/logger_test.rb", "test/role_test.rb", "test/server_definition_test.rb", "test/shell_test.rb", "test/ssh_test.rb", "test/task_definition_test.rb", "test/transfer_test.rb"]
23
+
24
+ if s.respond_to? :specification_version then
25
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
26
+ s.specification_version = 2
27
+
28
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
29
+ s.add_runtime_dependency(%q<net-ssh>, [">= 2.0.14"])
30
+ s.add_runtime_dependency(%q<net-sftp>, [">= 2.0.0"])
31
+ s.add_runtime_dependency(%q<net-scp>, [">= 1.0.0"])
32
+ s.add_runtime_dependency(%q<net-ssh-gateway>, [">= 1.0.0"])
33
+ s.add_runtime_dependency(%q<highline>, [">= 0"])
34
+ else
35
+ s.add_dependency(%q<net-ssh>, [">= 2.0.14"])
36
+ s.add_dependency(%q<net-sftp>, [">= 2.0.0"])
37
+ s.add_dependency(%q<net-scp>, [">= 1.0.0"])
38
+ s.add_dependency(%q<net-ssh-gateway>, [">= 1.0.0"])
39
+ s.add_dependency(%q<highline>, [">= 0"])
40
+ end
41
+ else
42
+ s.add_dependency(%q<net-ssh>, [">= 2.0.14"])
43
+ s.add_dependency(%q<net-sftp>, [">= 2.0.0"])
44
+ s.add_dependency(%q<net-scp>, [">= 1.0.0"])
45
+ s.add_dependency(%q<net-ssh-gateway>, [">= 1.0.0"])
46
+ s.add_dependency(%q<highline>, [">= 0"])
47
+ end
48
+ end
@@ -21,7 +21,7 @@ module Capistrano
21
21
  #
22
22
  # Returns the Configuration instance used, if successful.
23
23
  def execute!
24
- config = instantiate_configuration
24
+ config = instantiate_configuration(options)
25
25
  config.debug = options[:debug]
26
26
  config.dry_run = options[:dry_run]
27
27
  config.logger.level = options[:verbose]
@@ -66,8 +66,8 @@ module Capistrano
66
66
 
67
67
  # Primarily useful for testing, but subclasses of CLI could conceivably
68
68
  # override this method to return a Configuration subclass or replacement.
69
- def instantiate_configuration #:nodoc:
70
- Capistrano::Configuration.new
69
+ def instantiate_configuration(options={}) #:nodoc:
70
+ Capistrano::Configuration.new(options)
71
71
  end
72
72
 
73
73
  def handle_error(error) #:nodoc:
@@ -81,4 +81,4 @@ module Capistrano
81
81
  end
82
82
  end
83
83
  end
84
- end
84
+ end
@@ -28,6 +28,9 @@ The following options are understood:
28
28
  <%= color '-h, --help', :bold %>
29
29
  Shows a brief summary of these options and exits.
30
30
 
31
+ <%= color '-l, --logger [STDERR|STDOUT|file]', :bold %>
32
+ Change the file used to print the output. It offers three options: standard error(stderr), standard output and file. Options are not case sensitive. By default Capistrano uses stderr.
33
+
31
34
  <%= color '-n, --dry-run', :bold %>
32
35
  Causes Capistrano to simply display each remote command, without executing it. In this sense it is similar to --debug, but without the prompt. Note that commands executed locally are still run--only remote commands are skipped.
33
36
 
@@ -72,4 +75,4 @@ The following options are understood:
72
75
  Execute tasks against this comma-separated list of host, but only if the host has the proper role for the task.
73
76
 
74
77
  <%= color 'ROLES', :bold %>
75
- Execute tasks against this comma-separated list of roles. Hosts which do not have the right roles will be skipped.
78
+ Execute tasks against this comma-separated list of roles. Hosts which do not have the right roles will be skipped.
@@ -54,6 +54,19 @@ module Capistrano
54
54
  exit
55
55
  end
56
56
 
57
+ opts.on("-l", "--logger [STDERR|STDOUT|file]",
58
+ "Choose logger method. STDERR used by default."
59
+ ) do |value|
60
+ options[:output] = if value.nil? || value.upcase == 'STDERR'
61
+ # Using default logger.
62
+ nil
63
+ elsif value.upcase == 'STDOUT'
64
+ $stdout
65
+ else
66
+ value
67
+ end
68
+ end
69
+
57
70
  opts.on("-n", "--dry-run",
58
71
  "Prints out commands without running them."
59
72
  ) { |value| options[:dry_run] = true }
@@ -21,10 +21,10 @@ module Capistrano
21
21
  # The logger instance defined for this configuration.
22
22
  attr_accessor :debug, :logger, :dry_run
23
23
 
24
- def initialize #:nodoc:
24
+ def initialize(options={}) #:nodoc:
25
25
  @debug = false
26
26
  @dry_run = false
27
- @logger = Logger.new
27
+ @logger = Logger.new(options)
28
28
  end
29
29
 
30
30
  # make the DSL easier to read when using lazy evaluation via lambdas
@@ -13,8 +13,10 @@ module Capistrano
13
13
  # The options hash may include a :hosts option (which should specify
14
14
  # an array of host names or ServerDefinition instances), a :roles
15
15
  # option (specifying an array of roles), an :only option (specifying
16
- # a hash of key/value pairs that any matching server must match), and
17
- # an :exception option (like :only, but the inverse).
16
+ # a hash of key/value pairs that any matching server must match),
17
+ # an :exception option (like :only, but the inverse), and a
18
+ # :skip_hostfilter option to ignore the HOSTFILTER environment variable
19
+ # described below.
18
20
  #
19
21
  # Additionally, if the HOSTS environment variable is set, it will take
20
22
  # precedence over any other options. Similarly, the ROLES environment
@@ -40,7 +42,11 @@ module Capistrano
40
42
  hosts = server_list_from(ENV['HOSTS'] || options[:hosts])
41
43
 
42
44
  if hosts.any?
43
- filter_server_list(hosts.uniq)
45
+ if options[:skip_hostfilter]
46
+ hosts.uniq
47
+ else
48
+ filter_server_list(hosts.uniq)
49
+ end
44
50
  else
45
51
  roles = role_list_from(ENV['ROLES'] || options[:roles] || self.roles.keys)
46
52
  only = options[:only] || {}
@@ -49,7 +55,12 @@ module Capistrano
49
55
  servers = roles.inject([]) { |list, role| list.concat(self.roles[role]) }
50
56
  servers = servers.select { |server| only.all? { |key,value| server.options[key] == value } }
51
57
  servers = servers.reject { |server| except.any? { |key,value| server.options[key] == value } }
52
- filter_server_list(servers.uniq)
58
+
59
+ if options[:skip_hostfilter]
60
+ servers.uniq
61
+ else
62
+ filter_server_list(servers.uniq)
63
+ end
53
64
  end
54
65
  end
55
66
 
@@ -94,9 +94,18 @@ end
94
94
  # returns the command output as a string
95
95
  def run_locally(cmd)
96
96
  logger.trace "executing locally: #{cmd.inspect}" if logger
97
+ command_present?(cmd)
97
98
  `#{cmd}`
98
99
  end
99
100
 
101
+ # tests if the given command is present on the local system
102
+ def command_present?(cmd)
103
+ executable = cmd.to_s.split(" ").first
104
+ unless system("which #{executable}")
105
+ logger.important "executable '#{executable}' not present or not in $PATH on the local system!"
106
+ end
107
+ end
108
+
100
109
  # If a command is given, this will try to execute the given command, as
101
110
  # described below. Otherwise, it will return a string for use in embedding in
102
111
  # another command, for executing that command as described below.
@@ -291,6 +300,10 @@ namespace :deploy do
291
300
  Restarts your application. This works by calling the script/process/reaper \
292
301
  script under the current path.
293
302
 
303
+ If you are deploying a Rails 2.3.x application, you will need to install
304
+ these http://github.com/rails/irs_process_scripts (more info about why
305
+ on that page.)
306
+
294
307
  By default, this will be invoked via sudo as the `app' user. If \
295
308
  you wish to run it as a different user, set the :runner variable to \
296
309
  that user. If you are in an environment where you can't use sudo, set \
@@ -299,6 +312,7 @@ namespace :deploy do
299
312
  set :use_sudo, false
300
313
  DESC
301
314
  task :restart, :roles => :app, :except => { :no_release => true } do
315
+ warn "[DEPRECATED] `deploy:restart` is going to be changed to Passenger mod_rails' method after 2.5.9 - see http://is.gd/2BPeA"
302
316
  try_runner "#{current_path}/script/process/reaper"
303
317
  end
304
318
 
@@ -479,6 +493,7 @@ namespace :deploy do
479
493
  the :use_sudo variable to false.
480
494
  DESC
481
495
  task :start, :roles => :app do
496
+ warn "[DEPRECATED] `deploy:start` is going to be removed after 2.5.9 - see http://is.gd/2BPeA"
482
497
  run "cd #{current_path} && #{try_runner} nohup script/spin"
483
498
  end
484
499
 
@@ -494,6 +509,7 @@ namespace :deploy do
494
509
  the :use_sudo variable to false.
495
510
  DESC
496
511
  task :stop, :roles => :app do
512
+ warn "[DEPRECATED] `deploy:start` is going to be removed after 2.5.9 - see http://is.gd/2BPeA"
497
513
  run "if [ -f #{current_path}/tmp/pids/dispatch.spawner.pid ]; then #{try_runner} #{current_path}/script/process/reaper -a kill -r dispatch.spawner.pid; fi"
498
514
  try_runner "#{current_path}/script/process/reaper -a kill"
499
515
  end
@@ -540,6 +556,19 @@ namespace :deploy do
540
556
  require 'erb'
541
557
  on_rollback { run "rm #{shared_path}/system/maintenance.html" }
542
558
 
559
+ warn <<-EOHTACCESS
560
+
561
+ # Please add something like this to your site's htaccess to redirect users to the maintenance page.
562
+ # More Info: http://www.shiftcommathree.com/articles/make-your-rails-maintenance-page-respond-with-a-503
563
+
564
+ ErrorDocument 503 /system/maintenance.html
565
+ RewriteEngine On
566
+ RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$
567
+ RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
568
+ RewriteCond %{SCRIPT_FILENAME} !maintenance.html
569
+ RewriteRule ^.*$ - [redirect=503,last]
570
+ EOHTACCESS
571
+
543
572
  reason = ENV['REASON']
544
573
  deadline = ENV['UNTIL']
545
574
 
@@ -223,7 +223,7 @@ module Capistrano
223
223
  newrev = nil
224
224
  revdata.each_slice(2) do |refs|
225
225
  rev, ref = *refs
226
- if ref.sub(/refs\/.*?\//, '').strip == revision
226
+ if ref.sub(/refs\/.*?\//, '').strip == revision.to_s
227
227
  newrev = rev
228
228
  break
229
229
  end
@@ -56,7 +56,7 @@ module Capistrano
56
56
  result = yield(command)
57
57
  yaml = YAML.load(result)
58
58
  raise "tried to run `#{command}' and got unexpected result #{result.inspect}" unless Hash === yaml
59
- yaml['Last Changed Rev'] || yaml['Revision']
59
+ [ (yaml['Last Changed Rev'] || 0).to_i, (yaml['Revision'] || 0).to_i ].max
60
60
  end
61
61
 
62
62
  # Increments the given revision number and returns it.
@@ -50,7 +50,7 @@ module Capistrano
50
50
  def system(*args)
51
51
  cmd = args.join(' ')
52
52
  if RUBY_PLATFORM =~ /win32/
53
- cmd.gsub!('/','\\') # Replace / with \\
53
+ cmd = cmd.split(/\s+/).collect {|w| w.match(/^[\w+]+:\/\//) ? w : w.gsub('/', '\\') }.join(' ') # Split command by spaces, change / by \\ unless element is a some+thing://
54
54
  cmd.gsub!(/^cd /,'cd /D ') # Replace cd with cd /D
55
55
  cmd.gsub!(/&& cd /,'&& cd /D ') # Replace cd with cd /D
56
56
  logger.trace "executing locally: #{cmd}"
@@ -182,10 +182,13 @@ module Capistrano
182
182
 
183
183
  # The compression method to use, defaults to :gzip.
184
184
  def compression
185
+ remote_tar = configuration[:copy_remote_tar] || 'tar'
186
+ local_tar = configuration[:copy_local_tar] || 'tar'
187
+
185
188
  type = configuration[:copy_compression] || :gzip
186
189
  case type
187
- when :gzip, :gz then Compression.new("tar.gz", %w(tar czf), %w(tar xzf))
188
- when :bzip2, :bz2 then Compression.new("tar.bz2", %w(tar cjf), %w(tar xjf))
190
+ when :gzip, :gz then Compression.new("tar.gz", [local_tar, 'czf'], [remote_tar, 'xzf'])
191
+ when :bzip2, :bz2 then Compression.new("tar.bz2", [local_tar, 'cjf'], [remote_tar, 'xjf'])
189
192
  when :zip then Compression.new("zip", %w(zip -qr), %w(unzip -q))
190
193
  else raise ArgumentError, "invalid compression type #{type.inspect}"
191
194
  end
@@ -6,7 +6,7 @@ module Capistrano
6
6
  class Version < Net::SSH::Version
7
7
  MAJOR = 2
8
8
  MINOR = 5
9
- TINY = 8
9
+ TINY = 9
10
10
 
11
11
  # The current version, as a Version instance
12
12
  CURRENT = new(MAJOR, MINOR, TINY)
@@ -78,7 +78,7 @@ class ConfigurationServersTest < Test::Unit::TestCase
78
78
  ENV.delete('HOSTS')
79
79
  end
80
80
 
81
- def test_task_with_onlyhosts_environment_variable_should_apply_only_to_those_hosts
81
+ def test_task_with_hostfilter_environment_variable_should_apply_only_to_those_hosts
82
82
  ENV['HOSTFILTER'] = "app1,web1"
83
83
  task = new_task(:testing)
84
84
  assert_equal %w(app1 web1).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
@@ -86,7 +86,7 @@ class ConfigurationServersTest < Test::Unit::TestCase
86
86
  ENV.delete('HOSTFILTER')
87
87
  end
88
88
 
89
- def test_task_with_onlyhosts_environment_variable_should_filter_hosts_option
89
+ def test_task_with_hostfilter_environment_variable_should_filter_hosts_option
90
90
  ENV['HOSTFILTER'] = "foo"
91
91
  task = new_task(:testing, @config, :hosts => %w(foo bar))
92
92
  assert_equal %w(foo).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
@@ -94,6 +94,14 @@ class ConfigurationServersTest < Test::Unit::TestCase
94
94
  ENV.delete('HOSTFILTER')
95
95
  end
96
96
 
97
+ def test_task_with_hostfilter_environment_variable_and_skip_hostfilter_should_not_filter_hosts_option
98
+ ENV['HOSTFILTER'] = "foo"
99
+ task = new_task(:testing, @config, :hosts => %w(foo bar), :skip_hostfilter => true)
100
+ assert_equal %w(foo bar).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
101
+ ensure
102
+ ENV.delete('HOSTFILTER')
103
+ end
104
+
97
105
  def test_task_with_only_should_apply_only_to_matching_tasks
98
106
  task = new_task(:testing, @config, :roles => :app, :only => { :primary => true })
99
107
  assert_equal %w(app1), @config.find_servers_for_task(task).map { |s| s.host }
@@ -0,0 +1,32 @@
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
@@ -14,6 +14,50 @@ class DeployStrategyCopyTest < Test::Unit::TestCase
14
14
  @config.stubs(:source).returns(@source)
15
15
  @strategy = Capistrano::Deploy::Strategy::Copy.new(@config)
16
16
  end
17
+
18
+ def test_deploy_with_defaults_should_use_remote_gtar
19
+ @config[:copy_remote_tar] = 'gtar'
20
+
21
+ Dir.expects(:tmpdir).returns("/temp/dir")
22
+ @source.expects(:checkout).with("154", "/temp/dir/1234567890").returns(:local_checkout)
23
+ @strategy.expects(:system).with(:local_checkout)
24
+
25
+ Dir.expects(:chdir).with("/temp/dir").yields
26
+ @strategy.expects(:system).with("tar czf 1234567890.tar.gz 1234567890")
27
+ @strategy.expects(:upload).with("/temp/dir/1234567890.tar.gz", "/tmp/1234567890.tar.gz")
28
+ @strategy.expects(:run).with("cd /u/apps/test/releases && gtar xzf /tmp/1234567890.tar.gz && rm /tmp/1234567890.tar.gz")
29
+
30
+ mock_file = mock("file")
31
+ mock_file.expects(:puts).with("154")
32
+ File.expects(:open).with("/temp/dir/1234567890/REVISION", "w").yields(mock_file)
33
+
34
+ FileUtils.expects(:rm).with("/temp/dir/1234567890.tar.gz")
35
+ FileUtils.expects(:rm_rf).with("/temp/dir/1234567890")
36
+
37
+ @strategy.deploy!
38
+ end
39
+
40
+ def test_deploy_with_defaults_should_use_local_gtar
41
+ @config[:copy_local_tar] = 'gtar'
42
+
43
+ Dir.expects(:tmpdir).returns("/temp/dir")
44
+ @source.expects(:checkout).with("154", "/temp/dir/1234567890").returns(:local_checkout)
45
+ @strategy.expects(:system).with(:local_checkout)
46
+
47
+ Dir.expects(:chdir).with("/temp/dir").yields
48
+ @strategy.expects(:system).with("gtar czf 1234567890.tar.gz 1234567890")
49
+ @strategy.expects(:upload).with("/temp/dir/1234567890.tar.gz", "/tmp/1234567890.tar.gz")
50
+ @strategy.expects(:run).with("cd /u/apps/test/releases && tar xzf /tmp/1234567890.tar.gz && rm /tmp/1234567890.tar.gz")
51
+
52
+ mock_file = mock("file")
53
+ mock_file.expects(:puts).with("154")
54
+ File.expects(:open).with("/temp/dir/1234567890/REVISION", "w").yields(mock_file)
55
+
56
+ FileUtils.expects(:rm).with("/temp/dir/1234567890.tar.gz")
57
+ FileUtils.expects(:rm_rf).with("/temp/dir/1234567890")
58
+
59
+ @strategy.deploy!
60
+ end
17
61
 
18
62
  def test_deploy_with_defaults_should_use_tar_gz_and_checkout
19
63
  Dir.expects(:tmpdir).returns("/temp/dir")
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.8
4
+ version: 2.5.9
5
5
  platform: ruby
6
6
  authors:
7
- - Jamis Buck
8
- - Lee Hambley
7
+ - Jamis Buck, Lee Hambley
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
11
 
13
- date: 2009-07-07 00:00:00 +01:00
12
+ date: 2009-09-12 00:00:00 +01:00
14
13
  default_executable:
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
@@ -21,7 +20,7 @@ dependencies:
21
20
  requirements:
22
21
  - - ">="
23
22
  - !ruby/object:Gem::Version
24
- version: 2.0.10
23
+ version: 2.0.14
25
24
  version:
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: net-sftp
@@ -63,18 +62,10 @@ dependencies:
63
62
  - !ruby/object:Gem::Version
64
63
  version: "0"
65
64
  version:
66
- - !ruby/object:Gem::Dependency
67
- name: echoe
68
- type: :development
69
- version_requirement:
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: "0"
75
- version:
76
65
  description: Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.
77
- email: lee.hambley@gmail.com
66
+ email:
67
+ - jamis@jamisbuck.org
68
+ - lee.hambley@gmail.com
78
69
  executables:
79
70
  - cap
80
71
  - capify
@@ -247,11 +238,9 @@ files:
247
238
  - test/transfer_test.rb
248
239
  - test/utils.rb
249
240
  - Manifest
250
- - test/deploy/scm/none_test.rb
241
+ - capistrano.gemspec
251
242
  has_rdoc: true
252
243
  homepage: http://www.capify.org
253
- licenses: []
254
-
255
244
  post_install_message:
256
245
  rdoc_options:
257
246
  - --line-numbers
@@ -277,10 +266,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
266
  requirements: []
278
267
 
279
268
  rubyforge_project: capistrano
280
- rubygems_version: 1.3.4
269
+ rubygems_version: 1.3.1
281
270
  signing_key:
282
271
  specification_version: 2
283
- summary: Simple. The way it should be.
272
+ summary: Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.
284
273
  test_files:
285
274
  - test/cli/execute_test.rb
286
275
  - test/cli/help_test.rb
@@ -307,6 +296,7 @@ test_files:
307
296
  - test/deploy/scm/git_test.rb
308
297
  - test/deploy/scm/mercurial_test.rb
309
298
  - test/deploy/scm/none_test.rb
299
+ - test/deploy/scm/subversion_test.rb
310
300
  - test/deploy/strategy/copy_test.rb
311
301
  - test/extensions_test.rb
312
302
  - test/logger_test.rb