From 4acea20bebc0e142a410ad21c9538e69398e2937 Mon Sep 17 00:00:00 2001 From: Lee Hambley Date: Tue, 2 Apr 2013 20:26:59 +0200 Subject: [PATCH] Strip trailing whitespace from all files (That is [spaceliteraltab] to type a tab on the CLI do Ctrl+v, tab) git ls-files | xargs sed -i '' -e 's/[ ]*$//' ]' --- Gemfile | 2 +- capistrano.gemspec | 2 +- lib/capistrano/cli.rb | 2 +- lib/capistrano/cli/execute.rb | 6 ++--- lib/capistrano/cli/help.rb | 6 ++--- lib/capistrano/configuration/execution.rb | 4 ++-- lib/capistrano/configuration/loading.rb | 4 ++-- lib/capistrano/configuration/roles.rb | 2 +- lib/capistrano/configuration/servers.rb | 12 +++++----- lib/capistrano/errors.rb | 8 +++---- lib/capistrano/ext/multistage.rb | 2 +- lib/capistrano/recipes/deploy/dependencies.rb | 2 +- .../recipes/deploy/remote_dependency.rb | 22 +++++++++---------- lib/capistrano/recipes/deploy/scm/accurev.rb | 12 +++++----- lib/capistrano/recipes/deploy/scm/cvs.rb | 8 +++---- lib/capistrano/recipes/deploy/scm/darcs.rb | 6 ++--- lib/capistrano/recipes/deploy/scm/git.rb | 2 +- .../recipes/deploy/scm/mercurial.rb | 6 ++--- lib/capistrano/recipes/deploy/scm/none.rb | 8 +++---- lib/capistrano/recipes/deploy/scm/perforce.rb | 2 +- lib/capistrano/ssh.rb | 2 +- test/cli/options_test.rb | 2 +- test/configuration/callbacks_test.rb | 2 +- test/configuration/namespace_dsl_test.rb | 12 +++++----- test/configuration/roles_test.rb | 4 ++-- test/configuration/servers_test.rb | 6 ++--- test/configuration/variables_test.rb | 4 ++-- test/deploy/scm/bzr_test.rb | 2 +- test/deploy/scm/darcs_test.rb | 4 ++-- test/deploy/scm/mercurial_test.rb | 6 ++--- test/server_definition_test.rb | 4 ++-- test/shell_test.rb | 12 +++++----- 32 files changed, 89 insertions(+), 89 deletions(-) diff --git a/Gemfile b/Gemfile index 4c02ce01..16829b07 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source "http://rubygems.org" gemspec # -# Development Dependencies from the Gemfile +# Development Dependencies from the Gemfile # are merged here. # group :development do diff --git a/capistrano.gemspec b/capistrano.gemspec index f178522a..0444bafc 100644 --- a/capistrano.gemspec +++ b/capistrano.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| ] s.specification_version = 3 if s.respond_to? :specification_version - + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 2.0.14"]) diff --git a/lib/capistrano/cli.rb b/lib/capistrano/cli.rb index e2ceec46..5dd17ef3 100644 --- a/lib/capistrano/cli.rb +++ b/lib/capistrano/cli.rb @@ -20,7 +20,7 @@ module Capistrano # Capistrano::CLI.parse(%W(-vvvv -f config/deploy update_code)).execute! # # Note that you can also embed cap directly by creating a new Configuration - # instance and setting it up, The above snippet, redone using the + # instance and setting it up, The above snippet, redone using the # Configuration class directly, would look like: # # require 'capistrano' diff --git a/lib/capistrano/cli/execute.rb b/lib/capistrano/cli/execute.rb index d2aca9c3..3d38c87e 100644 --- a/lib/capistrano/cli/execute.rb +++ b/lib/capistrano/cli/execute.rb @@ -55,10 +55,10 @@ module Capistrano def load_recipes(config) #:nodoc: # load the standard recipe definition config.load "standard" - + # load systemwide config/recipe definition - config.load(options[:sysconf]) if options[:sysconf] && File.file?(options[:sysconf]) - + config.load(options[:sysconf]) if options[:sysconf] && File.file?(options[:sysconf]) + # load user config/recipe definition config.load(options[:dotfile]) if options[:dotfile] && File.file?(options[:dotfile]) diff --git a/lib/capistrano/cli/help.rb b/lib/capistrano/cli/help.rb index e7a202c0..31cdc077 100644 --- a/lib/capistrano/cli/help.rb +++ b/lib/capistrano/cli/help.rb @@ -111,14 +111,14 @@ module Capistrano end def output_columns #:nodoc: - if ( @output_columns.nil? ) + if ( @output_columns.nil? ) if ( self.class.ui.output_cols.nil? ) - @output_columns = 80 + @output_columns = 80 else @output_columns = self.class.ui.output_cols end end - @output_columns + @output_columns end end end diff --git a/lib/capistrano/configuration/execution.rb b/lib/capistrano/configuration/execution.rb index b6836dd1..2497fe22 100644 --- a/lib/capistrano/configuration/execution.rb +++ b/lib/capistrano/configuration/execution.rb @@ -27,8 +27,8 @@ module Capistrano def task_call_frames Thread.current[:task_call_frames] ||= [] end - - + + # The stack of tasks that have registered rollback handlers within the # current transaction. If this is nil, then there is no transaction # that is currently active. diff --git a/lib/capistrano/configuration/loading.rb b/lib/capistrano/configuration/loading.rb index 3482717a..c2b98c77 100644 --- a/lib/capistrano/configuration/loading.rb +++ b/lib/capistrano/configuration/loading.rb @@ -141,9 +141,9 @@ module Capistrano # look to see if this specific configuration instance has ever seen # these arguments to require before if @loaded_features.include?(args) - return false + return false end - + @loaded_features << args begin original_instance, self.class.instance = self.class.instance, self diff --git a/lib/capistrano/configuration/roles.rb b/lib/capistrano/configuration/roles.rb index a52f7fac..7492144a 100644 --- a/lib/capistrano/configuration/roles.rb +++ b/lib/capistrano/configuration/roles.rb @@ -68,7 +68,7 @@ module Capistrano raise ArgumentError, "you must associate a server with at least one role" if roles.empty? roles.each { |name| role(name, host, options) } end - + def role_names_for_host(host) roles.map {|role_name, role| role_name if role.include?(host) }.compact || [] end diff --git a/lib/capistrano/configuration/servers.rb b/lib/capistrano/configuration/servers.rb index 76df3e82..f37ced47 100644 --- a/lib/capistrano/configuration/servers.rb +++ b/lib/capistrano/configuration/servers.rb @@ -13,8 +13,8 @@ module Capistrano # The options hash may include a :hosts option (which should specify # an array of host names or ServerDefinition instances), a :roles # option (specifying an array of roles), an :only option (specifying - # a hash of key/value pairs that any matching server must match), - # an :exception option (like :only, but the inverse), and a + # a hash of key/value pairs that any matching server must match), + # an :exception option (like :only, but the inverse), and a # :skip_hostfilter option to ignore the HOSTFILTER environment variable # described below. # @@ -27,7 +27,7 @@ module Capistrano # will limit the result to hosts found in that (comma-separated) list. # # If the HOSTROLEFILTER environment variable is set, it will limit the - # result to hosts found in that (comma-separated) list of roles + # result to hosts found in that (comma-separated) list of roles # # Usage: # @@ -44,9 +44,9 @@ module Capistrano def find_servers(options={}) return [] if options.key?(:hosts) && (options[:hosts].nil? || [] == options[:hosts]) return [] if options.key?(:roles) && (options[:roles].nil? || [] == options[:roles]) - + hosts = server_list_from(ENV['HOSTS'] || options[:hosts]) - + if hosts.any? if options[:skip_hostfilter] hosts.uniq @@ -59,7 +59,7 @@ module Capistrano only = options[:only] || {} except = options[:except] || {} - + # If we don't have a def for a role it means its bogus, skip it so higher level can handle servers = roles.inject([]) { |list, role| list.concat(self.roles[role] || []) } servers = servers.select { |server| only.all? { |key,value| server.options[key] == value } } diff --git a/lib/capistrano/errors.rb b/lib/capistrano/errors.rb index e7f308b8..a3b5af73 100644 --- a/lib/capistrano/errors.rb +++ b/lib/capistrano/errors.rb @@ -1,11 +1,11 @@ module Capistrano - + Error = Class.new(RuntimeError) CaptureError = Class.new(Capistrano::Error) NoSuchTaskError = Class.new(Capistrano::Error) NoMatchingServersError = Class.new(Capistrano::Error) - + class RemoteError < Error attr_accessor :hosts end @@ -13,7 +13,7 @@ module Capistrano ConnectionError = Class.new(Capistrano::RemoteError) TransferError = Class.new(Capistrano::RemoteError) CommandError = Class.new(Capistrano::RemoteError) - + LocalArgumentError = Class.new(Capistrano::Error) - + end diff --git a/lib/capistrano/ext/multistage.rb b/lib/capistrano/ext/multistage.rb index e6b2528f..1f8f6430 100644 --- a/lib/capistrano/ext/multistage.rb +++ b/lib/capistrano/ext/multistage.rb @@ -39,7 +39,7 @@ Capistrano::Configuration.instance.load do else abort "No stage specified. Please specify one of: #{stages.join(', ')} (e.g. `cap #{stages.first} #{ARGV.last}')" end - end + end end desc "Stub out the staging config files." diff --git a/lib/capistrano/recipes/deploy/dependencies.rb b/lib/capistrano/recipes/deploy/dependencies.rb index 23b21eb0..67cd7964 100644 --- a/lib/capistrano/recipes/deploy/dependencies.rb +++ b/lib/capistrano/recipes/deploy/dependencies.rb @@ -18,7 +18,7 @@ module Capistrano yield self self end - + def remote dep = RemoteDependency.new(configuration) @dependencies << dep diff --git a/lib/capistrano/recipes/deploy/remote_dependency.rb b/lib/capistrano/recipes/deploy/remote_dependency.rb index 21576ce4..75d526c1 100644 --- a/lib/capistrano/recipes/deploy/remote_dependency.rb +++ b/lib/capistrano/recipes/deploy/remote_dependency.rb @@ -58,31 +58,31 @@ module Capistrano def match(command, expect, options={}) expect = Regexp.new(Regexp.escape(expect.to_s)) unless expect.is_a?(Regexp) - output_per_server = {} - try("#{command} ", options) do |ch, stream, out| - output_per_server[ch[:server]] ||= '' - output_per_server[ch[:server]] += out - end + output_per_server = {} + try("#{command} ", options) do |ch, stream, out| + output_per_server[ch[:server]] ||= '' + output_per_server[ch[:server]] += out + end # It is possible for some of these commands to return a status != 0 # (for example, rake --version exits with a 1). For this check we # just care if the output matches, so we reset the success flag. @success = true - errored_hosts = [] - output_per_server.each_pair do |server, output| + errored_hosts = [] + output_per_server.each_pair do |server, output| next if output =~ expect - errored_hosts << server - end + errored_hosts << server + end if errored_hosts.any? @hosts = errored_hosts.join(', ') output = output_per_server[errored_hosts.first] @message = "the output #{output.inspect} from #{command.inspect} did not match #{expect.inspect}" @success = false - end + end - self + self end def or(message) diff --git a/lib/capistrano/recipes/deploy/scm/accurev.rb b/lib/capistrano/recipes/deploy/scm/accurev.rb index 8363deaa..6b4a87dd 100644 --- a/lib/capistrano/recipes/deploy/scm/accurev.rb +++ b/lib/capistrano/recipes/deploy/scm/accurev.rb @@ -14,9 +14,9 @@ module Capistrano # * :repository - This should match the depot that code lives in. If your code # exists in a subdirectory, you can append the path depot. # eg. foo-depot/bar_dir - # * :stream - The stream in the depot that code should be pulled from. If + # * :stream - The stream in the depot that code should be pulled from. If # left blank, the depot stream will be used - # * :revision - Should be in the form 'stream/transaction'. + # * :revision - Should be in the form 'stream/transaction'. class Accurev < Base include REXML default_command 'accurev' @@ -54,10 +54,10 @@ module Capistrano end end - # Pops a copy of the code for the specified Accurev revision identifier. + # Pops a copy of the code for the specified Accurev revision identifier. # The revision identifier is represented as a stream & transaction ID combo. # Accurev can only pop a particular transaction if a stream is created on the server - # with a time basis of that transaction id. Therefore, we will create a stream with + # with a time basis of that transaction id. Therefore, we will create a stream with # the required criteria and pop that. def export(revision_id, destination) revision = InternalRevision.parse(revision_id) @@ -89,7 +89,7 @@ module Capistrano ].join(' | ') end - # Returns the command needed to show the diff between what is deployed and what is + # Returns the command needed to show the diff between what is deployed and what is # pending. Because Accurev can not do this task without creating some streams, # two time basis streams will be created for the purposes of doing the diff. def diff(from, to=head) @@ -156,7 +156,7 @@ module Capistrano end def to_s - "#{stream}/#{transaction_id}" + "#{stream}/#{transaction_id}" end def ==(other) diff --git a/lib/capistrano/recipes/deploy/scm/cvs.rb b/lib/capistrano/recipes/deploy/scm/cvs.rb index cadc3088..9f51b160 100644 --- a/lib/capistrano/recipes/deploy/scm/cvs.rb +++ b/lib/capistrano/recipes/deploy/scm/cvs.rb @@ -63,7 +63,7 @@ module Capistrano scm cvs_root, :log, range_arg end - # Unfortunately, cvs doesn't support the concept of a revision number like + # Unfortunately, cvs doesn't support the concept of a revision number like # subversion and other SCM's do. For now, we'll rely on getting the timestamp # of the latest checkin under the revision that's passed to us. def query_revision(revision) @@ -99,7 +99,7 @@ module Capistrano root << "-d #{repository} " if repository root end - + # Constructs the destination dir command-line option def cvs_destination(destination) dest = "" @@ -109,7 +109,7 @@ module Capistrano end dest end - + # attempts to guess what type of revision we're working with def revision_type(rev) return :date if rev =~ /^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2} UTC$/ # i.e 2007-05-15 08:13:25 UTC @@ -117,7 +117,7 @@ module Capistrano return :revision if rev =~ /^\d/ # i.e. 1.2.1 return :tag # i.e. RELEASE_1_2 end - + # constructs the appropriate command-line switch for specifying a # "revision" in CVS. This could be a tag, branch, revision (i.e. 1.3) # or a date (to be used with -d) diff --git a/lib/capistrano/recipes/deploy/scm/darcs.rb b/lib/capistrano/recipes/deploy/scm/darcs.rb index 5126f654..4b04f026 100644 --- a/lib/capistrano/recipes/deploy/scm/darcs.rb +++ b/lib/capistrano/recipes/deploy/scm/darcs.rb @@ -25,13 +25,13 @@ module Capistrano "--to-match='hash #{revision}'" end end - + # Returns the command that will check out the given revision to the # given destination. The 'revision' parameter must be the 'hash' value # for the revision in question, as given by 'darcs changes --xml-output'. def checkout(revision, destination) - scm :get, *[verbose, - "--repo-name=#{destination}", + scm :get, *[verbose, + "--repo-name=#{destination}", to_match(revision), repository].compact end diff --git a/lib/capistrano/recipes/deploy/scm/git.rb b/lib/capistrano/recipes/deploy/scm/git.rb index 881eb12f..a9ac0ec9 100644 --- a/lib/capistrano/recipes/deploy/scm/git.rb +++ b/lib/capistrano/recipes/deploy/scm/git.rb @@ -133,7 +133,7 @@ module Capistrano git = command remote = origin - args = [] + args = [] # Add an option for the branch name so :git_shallow_clone works with branches args << "-b #{variable(:branch)}" unless variable(:branch).nil? diff --git a/lib/capistrano/recipes/deploy/scm/mercurial.rb b/lib/capistrano/recipes/deploy/scm/mercurial.rb index 27026035..1e820625 100644 --- a/lib/capistrano/recipes/deploy/scm/mercurial.rb +++ b/lib/capistrano/recipes/deploy/scm/mercurial.rb @@ -89,11 +89,11 @@ module Capistrano "yes\n" end end - + private # Fine grained mercurial commands - def clone(destination) + def clone(destination) scm :clone, verbose, "--noupdate", # do not update to tip when cloning is done @@ -124,7 +124,7 @@ module Capistrano else "--verbose" end end - + # honor Cap 2.1+'s :scm_prefer_prompt if present def scm_password_or_prompt @scm_password_or_prompt ||= variable(:scm_password) || diff --git a/lib/capistrano/recipes/deploy/scm/none.rb b/lib/capistrano/recipes/deploy/scm/none.rb index 2b217b2a..4b47dd45 100644 --- a/lib/capistrano/recipes/deploy/scm/none.rb +++ b/lib/capistrano/recipes/deploy/scm/none.rb @@ -19,7 +19,7 @@ module Capistrano # set :scm, :none # set :deploy_via, :copy # - # Dereference symbolic links. Copy files instead. Handy when you + # Dereference symbolic links. Copy files instead. Handy when you # reference files and directory outside of your deployment root. # set :copy_dereference_symlink, true @@ -41,13 +41,13 @@ module Capistrano def query_revision(revision) revision end - + # log: There's no log, so it just echos from and to. - + def log(from="", to="") "No SCM: #{from} - #{to}" end - + end end diff --git a/lib/capistrano/recipes/deploy/scm/perforce.rb b/lib/capistrano/recipes/deploy/scm/perforce.rb index 5a03a97e..d3a31aa9 100644 --- a/lib/capistrano/recipes/deploy/scm/perforce.rb +++ b/lib/capistrano/recipes/deploy/scm/perforce.rb @@ -113,7 +113,7 @@ module Capistrano def p4passwd variable(:p4passwd) || variable(:scm_password) end - + def p4charset variable(:p4charset) end diff --git a/lib/capistrano/ssh.rb b/lib/capistrano/ssh.rb index 2ed6f104..aebca982 100644 --- a/lib/capistrano/ssh.rb +++ b/lib/capistrano/ssh.rb @@ -70,7 +70,7 @@ module Capistrano port = server.port || options[:port] || ssh_options[:port] # the .ssh/config file might have changed the host-name on us - host = ssh_options.fetch(:host_name, server.host) + host = ssh_options.fetch(:host_name, server.host) ssh_options[:port] = port if port diff --git a/test/cli/options_test.rb b/test/cli/options_test.rb index f69802dc..055cf8a7 100644 --- a/test/cli/options_test.rb +++ b/test/cli/options_test.rb @@ -23,7 +23,7 @@ class CLIOptionsTest < Test::Unit::TestCase @cli.expects(:exit).raises(ExitException) assert_raises(ExitException) { @cli.parse_options! } end - + def test_parse_options_with_d_should_set_debug_option @cli.args << "-d" @cli.parse_options! diff --git a/test/configuration/callbacks_test.rb b/test/configuration/callbacks_test.rb index cc0673cc..054c367d 100644 --- a/test/configuration/callbacks_test.rb +++ b/test/configuration/callbacks_test.rb @@ -126,7 +126,7 @@ class ConfigurationCallbacksTest < Test::Unit::TestCase assert_equal 1, @config.callbacks[:before].length assert_equal %w(primary), @config.callbacks[:before].first.except end - + def test_on_without_tasks_or_block_should_raise_error assert_raises(ArgumentError) { @config.on(:before) } end diff --git a/test/configuration/namespace_dsl_test.rb b/test/configuration/namespace_dsl_test.rb index f3fa955f..ed3750ae 100644 --- a/test/configuration/namespace_dsl_test.rb +++ b/test/configuration/namespace_dsl_test.rb @@ -146,7 +146,7 @@ class ConfigurationNamespacesDSLTest < Test::Unit::TestCase def test_parent_for_namespace_should_be_the_top_level @config.namespace(:outer) {} - assert_equal @config, @config.namespaces[:outer].parent + assert_equal @config, @config.namespaces[:outer].parent end def test_fqn_for_nested_namespace_should_be_color_delimited @@ -238,7 +238,7 @@ class ConfigurationNamespacesDSLTest < Test::Unit::TestCase ns = @config.namespaces[:outer] assert ns.respond_to?(:original_initialize_called) end - + def test_namespace_should_accept_respond_to_with_include_priv_parameter @config.namespace(:outer) {} ns = @config.namespaces[:outer] @@ -308,16 +308,16 @@ class ConfigurationNamespacesDSLTest < Test::Unit::TestCase end assert_nil @config.find_task("outer::inner") end - + def test_kernel_method_clashing_should_not_affect_method_delegation_to_parent @config.class.class_eval do def some_weird_method() 'config' end end - + @config.namespace(:clash) {} namespace = @config.namespaces[:clash] assert_equal 'config', namespace.some_weird_method - + Kernel.module_eval do def some_weird_method() 'kernel' end end @@ -325,7 +325,7 @@ class ConfigurationNamespacesDSLTest < Test::Unit::TestCase @config.namespace(:clash2) {} namespace = @config.namespaces[:clash2] assert_equal 'config', namespace.some_weird_method - + Kernel.send :remove_method, :some_weird_method @config.class.send :remove_method, :some_weird_method end diff --git a/test/configuration/roles_test.rb b/test/configuration/roles_test.rb index 3d06c321..14de756a 100644 --- a/test/configuration/roles_test.rb +++ b/test/configuration/roles_test.rb @@ -21,14 +21,14 @@ class ConfigurationRolesTest < Test::Unit::TestCase assert @config.original_initialize_called assert @config.roles.empty? end - + def test_roles_for_host_with_one_role @config.role :app, "app1.capistrano.test" @config.role :not_app, "not-app.capistrano.test" app_server = @config.roles[:app].servers.first assert @config.role_names_for_host(app_server)==[ :app ] end - + def test_roles_for_host_with_multiple_roles @config.server "www.capistrano.test", :db, :worker db_server = @config.roles[:db].servers.first diff --git a/test/configuration/servers_test.rb b/test/configuration/servers_test.rb index 726c1521..a54edafb 100644 --- a/test/configuration/servers_test.rb +++ b/test/configuration/servers_test.rb @@ -163,7 +163,7 @@ class ConfigurationServersTest < Test::Unit::TestCase assert_equal %w(app1 app2 app3), @config.find_servers(:roles => lambda { :app }).map { |s| s.host }.sort assert_equal %w(app2 file), @config.find_servers(:roles => lambda { [:report, :file] }).map { |s| s.host }.sort end - + def test_find_servers_with_hosts_nil_or_empty assert_equal [], @config.find_servers(:hosts => nil) assert_equal [], @config.find_servers(:hosts => []) @@ -172,12 +172,12 @@ class ConfigurationServersTest < Test::Unit::TestCase result = @config.find_servers(:hosts => "app1") assert_equal 1, result.size end - + def test_find_servers_with_rolees_nil_or_empty assert_equal [], @config.find_servers(:roles => nil) assert_equal [], @config.find_servers(:roles => []) result = @config.find_servers(:roles => :report) assert_equal 1, result.size end - + end diff --git a/test/configuration/variables_test.rb b/test/configuration/variables_test.rb index 3bfd11b4..d5909320 100644 --- a/test/configuration/variables_test.rb +++ b/test/configuration/variables_test.rb @@ -53,13 +53,13 @@ class ConfigurationVariablesTest < Test::Unit::TestCase @config[:sample] = :value assert @config.respond_to?(:sample) end - + def test_respond_to_should_be_true_when_passed_a_string assert !@config.respond_to?('sample') @config[:sample] = :value assert @config.respond_to?('sample') end - + def test_respond_to_with_include_priv_paramter assert !@config.respond_to?(:sample, true) end diff --git a/test/deploy/scm/bzr_test.rb b/test/deploy/scm/bzr_test.rb index bb18b2b5..ca3f24ce 100644 --- a/test/deploy/scm/bzr_test.rb +++ b/test/deploy/scm/bzr_test.rb @@ -41,7 +41,7 @@ class DeploySCMBzrTest < Test::Unit::TestCase 'before:revid:aaaa@bbbb-1234567890', 'last:3', nil, {}, [], true, false, 1.34, ] - + revision_samples.each do |revivsion_spec| assert_equal(revivsion_spec, @source.query_revision(revivsion_spec), diff --git a/test/deploy/scm/darcs_test.rb b/test/deploy/scm/darcs_test.rb index db4ac122..45f10831 100644 --- a/test/deploy/scm/darcs_test.rb +++ b/test/deploy/scm/darcs_test.rb @@ -15,7 +15,7 @@ class DeploySCMDarcsTest < Test::Unit::TestCase # We should be able to pick a specific hash. def test_checkout_hash hsh = "*version_hash*" - assert_match(%r{--to-match=.hash #{Regexp.quote(hsh)}}, + assert_match(%r{--to-match=.hash #{Regexp.quote(hsh)}}, @source.checkout(hsh, "*foo_location*"), "Specifying a revision hash got the --to-match option wrong.") end @@ -31,7 +31,7 @@ class DeploySCMDarcsTest < Test::Unit::TestCase # Leaving the revision as nil shouldn't break anything. def test_checkout_nil assert_no_match(%r{--to-match}, @source.checkout(nil, "*foo_location*"), - "Leaving the revision as nil incorrectly produced a --to-match option.") + "Leaving the revision as nil incorrectly produced a --to-match option.") end end diff --git a/test/deploy/scm/mercurial_test.rb b/test/deploy/scm/mercurial_test.rb index e5976a02..2fcd1f8f 100644 --- a/test/deploy/scm/mercurial_test.rb +++ b/test/deploy/scm/mercurial_test.rb @@ -62,19 +62,19 @@ class DeploySCMMercurialTest < Test::Unit::TestCase @config[:scm_command] = "/opt/local/bin/hg" assert_equal "/opt/local/bin/hg pull --repository /var/www && /opt/local/bin/hg update --repository /var/www --clean 8a8e00b8f11b", @source.sync('8a8e00b8f11b', dest) end - + def test_export dest = "/var/www" assert_raise(NotImplementedError) { @source.export('8a8e00b8f11b', dest) } end - + def test_sends_password_if_set require 'capistrano/logger' text = "password:" @config[:scm_password] = "opensesame" assert_equal "opensesame\n", @source.handle_data(mock_state, :test_stream, text) end - + def test_prompts_for_password_if_preferred require 'capistrano/logger' require 'capistrano/cli' diff --git a/test/server_definition_test.rb b/test/server_definition_test.rb index a0ed7103..3009e259 100644 --- a/test/server_definition_test.rb +++ b/test/server_definition_test.rb @@ -62,11 +62,11 @@ class ServerDefinitionTest < Test::Unit::TestCase server = Capistrano::ServerDefinition.new("www.capistrano.test", :primary => true) assert_equal true, server.options[:primary] end - + def test_default_user_should_try_to_guess_username ENV.stubs(:[]).returns(nil) assert_equal "not-specified", Capistrano::ServerDefinition.default_user - + ENV.stubs(:[]).returns(nil) ENV.stubs(:[]).with("USERNAME").returns("ryan") assert_equal "ryan", Capistrano::ServerDefinition.default_user diff --git a/test/shell_test.rb b/test/shell_test.rb index e0d05edc..a3911e29 100644 --- a/test/shell_test.rb +++ b/test/shell_test.rb @@ -67,7 +67,7 @@ class ShellTest < Test::Unit::TestCase @shell.expects(:process_command).with("on", "app,db", "hello world") assert @shell.read_and_execute end - + def test_task_command_with_bang_gets_processed_by_exec_tasks while_testing_post_exec_commands do @shell.expects(:read_line).returns("!deploy") @@ -75,7 +75,7 @@ class ShellTest < Test::Unit::TestCase assert @shell.read_and_execute end end - + def test_normal_command_gets_processed_by_exec_command while_testing_post_exec_commands do @shell.expects(:read_line).returns("uptime") @@ -84,13 +84,13 @@ class ShellTest < Test::Unit::TestCase assert @shell.read_and_execute end end - - + + private - + def while_testing_post_exec_commands(&block) @shell.instance_variable_set(:@mutex,Mutex.new) yield end - + end