doggy 2.0.27 → 2.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/doggy/cli/pull.rb +5 -0
- data/lib/doggy/cli/push.rb +14 -8
- data/lib/doggy/cli.rb +4 -3
- data/lib/doggy/model.rb +6 -0
- data/lib/doggy/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfcc017d59badc8a0675e416fa434442b398c9a5
|
|
4
|
+
data.tar.gz: a12619e920d86487a3f4f9c0cd34965887a4f287
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0af17fe252387b340ed14e4af39d3d55b2cb0daba4ea459e253625a77f1fab39208a953934077e7d4ec09c775be1c36a233927dbf74e865b6af7fbff1689856a
|
|
7
|
+
data.tar.gz: 4a101b17faf5d51ccefb88d68cd6f051462d709c87cfcac59bc5520d9afd211af73ae2ca63631ddd8371d1aa27aaab5011940835ef3d9951be0de146b0878a84
|
data/Gemfile.lock
CHANGED
data/lib/doggy/cli/pull.rb
CHANGED
|
@@ -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
|
data/lib/doggy/cli/push.rb
CHANGED
|
@@ -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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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:
|
|
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",
|
|
30
|
-
method_option "monitors",
|
|
31
|
-
method_option "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
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.
|
|
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-
|
|
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.
|
|
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.
|