Sha256: 3f960bed65a1e7d29f540a4adbffdaaf70f1e1f0f97a92cbfb71a34d50cff0cc

Contents?: true

Size: 1.03 KB

Versions: 59

Compression:

Stored size: 1.03 KB

Contents

module Appsignal
  class CLI
    class NotifyOfDeploy
      class << self
        def run(options, config)
          validate_active_config(config)
          validate_required_options(options, [:revision, :user, :environment])

          Appsignal::Marker.new(
            {
              :revision => options[:revision],
              :user => options[:user]
            },
            config
          ).transmit
        end

        protected

        def validate_required_options(options, required_options)
          missing = required_options.select do |required_option|
            val = options[required_option]
            val.nil? || (val.respond_to?(:empty?) && val.empty?)
          end
          if missing.any?
            puts "Missing options: #{missing.join(', ')}"
            exit 1
          end
        end

        def validate_active_config(config)
          unless config.active?
            puts 'Exiting: No config file or push api key env var found'
            exit 1
          end
        end
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
appsignal-1.4.0.beta.1 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.3.6 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.3.6.beta.1 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.3.5 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.3.5.beta.1 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.3.4 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.3.3 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.4.0.alpha.2 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.4.0.alpha.1 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.3.2 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.3.1 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.3.0 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.3.0.beta.3 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.3.0.beta.2 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.3.0.beta.1 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.2.5 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.2.4 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.2.4.beta.4 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.2.4.beta.3 lib/appsignal/cli/notify_of_deploy.rb
appsignal-1.2.4.beta.2 lib/appsignal/cli/notify_of_deploy.rb