Sha256: 252acabef97489ac038e8f9101f9d27f76fbf09d35eaab87ffff4e3743f038b2

Contents?: true

Size: 625 Bytes

Versions: 2

Compression:

Stored size: 625 Bytes

Contents

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
      local_resources.each(&:save)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
doggy-2.0.1 lib/doggy/cli/push.rb
doggy-2.0.0 lib/doggy/cli/push.rb