Changeset 6487
- Timestamp:
- 03/29/07 04:48:34 (1 year ago)
- Files:
-
- tools/capistrano/lib/capistrano/recipes/deploy.rb (modified) (2 diffs)
- tools/capistrano/lib/capistrano/recipes/deploy/dependencies.rb (added)
- tools/capistrano/lib/capistrano/recipes/deploy/local_dependency.rb (added)
- tools/capistrano/lib/capistrano/recipes/deploy/remote_dependency.rb (added)
- tools/capistrano/lib/capistrano/recipes/deploy/scm/base.rb (modified) (2 diffs)
- tools/capistrano/lib/capistrano/recipes/deploy/strategy/base.rb (modified) (2 diffs)
- tools/capistrano/lib/capistrano/recipes/deploy/strategy/copy.rb (modified) (3 diffs)
- tools/capistrano/lib/capistrano/recipes/deploy/strategy/remote.rb (modified) (1 diff)
- tools/capistrano/setup.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/capistrano/lib/capistrano/recipes/deploy.rb
r6468 r6487 149 149 servers. Any file or directory starting with a '.' character will be ignored. 150 150 151 $ cap deploy:up date_filesFILES=templates,controller.rb"152 task :up date_files, :except => { :no_release => true } do151 $ cap deploy:upload FILES=templates,controller.rb" 152 task :upload, :except => { :no_release => true } do 153 153 files = (ENV["FILES"] || ""). 154 154 split(","). … … 256 256 end 257 257 258 desc "Test deployment dependencies. Checks things like directory permissions, \ 259 necessary utilities, and so forth, reporting on the things that appear to be \ 260 incorrect or missing. This is good for making sure a deploy has a chance of \ 261 working before you actually run `cap deploy'!" 262 task :check, :except => { :no_release => true } do 263 dependencies = strategy.check! 264 if dependencies.pass? 265 puts "You appear to have all necessary dependencies installed" 266 else 267 puts "The following dependencies failed. Please check them and try again:" 268 dependencies.reject { |d| d.pass? }.each do |d| 269 puts "--> #{d.message}" 270 end 271 end 272 end 273 258 274 namespace :pending do 259 275 desc "Displays the `diff' since your last deploy. This is useful if you want \ tools/capistrano/lib/capistrano/recipes/deploy/scm/base.rb
r6463 r6487 85 85 end 86 86 87 # Returns the name of the command-line utility for this SCM. It first 88 # looks at the :scm_command variable, and if it does not exist, it 89 # then falls back to whatever was defined by +default_command+. 90 def command 91 configuration[:scm_command] || default_command 92 end 93 87 94 private 88 95 … … 106 113 end 107 114 108 # Returns the name of the command-line utility for this SCM. It first109 # looks at the :scm_command variable, and if it does not exist, it110 # then falls back to whatever was defined by +default_command+.111 def command112 configuration[:scm_command] || default_command113 end114 115 115 # A convenience method for accessing the declared repository value. 116 116 def repository tools/capistrano/lib/capistrano/recipes/deploy/strategy/base.rb
r6463 r6487 1 require 'capistrano/recipes/deploy/dependencies' 2 1 3 module Capistrano 2 4 module Deploy … … 23 25 end 24 26 27 # Performs a check on the remote hosts to determine whether everything 28 # is setup such that a deploy could succeed. 29 def check! 30 Dependencies.new(configuration) do |d| 31 d.remote.expect_directory(configuration[:releases_path]).or("`#{configuration[:releases_path]}' does not exist. Please run `cap deploy:setup'.") 32 d.remote.expect_writable(configuration[:deploy_to]).or("You do not have permissions to write to `#{configuration[:deploy_to]}'.") 33 d.remote.expect_writable(configuration[:releases_path]).or("You do not have permissions to write to `#{configuration[:releases_path]}'.") 34 end 35 end 36 25 37 protected 26 38 tools/capistrano/lib/capistrano/recipes/deploy/strategy/copy.rb
r6463 r6487 37 37 FileUtils.rm filename rescue nil 38 38 FileUtils.rm_rf destination rescue nil 39 end 40 41 def check! 42 super.check do |d| 43 d.local.expects_in_path(source.command) 44 d.local.expects_in_path(compress(nil, nil).first) 45 d.remote.expects_in_path(decompress(nil).first) 46 end 39 47 end 40 48 … … 93 101 94 102 # Returns the command necessary to compress the given directory 95 # into the given file. 103 # into the given file. The command is returned as an array, where 104 # the first element is the utility to be used to perform the compression. 96 105 def compress(directory, file) 97 106 case compression 98 when :gzip, :gz then "tar czf #{file} #{directory}" 99 when :bzip2, :bz2 then "tar cjf #{file} #{directory}" 100 when :zip then "zip -qr #{file} #{directory}" 107 when :gzip, :gz then ["tar", "czf", file, directory] 108 when :bzip2, :bz2 then ["tar", "cjf", file, directory] 109 when :zip then ["zip", "-qr", file, directory] 110 else raise ArgumentError, "invalid compression type #{compression.inspect}" 101 111 end 102 112 end … … 104 114 # Returns the command necessary to decompress the given file, 105 115 # relative to the current working directory. It must also 106 # preserve the directory structure in the file. 116 # preserve the directory structure in the file. The command is returned 117 # as an array, where the first element is the utility to be used to 118 # perform the decompression. 107 119 def decompress(file) 108 120 case compression 109 when :gzip, :gz then "tar xzf #{file}" 110 when :bzip2, :bz2 then "tar xjf #{file}" 111 when :zip then "unzip -q #{file}" 121 when :gzip, :gz then ["tar", "xzf", file] 122 when :bzip2, :bz2 then ["tar", "xjf", file] 123 when :zip then ["unzip", "-q", file] 124 else raise ArgumentError, "invalid compression type #{compression.inspect}" 112 125 end 113 126 end tools/capistrano/lib/capistrano/recipes/deploy/strategy/remote.rb
r6463 r6487 14 14 def deploy! 15 15 scm_run "#{command} && #{mark}" 16 end 17 18 def check! 19 result = super 20 test("type -p #{source.command}", "could not find `#{source.command}'") && result 16 21 end 17 22 tools/capistrano/setup.rb
r2525 r6487 1179 1179 1180 1180 def ruby_scripts 1181 collect_filenames_auto().select {|n| /\. r(b|html)\z/ =~ n}1181 collect_filenames_auto().select {|n| /\.(r(b|html)|txt)\z/ =~ n} 1182 1182 end 1183 1183