Permalink
Browse files

0.1.8 dont need to FORCE deploy if reservation made by same user

  • Loading branch information...
1 parent dcf5ad1 commit 3b38d618b855c45f20c82c1fbbc4fac32e86b1ea @tongueroo tongueroo committed Feb 17, 2013
Showing with 5 additions and 4 deletions.
  1. +1 −1 cap_reserve.gemspec
  2. +4 −3 lib/cap_reserve.rb
View
@@ -6,7 +6,7 @@ $:.unshift lib unless $:.include?(lib)
Gem::Specification.new do |s|
s.name = "cap_reserve"
- s.version = '0.1.7'
+ s.version = '0.1.8'
s.platform = Gem::Platform::RUBY
s.authors = [ "Winton Welsh" ]
s.email = [ "mail@wintoni.us" ]
View
@@ -55,8 +55,9 @@ def yellow
desc "Reserve environment using RESERVE=minutes"
task :default do
begin
- env, user, time, force, url, destroy, branch =
- ENV['RESERVE_ENV'], ENV['USER'], ENV['RESERVE'], ENV['FORCE'], ENV['RESERVE_URL'], ENV['DESTROY'], ENV['BRANCH']
+ env, time, force, url, destroy, branch =
+ ENV['RESERVE_ENV'], ENV['RESERVE'], ENV['FORCE'], ENV['RESERVE_URL'], ENV['DESTROY'], ENV['BRANCH']
+ user = ENV['DEPLOYER'] || ENV['USER']
help = <<-HELP
FORCE=1 to deploy anyway
@@ -84,7 +85,7 @@ def yellow
create.call(:force => true)
else
res = get.call("#{url}/reservations/show", :environment => env)
- if res['status'] == 'reserved'
+ if res['status'] == 'reserved' and res['user'] != user
puts "\n#{"Reservation exists".red}: #{"#{res['user']}@#{env}".yellow} (#{expires_to_string.call(Time.at(res['expires'])).yellow})\n#{help}\n"
exit 0
else

0 comments on commit 3b38d61

Please sign in to comment.