Changeset 7038
- Timestamp:
- 06/16/07 13:51:12 (1 year ago)
- Files:
-
- tools/capistrano/CHANGELOG (modified) (1 diff)
- tools/capistrano/lib/capistrano/recipes/deploy.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/capistrano/CHANGELOG
r7036 r7038 1 *SVN* 2 3 * Make sure symlink and finalize_update tasks reference the most recent release when called by themselves [Jamis Buck] 4 5 1 6 *1.99.2 (2.0 Preview 3)* June 15, 2007 2 7 3 8 * CVS SCM module [Brian Phillips] 4 9 tools/capistrano/lib/capistrano/recipes/deploy.rb
r6949 r7038 33 33 set(:strategy) { Capistrano::Deploy::Strategy.new(deploy_via, self) } 34 34 35 set(:release_name) { Time.now.utc.strftime("%Y%m%d%H%M%S") }35 set(:release_name) { set :deploy_timestamped, true; Time.now.utc.strftime("%Y%m%d%H%M%S") } 36 36 set(:releases_path) { File.join(deploy_to, "releases") } 37 37 set(:shared_path) { File.join(deploy_to, "shared") } … … 48 48 49 49 set(:run_method) { fetch(:use_sudo, true) ? :sudo : :run } 50 51 # some tasks, like symlink, need to always point at the latest release, but 52 # they can also (occassionally) be called standalone. In the standalone case, 53 # the timestamped release_path will be inaccurate, since the directory won't 54 # actually exist. This variable lets tasks like symlink work either in the 55 # standalone case, or during deployment. 56 set(:latest_release) { exists?(:deploy_timestamped) ? release_path : current_release } 50 57 51 58 # ========================================================================= … … 146 153 DESC 147 154 task :finalize_update, :except => { :no_release => true } do 148 run "chmod -R g+w #{ release_path}" if fetch(:group_writable, true)155 run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true) 149 156 150 157 # mkdir -p is making sure that the directories are there for some SCM's that don't 151 158 # save empty folders 152 159 run <<-CMD 153 rm -rf #{ release_path}/log #{release_path}/public/system #{release_path}/tmp/pids &&154 mkdir -p #{ release_path}/public &&155 mkdir -p #{ release_path}/tmp &&156 ln -s #{shared_path}/log #{ release_path}/log &&157 ln -s #{shared_path}/system #{ release_path}/public/system &&158 ln -s #{shared_path}/pids #{ release_path}/tmp/pids160 rm -rf #{latest_release}/log #{latest_release}/public/system #{latest_release}/tmp/pids && 161 mkdir -p #{latest_release}/public && 162 mkdir -p #{latest_release}/tmp && 163 ln -s #{shared_path}/log #{latest_release}/log && 164 ln -s #{shared_path}/system #{latest_release}/public/system && 165 ln -s #{shared_path}/pids #{latest_release}/tmp/pids 159 166 CMD 160 167 161 168 stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S") 162 asset_paths = %w(images stylesheets javascripts).map { |p| "#{ release_path}/public/#{p}" }.join(" ")169 asset_paths = %w(images stylesheets javascripts).map { |p| "#{latest_release}/public/#{p}" }.join(" ") 163 170 run "find #{asset_paths} -exec touch -t #{stamp} {} \\;; true", :env => { "TZ" => "UTC" } 164 171 end 165 172 166 173 desc <<-DESC 167 Updates the symlink to the deployed version. Capistrano works by putting \168 each new release of your application in its own directory. When you \169 deploy a new version, this task's job is to update the `current' symlink \174 Updates the symlink to the most recently deployed version. Capistrano works 175 by putting each new release of your application in its own directory. When 176 you deploy a new version, this task's job is to update the `current' symlink \ 170 177 to point at the new version. You will rarely need to call this task \ 171 178 directly; instead, use the `deploy' task (which performs a complete \ … … 175 182 task :symlink, :except => { :no_release => true } do 176 183 on_rollback { run "rm -f #{current_path}; ln -s #{previous_release} #{current_path}; true" } 177 run "rm -f #{current_path} && ln -s #{ release_path} #{current_path}"184 run "rm -f #{current_path} && ln -s #{latest_release} #{current_path}" 178 185 end 179 186