<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/capistrano/recipes/deploy/dependencies.rb</filename>
    </added>
    <added>
      <filename>lib/capistrano/recipes/deploy/local_dependency.rb</filename>
    </added>
    <added>
      <filename>lib/capistrano/recipes/deploy/remote_dependency.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -148,8 +148,8 @@ comma-delimited list in the FILES environment variable. All directories will \
 be processed recursively, with all files being pushed to the deployment \
 servers. Any file or directory starting with a '.' character will be ignored.
 
-  $ cap deploy:update_files FILES=templates,controller.rb&quot;
-  task :update_files, :except =&gt; { :no_release =&gt; true } do
+  $ cap deploy:upload FILES=templates,controller.rb&quot;
+  task :upload, :except =&gt; { :no_release =&gt; true } do
     files = (ENV[&quot;FILES&quot;] || &quot;&quot;).
       split(&quot;,&quot;).
       map { |f| f.strip!; File.directory?(f) ? Dir[&quot;#{f}/**/*&quot;] : f }.
@@ -255,6 +255,22 @@ environment, set the :cleanup_via variable to :run instead.&quot;
     end
   end
 
+desc &quot;Test deployment dependencies. Checks things like directory permissions, \
+necessary utilities, and so forth, reporting on the things that appear to be \
+incorrect or missing. This is good for making sure a deploy has a chance of \
+working before you actually run `cap deploy'!&quot;
+  task :check, :except =&gt; { :no_release =&gt; true } do
+    dependencies = strategy.check!
+    if dependencies.pass?
+      puts &quot;You appear to have all necessary dependencies installed&quot;
+    else
+      puts &quot;The following dependencies failed. Please check them and try again:&quot;
+      dependencies.reject { |d| d.pass? }.each do |d|
+        puts &quot;--&gt; #{d.message}&quot;
+      end
+    end
+  end
+
   namespace :pending do
 desc &quot;Displays the `diff' since your last deploy. This is useful if you want \
 to examine what changes are about to be deployed. Note that this might not be \</diff>
      <filename>lib/capistrano/recipes/deploy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -84,6 +84,13 @@ module Capistrano
           nil
         end
 
+        # Returns the name of the command-line utility for this SCM. It first
+        # looks at the :scm_command variable, and if it does not exist, it
+        # then falls back to whatever was defined by +default_command+.
+        def command
+          configuration[:scm_command] || default_command
+        end
+
         private
 
           # A reference to a Logger instance that the SCM can use to log
@@ -105,13 +112,6 @@ module Capistrano
             [command, *args].compact.join(&quot; &quot;)
           end
 
-          # Returns the name of the command-line utility for this SCM. It first
-          # looks at the :scm_command variable, and if it does not exist, it
-          # then falls back to whatever was defined by +default_command+.
-          def command
-            configuration[:scm_command] || default_command
-          end
-
           # A convenience method for accessing the declared repository value.
           def repository
             configuration[:repository]</diff>
      <filename>lib/capistrano/recipes/deploy/scm/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,5 @@
+require 'capistrano/recipes/deploy/dependencies'
+
 module Capistrano
   module Deploy
     module Strategy
@@ -22,6 +24,16 @@ module Capistrano
           raise NotImplementedError, &quot;`deploy!' is not implemented by #{self.class.name}&quot;
         end
 
+        # Performs a check on the remote hosts to determine whether everything
+        # is setup such that a deploy could succeed.
+        def check!
+          Dependencies.new(configuration) do |d|
+            d.remote.expect_directory(configuration[:releases_path]).or(&quot;`#{configuration[:releases_path]}' does not exist. Please run `cap deploy:setup'.&quot;)
+            d.remote.expect_writable(configuration[:deploy_to]).or(&quot;You do not have permissions to write to `#{configuration[:deploy_to]}'.&quot;)
+            d.remote.expect_writable(configuration[:releases_path]).or(&quot;You do not have permissions to write to `#{configuration[:releases_path]}'.&quot;)
+          end
+        end
+          
         protected
 
           # This is to allow helper methods like &quot;run&quot; and &quot;put&quot; to be more</diff>
      <filename>lib/capistrano/recipes/deploy/strategy/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -38,6 +38,14 @@ module Capistrano
           FileUtils.rm_rf destination rescue nil
         end
 
+        def check!
+          super.check do |d|
+            d.local.expects_in_path(source.command)
+            d.local.expects_in_path(compress(nil, nil).first)
+            d.remote.expects_in_path(decompress(nil).first)
+          end
+        end
+
         private
 
           # Returns the basename of the release_path, which will be used to
@@ -92,23 +100,28 @@ module Capistrano
           end
 
           # Returns the command necessary to compress the given directory
-          # into the given file.
+          # into the given file. The command is returned as an array, where
+          # the first element is the utility to be used to perform the compression.
           def compress(directory, file)
             case compression
-            when :gzip, :gz   then &quot;tar czf #{file} #{directory}&quot;
-            when :bzip2, :bz2 then &quot;tar cjf #{file} #{directory}&quot;
-            when :zip         then &quot;zip -qr #{file} #{directory}&quot;
+            when :gzip, :gz   then [&quot;tar&quot;, &quot;czf&quot;, file, directory]
+            when :bzip2, :bz2 then [&quot;tar&quot;, &quot;cjf&quot;, file, directory]
+            when :zip         then [&quot;zip&quot;, &quot;-qr&quot;, file, directory]
+            else raise ArgumentError, &quot;invalid compression type #{compression.inspect}&quot;
             end
           end
 
           # Returns the command necessary to decompress the given file,
           # relative to the current working directory. It must also
-          # preserve the directory structure in the file.
+          # preserve the directory structure in the file. The command is returned
+          # as an array, where the first element is the utility to be used to
+          # perform the decompression.
           def decompress(file)
             case compression
-            when :gzip, :gz   then &quot;tar xzf #{file}&quot;
-            when :bzip2, :bz2 then &quot;tar xjf #{file}&quot;
-            when :zip         then &quot;unzip -q #{file}&quot;
+            when :gzip, :gz   then [&quot;tar&quot;, &quot;xzf&quot;, file]
+            when :bzip2, :bz2 then [&quot;tar&quot;, &quot;xjf&quot;, file]
+            when :zip         then [&quot;unzip&quot;, &quot;-q&quot;, file]
+            else raise ArgumentError, &quot;invalid compression type #{compression.inspect}&quot;
             end
           end
       end</diff>
      <filename>lib/capistrano/recipes/deploy/strategy/copy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,6 +15,11 @@ module Capistrano
           scm_run &quot;#{command} &amp;&amp; #{mark}&quot;
         end
 
+        def check!
+          result = super
+          test(&quot;type -p #{source.command}&quot;, &quot;could not find `#{source.command}'&quot;) &amp;&amp; result
+        end
+
         protected
 
           # Runs the given command, filtering output back through the</diff>
      <filename>lib/capistrano/recipes/deploy/strategy/remote.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1178,7 +1178,7 @@ class Installer
   end
 
   def ruby_scripts
-    collect_filenames_auto().select {|n| /\.r(b|html)\z/ =~ n}
+    collect_filenames_auto().select {|n| /\.(r(b|html)|txt)\z/ =~ n}
   end
   
   # picked up many entries from cvs-1.11.1/src/ignore.c</diff>
      <filename>setup.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4331e3bb673f0a5f1f3710c3ee43fb7694a6a9a1</id>
    </parent>
  </parents>
  <author>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </author>
  <url>http://github.com/jamis/capistrano/commit/aab2ea25f305fd2da2b762bd7e894bdffbd3342b</url>
  <id>aab2ea25f305fd2da2b762bd7e894bdffbd3342b</id>
  <committed-date>2007-03-28T21:48:34-07:00</committed-date>
  <authored-date>2007-03-28T21:48:34-07:00</authored-date>
  <message>Add deploy:check test for verifying that dependencies are in order for deploying


git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@6487 5ecf4fe2-1ee6-0310-87b1-e25e094e27de</message>
  <tree>41f3be82c9ea4116a506205663e323fd2638a8ed</tree>
  <committer>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </committer>
</commit>
