doggy 2.0.11 → 2.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a03dea3042516cbe90113a39d58cbe0aeb080ebc
4
- data.tar.gz: d42ed86f756843f49ac3e29fc520ab781f73a4fe
3
+ metadata.gz: c60775bd22060685fe56b5886ac24b7a16faa8cf
4
+ data.tar.gz: c28731b17bf0a5afd7b8d00bc218e3c4fa3fb8d4
5
5
  SHA512:
6
- metadata.gz: 698c71f8b6b353dad00b4ee6522a91080a47927b528f666c900032ab40091552ad54d68f96d5c1e60c676c7843dc4ce8c0d3714398596cf690836a1e77c5f441
7
- data.tar.gz: 97ecfe0e042c35edf5a63e8d4e6730aea763f7b7aa9c6f6cf321689b495871e6aeee3b8820c834f52b24d9cf685ed1f1298ba194622712080a15b5b2084a2ca9
6
+ metadata.gz: cb30af3ae7cb7d439ac9bc509fa35e966b753afba16d2e84a1eebdc3a3ce9d92d1ee339f0952240f85529d5c1364f35265e97eba17377e2a686acae029585149
7
+ data.tar.gz: 06bfc1f3b26ab565f6c9d93f8c2d47325c1197a9cedcc35824e85fed076c4ef84bf05f7b433b4ddf40abec9f884e497e531639d83ce1024c3eb33ebecc3e6ad9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- doggy (2.0.11)
4
+ doggy (2.0.12)
5
5
  json (~> 1.8.3)
6
6
  parallel (~> 1.6.1)
7
7
  rugged (~> 0.23.2)
@@ -5,18 +5,21 @@ module Doggy
5
5
  def initialize(ids:, options:)
6
6
  @ids = ids
7
7
  @options = options
8
+ @updated_by_last_action = false
8
9
  end
9
10
 
10
11
  def run
11
12
  pull_resources('dashboards', Models::Dashboard, @ids) if should_pull?('dashboards')
12
13
  pull_resources('monitors', Models::Monitor, @ids) if should_pull?('monitors')
13
14
  pull_resources('screens', Models::Screen, @ids) if should_pull?('screens')
15
+
16
+ Doggy.ui.say "Nothing to pull: please specify object ID or use '-a' to pull everything" unless @updated_by_last_action
14
17
  end
15
18
 
16
19
  private
17
20
 
18
21
  def should_pull?(resource)
19
- @options.empty? || @options[resource]
22
+ !@options.empty? || @options[resource] || @ids.any?
20
23
  end
21
24
 
22
25
  def pull_resources(name, klass, ids)
@@ -29,6 +32,7 @@ module Doggy
29
32
  end
30
33
  local_resources = klass.all_local
31
34
  klass.assign_paths(remote_resources, local_resources)
35
+ @updated_by_last_action = true
32
36
  remote_resources.each(&:save_local)
33
37
  end
34
38
  end
data/lib/doggy/cli.rb CHANGED
@@ -15,6 +15,7 @@ module Doggy
15
15
  method_option "dashboards", type: :boolean, desc: 'Pull dashboards'
16
16
  method_option "monitors", type: :boolean, desc: 'Pull monitors'
17
17
  method_option "screens", type: :boolean, desc: 'Pull screens'
18
+ method_option "all", type: :boolean, desc: 'Pull everything', aliases: '-a'
18
19
 
19
20
  def pull(*ids)
20
21
  CLI::Pull.new(ids: ids, options: options.dup).run
@@ -34,7 +35,6 @@ module Doggy
34
35
  CLI::Push.new(options.dup).run
35
36
  end
36
37
 
37
-
38
38
  desc "mute OBJECT_ID OBJECT_ID OBJECT_ID", "Mutes monitor on DataDog"
39
39
  long_desc <<-D
40
40
  Mutes monitors on Datadog.
data/lib/doggy/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Doggy
4
- VERSION = "2.0.11"
4
+ VERSION = "2.0.12"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doggy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.11
4
+ version: 2.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Gorodetsky