doggy 2.0.27 → 2.0.28

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: e29ecf585930ccdb1f334709b051986e2ca043d0
4
- data.tar.gz: 8d12fb7333a8fc3055180a643ad8ef67f3a56945
3
+ metadata.gz: bfcc017d59badc8a0675e416fa434442b398c9a5
4
+ data.tar.gz: a12619e920d86487a3f4f9c0cd34965887a4f287
5
5
  SHA512:
6
- metadata.gz: f46164a13a4faf7a9d27480d23c10fd511325cfb49b97609c9f3918f591cdaabfbc9213c4f33b782f232a337ce07ce5799892ff948b866fe64505f06819d1932
7
- data.tar.gz: 73d475bf401c14a6e0577d503432a7bda868c875364c8ef566bf1ed882192709253de26eb1724ae78f7a86e44d4635a774f37692a5a8cfbedce2528e4ad35492
6
+ metadata.gz: 0af17fe252387b340ed14e4af39d3d55b2cb0daba4ea459e253625a77f1fab39208a953934077e7d4ec09c775be1c36a233927dbf74e865b6af7fbff1689856a
7
+ data.tar.gz: 4a101b17faf5d51ccefb88d68cd6f051462d709c87cfcac59bc5520d9afd211af73ae2ca63631ddd8371d1aa27aaab5011940835ef3d9951be0de146b0878a84
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- doggy (2.0.27)
4
+ doggy (2.0.28)
5
5
  json (~> 1.8.3)
6
6
  parallel (~> 1.6.1)
7
7
  rugged (~> 0.23.2)
@@ -44,4 +44,4 @@ DEPENDENCIES
44
44
  rake (~> 10.0)
45
45
 
46
46
  BUNDLED WITH
47
- 1.12.5
47
+ 1.13.6
@@ -73,6 +73,11 @@ module Doggy
73
73
 
74
74
  klass.assign_paths(remote_resources, local_resources)
75
75
  remote_resources.each(&:save_local)
76
+
77
+ ids = local_resources.map(&:id) - remote_resources.map(&:id)
78
+ local_resources.each do |local_resource|
79
+ local_resource.destroy_local if ids.include?(local_resource.id)
80
+ end
76
81
  end
77
82
  end
78
83
  end
@@ -2,27 +2,33 @@
2
2
 
3
3
  module Doggy
4
4
  class CLI::Push
5
+ WARNING_MESSAGE = "You are about to force push all the objects. "\
6
+ "This will override changes in Datadog if they have not been sycned to the dog repository. "\
7
+ "Do you want to proceed?(Y/N)"
8
+
5
9
  def initialize(options)
6
10
  @options = options
7
11
  end
8
12
 
9
13
  def run
10
- push_resources('dashboards', Models::Dashboard) if should_push?('dashboards')
11
- push_resources('monitors', Models::Monitor) if should_push?('monitors')
12
- push_resources('screens', Models::Screen) if should_push?('screens')
14
+ if @options['all_objects'] && !Doggy.ui.yes?(WARNING_MESSAGE)
15
+ Doggy.ui.say "Operation cancelled"
16
+ return
17
+ end
18
+
19
+ push_resources('dashboards', Models::Dashboard) if @options['dashboards']
20
+ push_resources('monitors', Models::Monitor) if @options['monitors']
21
+ push_resources('screens', Models::Screen) if @options['screens']
13
22
 
14
23
  Doggy::Model.emit_shipit_deployment
15
24
  end
16
25
 
17
26
  private
18
27
 
19
- def should_push?(resource)
20
- @options.empty? || @options[resource]
21
- end
22
-
23
28
  def push_resources(name, klass)
24
29
  Doggy.ui.say "Pushing #{ name }"
25
- local_resources = klass.all_local(only_changed: true)
30
+ local_resources = klass.all_local(only_changed: !@options['all_objects'])
31
+ Doggy.ui.say "#{ local_resources.size } objects to push"
26
32
  local_resources.each(&:save)
27
33
  end
28
34
  end
data/lib/doggy/cli.rb CHANGED
@@ -26,9 +26,10 @@ module Doggy
26
26
  the marker in their title will get it as a result of a push.
27
27
  D
28
28
 
29
- method_option "dashboards", type: :boolean, desc: 'Pull dashboards'
30
- method_option "monitors", type: :boolean, desc: 'Pull monitors'
31
- method_option "screens", type: :boolean, desc: 'Pull screens'
29
+ method_option "dashboards", type: :boolean, default: true, desc: 'Pull dashboards'
30
+ method_option "monitors", type: :boolean, default: true, desc: 'Pull monitors'
31
+ method_option "screens", type: :boolean, default: true, desc: 'Pull screens'
32
+ method_option "all_objects", type: :boolean, default: false, desc: 'Push all objects even if they are not changed'
32
33
 
33
34
  def push
34
35
  CLI::Push.new(options.dup).run
data/lib/doggy/model.rb CHANGED
@@ -200,8 +200,10 @@ module Doggy
200
200
  attributes = request(:post, resource_url, body)
201
201
  self.id = self.class.new(attributes).id
202
202
  save_local
203
+ Doggy.ui.say "Created #{ @path }"
203
204
  else
204
205
  request(:put, resource_url(id), body)
206
+ Doggy.ui.say "Updated #{ @path }"
205
207
  end
206
208
  end
207
209
 
@@ -209,6 +211,10 @@ module Doggy
209
211
  request(:delete, resource_url(id))
210
212
  end
211
213
 
214
+ def destroy_local
215
+ File.delete(@path)
216
+ end
217
+
212
218
  protected
213
219
 
214
220
  def resource_url(id = nil)
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.27"
4
+ VERSION = "2.0.28"
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.27
4
+ version: 2.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Gorodetsky
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-07-08 00:00:00.000000000 Z
12
+ date: 2016-11-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  version: '0'
177
177
  requirements: []
178
178
  rubyforge_project:
179
- rubygems_version: 2.6.5
179
+ rubygems_version: 2.6.8
180
180
  signing_key:
181
181
  specification_version: 4
182
182
  summary: Syncs DataDog dashboards, alerts, screenboards, and monitors.