Sha256: fefcb13e0f2f72eb2cd210093d80ea24691bd897c776816e9ee8caba1f7024a1

Contents?: true

Size: 664 Bytes

Versions: 2

Compression:

Stored size: 664 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')
    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

2 entries across 2 versions & 1 rubygems

Version Path
doggy-2.0.8 lib/doggy/cli/push.rb
doggy-2.0.7 lib/doggy/cli/push.rb