Sha256: df4e3c3d600b07833dfb7a7103a4c0ce20353bb47da0f675079fe269dd0ed9fb

Contents?: true

Size: 702 Bytes

Versions: 16

Compression:

Stored size: 702 Bytes

Contents

class DeployNotification

  def initialize(deploy)
    @deploy = deploy
    @deployer = deploy.deployer
    @maintainers = deploy.project.maintainers
  end

  attr_reader :deploy, :deployer, :maintainers

  def deliver!
    messages = maintainers.map do |maintainer|
      ProjectNotification.maintainer_of_deploy(maintainer, deploy).deliver!
    end

    if we_know_who_triggered_the_deploy and it_wasnt_a_maintainer
      messages << ProjectNotification.maintainer_of_deploy(deployer, deploy).deliver!
    end

    messages
  end

private

  def we_know_who_triggered_the_deploy
    !deployer.blank?
  end

  def it_wasnt_a_maintainer
    !maintainers.with_email_address(deployer).exists?
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
houston-core-0.7.0 app/mailers/deploy_notification.rb
houston-core-0.7.0.beta4 app/mailers/deploy_notification.rb
houston-core-0.7.0.beta3 app/mailers/deploy_notification.rb
houston-core-0.7.0.beta2 app/mailers/deploy_notification.rb
houston-core-0.7.0.beta app/mailers/deploy_notification.rb
houston-core-0.6.3 app/mailers/deploy_notification.rb
houston-core-0.6.2 app/mailers/deploy_notification.rb
houston-core-0.6.1 app/mailers/deploy_notification.rb
houston-core-0.6.0 app/mailers/deploy_notification.rb
houston-core-0.5.6 app/mailers/deploy_notification.rb
houston-core-0.5.5 app/mailers/deploy_notification.rb
houston-core-0.5.4 app/mailers/deploy_notification.rb
houston-core-0.5.3 app/mailers/deploy_notification.rb
houston-core-0.5.2 app/mailers/deploy_notification.rb
houston-core-0.5.1 app/mailers/deploy_notification.rb
houston-core-0.5.0 app/mailers/deploy_notification.rb