mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
part 2, rename switchtower -> capistrano
git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@3786 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
88a09bb1d3
commit
6efd009569
39 changed files with 59 additions and 57 deletions
|
@ -1,5 +1,7 @@
|
|||
*1.0.2* *SVN*
|
||||
|
||||
* Rename to capistrano
|
||||
|
||||
* Make the generated switchtower.rake file use rake namespaces, and include all default tasks
|
||||
|
||||
* Look for config/deploy.rb and stasks file by default
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2005 Jamis Buck
|
||||
Copyright (c) 2005,2006 Jamis Buck
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
|
24
README
24
README
|
@ -1,35 +1,35 @@
|
|||
= SwitchTower
|
||||
= Capistrano
|
||||
|
||||
SwitchTower is a utility and framework for executing commands in parallel on multiple remote machines, via SSH. It uses a simple DSL (borrowed in part from Rake, http://rake.rubyforge.org/) that allows you to define _tasks_, which may be applied to machines in certain roles. It also supports tunneling connections via some gateway machine to allow operations to be performed behind VPN's and firewalls.
|
||||
Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH. It uses a simple DSL (borrowed in part from Rake, http://rake.rubyforge.org/) that allows you to define _tasks_, which may be applied to machines in certain roles. It also supports tunneling connections via some gateway machine to allow operations to be performed behind VPN's and firewalls.
|
||||
|
||||
SwitchTower was originally designed to simplify and automate deployment of web applications to distributed environments, and so it comes with many tasks predefined for that ("update_code" and "deploy", for instance).
|
||||
Capistrano was originally designed to simplify and automate deployment of web applications to distributed environments, and so it comes with many tasks predefined for that ("update_code" and "deploy", for instance).
|
||||
|
||||
== Dependencies
|
||||
|
||||
SwitchTower depends upon the Net::SSH library by Jamis Buck (http://net-ssh.rubyforge.org). Net::SSH itself depends on the Needle library (http://needle.rubyforge.org), also by Jamis Buck.
|
||||
Capistrano depends upon the Net::SSH library by Jamis Buck (http://net-ssh.rubyforge.org). Net::SSH itself depends on the Needle library (http://needle.rubyforge.org), also by Jamis Buck.
|
||||
|
||||
== Assumptions
|
||||
|
||||
In keeping with Rails' "convention over configuration", SwitchTower makes several assumptions about how you will use it (most, if not all, of which may be explicitly overridden):
|
||||
In keeping with Rails' "convention over configuration", Capistrano makes several assumptions about how you will use it (most, if not all, of which may be explicitly overridden):
|
||||
|
||||
* You are writing web applications and want to use SwitchTower to deploy them.
|
||||
* You are writing web applications and want to use Capistrano to deploy them.
|
||||
* You are using Ruby on Rails (http://www.rubyonrails.com) to build your apps.
|
||||
* You are using Subversion (http://subversion.tigris.org/) to manage your source code.
|
||||
* You are running your apps using FastCGI, together with Rails' spinner/reaper utilities.
|
||||
|
||||
As with the rest of Rails, if you can abide by these assumptions, you can use SwitchTower "out of the box". If any of these assumptions do not hold, you'll need to make some adjustments to your deployment recipe files.
|
||||
As with the rest of Rails, if you can abide by these assumptions, you can use Capistrano "out of the box". If any of these assumptions do not hold, you'll need to make some adjustments to your deployment recipe files.
|
||||
|
||||
== Usage
|
||||
|
||||
More documentation is always pending, but you'll want to see the user manual for detailed usage instructions. (The manual is online at http://manuals.rubyonrails.org/read/book/17).
|
||||
|
||||
In general, you'll use SwitchTower as follows:
|
||||
In general, you'll use Capistrano as follows:
|
||||
|
||||
* Create a deployment recipe ("deploy.rb") for your application. You can use the sample recipe in examples/sample.rb as a starting point.
|
||||
* Use the +switchtower+ script to execute your recipe (see below).
|
||||
* Use the +cap+ script to execute your recipe (see below).
|
||||
|
||||
Use the +switchtower+ script as follows:
|
||||
Use the +cap+ script as follows:
|
||||
|
||||
switchtower -r deploy -a someaction -vvv
|
||||
cap -vvv someaction
|
||||
|
||||
The <tt>-r</tt> switch specifies the recipe to use, and the <tt>-a</tt> switch specifies which action you want to execute. You can the <tt>-v</tt> switch multiple times (as shown) to increase the verbosity of the output.
|
||||
By default, the script will look for a file called one of <tt>config/deploy</tt>, <tt>config/deploy.rb</tt>, <tt>capistrano</tt>, or <tt>capistrano.rb</tt>. You can the <tt>-v</tt> switch multiple times (as shown) to increase the verbosity of the output. The +someaction+ text indicates which action to execute.
|
||||
|
|
8
Rakefile
8
Rakefile
|
@ -5,11 +5,11 @@ require 'rake/packagetask'
|
|||
require 'rake/gempackagetask'
|
||||
require 'rake/contrib/rubyforgepublisher'
|
||||
|
||||
require "./lib/switchtower/version"
|
||||
require "./lib/capistrano/version"
|
||||
|
||||
PKG_NAME = "switchtower"
|
||||
PKG_NAME = "capistrano"
|
||||
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
||||
PKG_VERSION = SwitchTower::Version::STRING + PKG_BUILD
|
||||
PKG_VERSION = Capistrano::Version::STRING + PKG_BUILD
|
||||
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
||||
|
||||
desc "Default task"
|
||||
|
@ -35,7 +35,7 @@ end
|
|||
desc "Build the RDoc API documentation"
|
||||
Rake::RDocTask.new do |rdoc|
|
||||
rdoc.rdoc_dir = "doc"
|
||||
rdoc.title = "SwitchTower -- A framework for remote command execution"
|
||||
rdoc.title = "Capistrano -- A framework for remote command execution"
|
||||
rdoc.options << '--line-numbers --inline-source --main README'
|
||||
rdoc.rdoc_files.include 'README'
|
||||
rdoc.rdoc_files.include 'lib/**/*.rb'
|
||||
|
|
|
@ -6,6 +6,6 @@ rescue LoadError
|
|||
# no rubygems to load, so we fail silently
|
||||
end
|
||||
|
||||
require 'switchtower/cli'
|
||||
require 'capistrano/cli'
|
||||
|
||||
SwitchTower::CLI.execute!
|
||||
Capistrano::CLI.execute!
|
|
@ -1,12 +1,12 @@
|
|||
require './lib/switchtower/version'
|
||||
require './lib/capistrano/version'
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
||||
s.name = 'switchtower'
|
||||
s.name = 'capistrano'
|
||||
s.version = PKG_VERSION
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.summary = <<-DESC.strip.gsub(/\n/, " ")
|
||||
SwitchTower is a framework and utility for executing commands in parallel
|
||||
Capistrano is a framework and utility for executing commands in parallel
|
||||
on multiple remote machines, via SSH. The primary goal is to simplify and
|
||||
automate the deployment of web applications.
|
||||
DESC
|
||||
|
@ -14,16 +14,16 @@ Gem::Specification.new do |s|
|
|||
s.files = Dir.glob("{bin,lib,examples,test}/**/*")
|
||||
s.files.concat %w(README MIT-LICENSE ChangeLog)
|
||||
s.require_path = 'lib'
|
||||
s.autorequire = 'switchtower'
|
||||
s.autorequire = 'capistrano'
|
||||
|
||||
s.bindir = "bin"
|
||||
s.executables << "switchtower"
|
||||
s.executables << "cap"
|
||||
|
||||
s.add_dependency 'net-ssh', ">= #{SwitchTower::Version::SSH_REQUIRED.join(".")}"
|
||||
s.add_dependency 'net-sftp', ">= #{SwitchTower::Version::SFTP_REQUIRED.join(".")}"
|
||||
s.add_dependency 'net-ssh', ">= #{Capistrano::Version::SSH_REQUIRED.join(".")}"
|
||||
s.add_dependency 'net-sftp', ">= #{Capistrano::Version::SFTP_REQUIRED.join(".")}"
|
||||
|
||||
s.author = "Jamis Buck"
|
||||
s.email = "jamis@37signals.com"
|
||||
s.homepage = "http://www.rubyonrails.com"
|
||||
s.homepage = "http://www.rubyonrails.org"
|
||||
|
||||
end
|
1
lib/capistrano.rb
Normal file
1
lib/capistrano.rb
Normal file
|
@ -0,0 +1 @@
|
|||
require 'capistrano/configuration'
|
|
@ -1 +0,0 @@
|
|||
require 'switchtower/configuration'
|
|
@ -2,9 +2,9 @@ $:.unshift File.dirname(__FILE__) + "/../lib"
|
|||
|
||||
require 'stringio'
|
||||
require 'test/unit'
|
||||
require 'switchtower/actor'
|
||||
require 'switchtower/logger'
|
||||
require 'switchtower/configuration'
|
||||
require 'capistrano/actor'
|
||||
require 'capistrano/logger'
|
||||
require 'capistrano/configuration'
|
||||
|
||||
class ActorTest < Test::Unit::TestCase
|
||||
|
||||
|
@ -44,7 +44,7 @@ class ActorTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class TestActor < SwitchTower::Actor
|
||||
class TestActor < Capistrano::Actor
|
||||
attr_reader :factory
|
||||
|
||||
self.connection_factory = TestingConnectionFactory
|
||||
|
@ -80,7 +80,7 @@ class ActorTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def logger
|
||||
@logger ||= SwitchTower::Logger.new(:output => StringIO.new)
|
||||
@logger ||= Capistrano::Logger.new(:output => StringIO.new)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -267,7 +267,7 @@ class ActorTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_uppercase_variables
|
||||
config = SwitchTower::Configuration.new(TestActor)
|
||||
config = Capistrano::Configuration.new(TestActor)
|
||||
config.set :HELLO, "world"
|
||||
assert_equal "world", config.actor.instance_eval("HELLO")
|
||||
config.set :HELLO, "test"
|
||||
|
@ -283,12 +283,12 @@ class ActorTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_custom_extension
|
||||
assert SwitchTower.plugin(:custom, CustomExtension)
|
||||
assert Capistrano.plugin(:custom, CustomExtension)
|
||||
@actor.define_task :foo, :roles => :db do
|
||||
custom.do_something_extra(1, 2, 3)
|
||||
end
|
||||
assert_nothing_raised { @actor.foo }
|
||||
assert TestingCommand.invoked?
|
||||
assert SwitchTower.remove_plugin(:custom)
|
||||
assert Capistrano.remove_plugin(:custom)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ $:.unshift File.dirname(__FILE__) + "/../lib"
|
|||
|
||||
require 'stringio'
|
||||
require 'test/unit'
|
||||
require 'switchtower/command'
|
||||
require 'capistrano/command'
|
||||
|
||||
class CommandTest < Test::Unit::TestCase
|
||||
class MockSession
|
||||
|
@ -24,19 +24,19 @@ class CommandTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_command_executes_on_all_servers
|
||||
command = SwitchTower::Command.new(%w(server1 server2 server3),
|
||||
command = Capistrano::Command.new(%w(server1 server2 server3),
|
||||
"hello", nil, {}, @actor)
|
||||
assert_equal %w(server1 server2 server3), @actor.sessions.keys.sort
|
||||
end
|
||||
|
||||
def test_command_with_newlines
|
||||
command = SwitchTower::Command.new(%w(server1), "hello\nworld", nil, {},
|
||||
command = Capistrano::Command.new(%w(server1), "hello\nworld", nil, {},
|
||||
@actor)
|
||||
assert_equal "hello\\\nworld", command.command
|
||||
end
|
||||
|
||||
def test_command_with_windows_newlines
|
||||
command = SwitchTower::Command.new(%w(server1), "hello\r\nworld", nil, {},
|
||||
command = Capistrano::Command.new(%w(server1), "hello\r\nworld", nil, {},
|
||||
@actor)
|
||||
assert_equal "hello\\\nworld", command.command
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
$:.unshift File.dirname(__FILE__) + "/../lib"
|
||||
|
||||
require 'test/unit'
|
||||
require 'switchtower/configuration'
|
||||
require 'capistrano/configuration'
|
||||
require 'flexmock'
|
||||
|
||||
class ConfigurationTest < Test::Unit::TestCase
|
||||
|
@ -25,7 +25,7 @@ class ConfigurationTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def setup
|
||||
@config = SwitchTower::Configuration.new(MockActor)
|
||||
@config = Capistrano::Configuration.new(MockActor)
|
||||
@config.set :scm, MockSCM
|
||||
end
|
||||
|
||||
|
@ -210,12 +210,12 @@ class ConfigurationTest < Test::Unit::TestCase
|
|||
|
||||
def test_set_scm_to_darcs
|
||||
@config.set :scm, :darcs
|
||||
assert_equal "SwitchTower::SCM::Darcs", @config.source.class.name
|
||||
assert_equal "Capistrano::SCM::Darcs", @config.source.class.name
|
||||
end
|
||||
|
||||
def test_set_scm_to_subversion
|
||||
@config.set :scm, :subversion
|
||||
assert_equal "SwitchTower::SCM::Subversion", @config.source.class.name
|
||||
assert_equal "Capistrano::SCM::Subversion", @config.source.class.name
|
||||
end
|
||||
|
||||
def test_get_proc_variable_sets_original_value_hash
|
||||
|
|
4
test/fixtures/custom.rb
vendored
4
test/fixtures/custom.rb
vendored
|
@ -1,3 +1,3 @@
|
|||
SwitchTower.configuration(:must_exist).load do
|
||||
Capistrano.configuration(:must_exist).load do
|
||||
set :gateway, "foo"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,10 +2,10 @@ $:.unshift File.dirname(__FILE__) + "/../../lib"
|
|||
|
||||
require File.dirname(__FILE__) + "/../utils"
|
||||
require 'test/unit'
|
||||
require 'switchtower/scm/cvs'
|
||||
require 'capistrano/scm/cvs'
|
||||
|
||||
class ScmCvsTest < Test::Unit::TestCase
|
||||
class CvsTest < SwitchTower::SCM::Cvs
|
||||
class CvsTest < Capistrano::SCM::Cvs
|
||||
attr_accessor :story
|
||||
attr_reader :last_path
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ $:.unshift File.dirname(__FILE__) + "/../../lib"
|
|||
|
||||
require File.dirname(__FILE__) + "/../utils"
|
||||
require 'test/unit'
|
||||
require 'switchtower/scm/subversion'
|
||||
require 'capistrano/scm/subversion'
|
||||
|
||||
class ScmSubversionTest < Test::Unit::TestCase
|
||||
class SubversionTest < SwitchTower::SCM::Subversion
|
||||
class SubversionTest < Capistrano::SCM::Subversion
|
||||
attr_accessor :story
|
||||
attr_reader :last_path
|
||||
|
||||
|
@ -61,7 +61,7 @@ class ScmSubversionTest < Test::Unit::TestCase
|
|||
------------------------------------------------------------------------
|
||||
r1967 | minam | 2005-08-03 06:59:03 -0600 (Wed, 03 Aug 2005) | 2 lines
|
||||
|
||||
Initial commit of the new switchtower utility
|
||||
Initial commit of the new capistrano utility
|
||||
|
||||
------------------------------------------------------------------------
|
||||
MSG
|
||||
|
|
|
@ -2,7 +2,7 @@ $:.unshift File.dirname(__FILE__) + "/../lib"
|
|||
|
||||
require File.dirname(__FILE__) + "/utils"
|
||||
require 'test/unit'
|
||||
require 'switchtower/ssh'
|
||||
require 'capistrano/ssh'
|
||||
|
||||
class SSHTest < Test::Unit::TestCase
|
||||
class MockSSH
|
||||
|
@ -30,7 +30,7 @@ class SSHTest < Test::Unit::TestCase
|
|||
|
||||
def test_publickey_auth_succeeds_default_port_no_block
|
||||
Net.const_during(:SSH, MockSSH) do
|
||||
SwitchTower::SSH.connect('demo.server.i', @config)
|
||||
Capistrano::SSH.connect('demo.server.i', @config)
|
||||
end
|
||||
|
||||
assert_equal 1, MockSSH.invocations.length
|
||||
|
@ -45,7 +45,7 @@ class SSHTest < Test::Unit::TestCase
|
|||
|
||||
def test_publickey_auth_succeeds_explicit_port_no_block
|
||||
Net.const_during(:SSH, MockSSH) do
|
||||
SwitchTower::SSH.connect('demo.server.i', @config, 23)
|
||||
Capistrano::SSH.connect('demo.server.i', @config, 23)
|
||||
end
|
||||
|
||||
assert_equal 1, MockSSH.invocations.length
|
||||
|
@ -55,7 +55,7 @@ class SSHTest < Test::Unit::TestCase
|
|||
|
||||
def test_publickey_auth_succeeds_with_block
|
||||
Net.const_during(:SSH, MockSSH) do
|
||||
SwitchTower::SSH.connect('demo.server.i', @config) do |session|
|
||||
Capistrano::SSH.connect('demo.server.i', @config) do |session|
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -67,7 +67,7 @@ class SSHTest < Test::Unit::TestCase
|
|||
MockSSH.story << Net::SSH::AuthenticationFailed
|
||||
|
||||
Net.const_during(:SSH, MockSSH) do
|
||||
SwitchTower::SSH.connect('demo.server.i', @config)
|
||||
Capistrano::SSH.connect('demo.server.i', @config)
|
||||
end
|
||||
|
||||
assert_equal 2, MockSSH.invocations.length
|
||||
|
@ -87,7 +87,7 @@ class SSHTest < Test::Unit::TestCase
|
|||
|
||||
Net.const_during(:SSH, MockSSH) do
|
||||
assert_raises(Net::SSH::AuthenticationFailed) do
|
||||
SwitchTower::SSH.connect('demo.server.i', @config)
|
||||
Capistrano::SSH.connect('demo.server.i', @config)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue