alpha_omega 0.0.129 → 0.0.130

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/alpha_omega/deploy.rb +10 -0
  3. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.129
1
+ 0.0.130
@@ -258,6 +258,12 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
258
258
  cook
259
259
  end
260
260
 
261
+ task :symlink_next, :except => { :no_release => true } do
262
+ if releases.length >= 2
263
+ run "#{File.dirname(current_path).index(deploy_to) == 0 ? "" : try_sudo} ln -vsnf #{latest_release} #{next_path}"
264
+ end
265
+ end
266
+
261
267
  desc <<-DESC
262
268
  Updates the symlink to the most recently deployed version. Capistrano works \
263
269
  by putting each new release of your application in its own directory. When \
@@ -271,6 +277,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
271
277
  if releases.length > 0
272
278
  on_rollback do
273
279
  if previous_release
280
+ run "#{File.dirname(current_path).index(deploy_to) == 0 ? "" : try_sudo} rm -fv #{previous_path} #{next_path}; true"
274
281
  run "#{File.dirname(current_path).index(deploy_to) == 0 ? "" : try_sudo} ln -vsnf #{previous_release} #{current_path}; true"
275
282
  else
276
283
  logger.important "no previous release to rollback to, rollback of symlink skipped"
@@ -280,7 +287,9 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
280
287
  if releases.length == 1
281
288
  run "[[ $(readlink #{current_path} 2>&-) = #{latest_release} ]] || #{try_sudo} ln -vsnf #{latest_release} #{current_path}"
282
289
  else
290
+ run "#{File.dirname(current_path).index(deploy_to) == 0 ? "" : try_sudo} rm -fv #{previous_path} #{next_path}"
283
291
  run "#{File.dirname(current_path).index(deploy_to) == 0 ? "" : try_sudo} ln -vsnf #{latest_release} #{current_path}"
292
+ run "#{File.dirname(current_path).index(deploy_to) == 0 ? "" : try_sudo} ln -vsnf #{previous_release} #{previous_path}"
284
293
  end
285
294
 
286
295
  system "#{figlet} -w 200 #{release_name} activated"
@@ -365,6 +374,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
365
374
  task :revision, :except => { :no_release => true } do
366
375
  if previous_release
367
376
  system "#{figlet} -w 200 on #{previous_release}"
377
+ run "rm -fv #{previous_path} #{next_path}"
368
378
  run "ln -vsnf #{previous_release} #{current_path}"
369
379
  else
370
380
  abort "could not rollback the code because there is no prior release"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alpha_omega
3
3
  version: !ruby/object:Gem::Version
4
- hash: 285
4
+ hash: 283
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 129
10
- version: 0.0.129
9
+ - 130
10
+ version: 0.0.130
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Nghiem