Class: SimpleDeploy::Notifier
- Inherits:
-
Object
- Object
- SimpleDeploy::Notifier
- Defined in:
- lib/simple_deploy/notifier.rb,
lib/simple_deploy/notifier/slack.rb,
lib/simple_deploy/notifier/campfire.rb
Defined Under Namespace
Instance Method Summary collapse
-
#initialize(args) ⇒ Notifier
constructor
A new instance of Notifier.
- #send(message) ⇒ Object
- #send_deployment_complete_message ⇒ Object
- #send_deployment_start_message ⇒ Object
Constructor Details
#initialize(args) ⇒ Notifier
Returns a new instance of Notifier.
6 7 8 9 10 11 |
# File 'lib/simple_deploy/notifier.rb', line 6 def initialize(args) @config = SimpleDeploy.config @stack_name = args[:stack_name] @environment = args[:environment] @notifications = @config.notifications || {} end |
Instance Method Details
#send(message) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/simple_deploy/notifier.rb', line 33 def send() @notifications.keys.each do |notification| case notification when 'campfire' campfire = Notifier::Campfire.new :stack_name => @stack_name, :environment => @environment campfire.send when 'slack' slack = Notifier::Slack.new slack.send end end end |
#send_deployment_complete_message ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/simple_deploy/notifier.rb', line 18 def = "Deployment to #{@stack_name} in #{@config.region} complete." attributes = stack.attributes if attributes['app_github_url'] += " App: #{attributes['app_github_url']}/commit/#{attributes['app']}" end if attributes['chef_repo_github_url'] += " Chef: #{attributes['chef_repo_github_url']}/commit/#{attributes['chef_repo']}" end send end |
#send_deployment_start_message ⇒ Object
13 14 15 16 |
# File 'lib/simple_deploy/notifier.rb', line 13 def = "Deployment to #{@stack_name} in #{@config.region} started." send end |