Sha256: a0d26f32db6255aba458e22fac618c474e9d5e9d69d7c363fd5474652baa8b53

Contents?: true

Size: 707 Bytes

Versions: 16

Compression:

Stored size: 707 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::Model.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

16 entries across 16 versions & 1 rubygems

Version Path
doggy-2.0.27 lib/doggy/cli/push.rb
doggy-2.0.26 lib/doggy/cli/push.rb
doggy-2.0.25 lib/doggy/cli/push.rb
doggy-2.0.24 lib/doggy/cli/push.rb
doggy-2.0.23 lib/doggy/cli/push.rb
doggy-2.0.22 lib/doggy/cli/push.rb
doggy-2.0.21 lib/doggy/cli/push.rb
doggy-2.0.20 lib/doggy/cli/push.rb
doggy-2.0.19 lib/doggy/cli/push.rb
doggy-2.0.18 lib/doggy/cli/push.rb
doggy-2.0.17 lib/doggy/cli/push.rb
doggy-2.0.15 lib/doggy/cli/push.rb
doggy-2.0.14 lib/doggy/cli/push.rb
doggy-2.0.12 lib/doggy/cli/push.rb
doggy-2.0.11 lib/doggy/cli/push.rb
doggy-2.0.10 lib/doggy/cli/push.rb