Sha256: 8cbd0d2373beebc86c13f9feebdfcecf64185ff65080890d8dd9f920fe26ca4c

Contents?: true

Size: 700 Bytes

Versions: 1

Compression:

Stored size: 700 Bytes

Contents

# encoding: utf-8

module Doggy
  class CLI::Push
    def initialize(options)
      @options = options
    end

    def run
      push_resources('dashboards', Models::Dashboard) if should_push?('dashboards')
      push_resources('monitors',   Models::Monitor)   if should_push?('monitors')
      push_resources('screens',    Models::Screen)    if should_push?('screens')

      Doggy.emit_shipit_deployment
    end

  private

    def should_push?(resource)
      @options.empty? || @options[resource]
    end

    def push_resources(name, klass)
      Doggy.ui.say "Pushing #{ name }"
      local_resources = klass.all_local(only_changed: true)
      local_resources.each(&:save)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
doggy-2.0.9 lib/doggy/cli/push.rb