Sha256: 574adcbb1a6f81591e66e39926ead3017d4abf871861b09c08094cbcfbfa3000

Contents?: true

Size: 580 Bytes

Versions: 29

Compression:

Stored size: 580 Bytes

Contents

# role = :app
def with_role(role, &block)
  original, ENV['HOSTS'] = ENV['HOSTS'], find_servers(:roles => role).map{|d| d.host}.join(",")
  begin
    yield
  ensure
    ENV['HOSTS'] = original
  end
end

# options = { :user => 'xxxxx', :password => 'xxxxx' }
def with_credentials(options={}, &block)
  original_username, original_password = user, password
  begin
    set :user,     options[:user] || original_username
    set :password, options[:password] || original_password
    yield
  ensure
    set :user,     original_username
    set :password, original_password
  end
end

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
grosser-cap-recipes-0.2.19 lib/cap_recipes/tasks/with_scope.rb
grosser-cap-recipes-0.2.21 lib/cap_recipes/tasks/with_scope.rb
hubertlepicki-cap-recipes-0.2.8 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.10 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.11 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.12 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.13 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.14 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.15 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.16 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.17 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.19 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.20 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.21 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.8 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.2.9 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.3.0 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.3.11 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.3.12 lib/cap_recipes/tasks/with_scope.rb
nesquena-cap-recipes-0.3.13 lib/cap_recipes/tasks/with_scope.rb