6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/pingdom_cap/capistrano.rb', line 6
def self.load_into(configuration)
configuration.load do
namespace :pingdom do
def param(name)
ENV[name.to_s.upcase] || fetch(name)
end
def pingdom(configuration, operation)
check_name = param(:pingdom_check_name)
username = param(:pingdom_username)
password = param(:pingdom_password)
key = param(:pingdom_key)
if configuration.dry_run
logger.info "DRY RUN: pingdom_cap #{check_name} #{operation} not actually run."
else
client = PingdomCap::Client.new(username: username, password: password, key: key)
client.send(operation, check_name)
end
logger.info("Pingdom: #{operation}")
end
desc "Status of check at Pingdom"
task :status, :except => { :no_release => true } do
pingdom(configuration, 'status')
end
desc "Pause checks at Pingdom"
task :pause, :except => { :no_release => true } do
pingdom(configuration, 'pause')
end
desc "Unpause checks at Pingdom"
task :unpause, :except => { :no_release => true } do
pingdom(configuration, 'unpause')
end
end
end
end
|