doggy 2.0.12 → 2.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/doggy.gemspec +3 -1
- data/lib/doggy/cli/edit.rb +20 -3
- data/lib/doggy/model.rb +9 -4
- data/lib/doggy/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9631f272d56c95b7c5c7da64b49f4e1d9cccc806
|
4
|
+
data.tar.gz: bf31b617627cdd4e03e22abb98334fa2f6994286
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b97601410b40bcc1334ef596dd2fbd2e0a4003abd4af9358c3a4c4ff309999cb4f3703f9962c78e73f3529061a6925b54fcc5778dcfa331d92fc7a66f4eb6369
|
7
|
+
data.tar.gz: ea11782d471dfe8e677f3603445eacdb934fa0ae72b7b29fb806d68fbee7e6516fad43b81d5b70b642851cc9a16bea7023221f9c3c471ec6365416522021ca84
|
data/Gemfile.lock
CHANGED
data/doggy.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["v@gor.io", "me@andremedeiros.info"]
|
11
11
|
|
12
12
|
spec.summary = %q{Syncs DataDog dashboards, alerts, screenboards, and monitors.}
|
13
|
-
spec.description = %q{Syncs DataDog dashboards, alerts, screenboards, and monitors.}
|
13
|
+
spec.description = %q{Syncs and manages DataDog dashboards, alerts, screenboards, and monitors.}
|
14
14
|
spec.homepage = "http://github.com/bai/doggy"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
+
spec.required_ruby_version = '~> 2.1'
|
23
|
+
|
22
24
|
spec.add_dependency "json", "~> 1.8.3"
|
23
25
|
spec.add_dependency "parallel", "~> 1.6.1"
|
24
26
|
spec.add_dependency "thor", "~> 0.19.1"
|
data/lib/doggy/cli/edit.rb
CHANGED
@@ -12,14 +12,20 @@ module Doggy
|
|
12
12
|
return Doggy.ui.error("Could not find resource with #{ @param }") unless resource
|
13
13
|
|
14
14
|
Dir.chdir(File.dirname(resource.path)) do
|
15
|
-
|
15
|
+
forked_resource = fork(resource)
|
16
|
+
system("open '#{ forked_resource.human_edit_url }'")
|
16
17
|
while !Doggy.ui.yes?('Are you done editing?') do
|
17
18
|
Doggy.ui.say "run, rabbit run / dig that hole, forget the sun / and when at last the work is done / don't sit down / it's time to dig another one"
|
18
19
|
end
|
19
20
|
|
20
|
-
new_resource
|
21
|
-
new_resource.
|
21
|
+
new_resource = resource.class.find(forked_resource.id)
|
22
|
+
new_resource.id = resource.id
|
23
|
+
new_resource.title = resource.title
|
24
|
+
new_resource.description = resource.description
|
25
|
+
new_resource.path = resource.path
|
22
26
|
new_resource.save_local
|
27
|
+
|
28
|
+
forked_resource.destroy
|
23
29
|
end
|
24
30
|
end
|
25
31
|
|
@@ -38,6 +44,17 @@ module Doggy
|
|
38
44
|
return resources.find { |res| res.path == full_path }
|
39
45
|
end
|
40
46
|
end
|
47
|
+
|
48
|
+
def fork(resource)
|
49
|
+
salt = (0...12).map { (65 + rand(26)).chr.downcase }.join
|
50
|
+
|
51
|
+
forked_resource = resource.dup
|
52
|
+
forked_resource.id = nil
|
53
|
+
forked_resource.title = "[#{ salt }] " + forked_resource.title
|
54
|
+
forked_resource.description = "[fork of #{ resource.id }] " + forked_resource.title
|
55
|
+
forked_resource.save
|
56
|
+
forked_resource
|
57
|
+
end
|
41
58
|
end
|
42
59
|
end
|
43
60
|
|
data/lib/doggy/model.rb
CHANGED
@@ -105,16 +105,17 @@ module Doggy
|
|
105
105
|
http.use_ssl = (uri.scheme == 'https')
|
106
106
|
|
107
107
|
request = case method
|
108
|
-
when :get
|
109
|
-
when :post
|
110
|
-
when :put
|
108
|
+
when :get then Net::HTTP::Get.new(uri.request_uri)
|
109
|
+
when :post then Net::HTTP::Post.new(uri.request_uri)
|
110
|
+
when :put then Net::HTTP::Put.new(uri.request_uri)
|
111
|
+
when :delete then Net::HTTP::Delete.new(uri.request_uri)
|
111
112
|
end
|
112
113
|
|
113
114
|
request.content_type = 'application/json'
|
114
115
|
request.body = body if body
|
115
116
|
|
116
117
|
response = http.request(request)
|
117
|
-
JSON.parse(response.body)
|
118
|
+
response.body ? JSON.parse(response.body) : nil
|
118
119
|
end
|
119
120
|
|
120
121
|
def current_sha
|
@@ -172,6 +173,10 @@ module Doggy
|
|
172
173
|
end
|
173
174
|
end
|
174
175
|
|
176
|
+
def destroy
|
177
|
+
request(:delete, resource_url(id))
|
178
|
+
end
|
179
|
+
|
175
180
|
protected
|
176
181
|
|
177
182
|
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.14
|
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: 2015-10-
|
12
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
|
-
description: Syncs DataDog dashboards, alerts, screenboards, and monitors.
|
126
|
+
description: Syncs and manages DataDog dashboards, alerts, screenboards, and monitors.
|
127
127
|
email:
|
128
128
|
- v@gor.io
|
129
129
|
- me@andremedeiros.info
|
@@ -166,9 +166,9 @@ require_paths:
|
|
166
166
|
- lib
|
167
167
|
required_ruby_version: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
|
-
- - "
|
169
|
+
- - "~>"
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version: '
|
171
|
+
version: '2.1'
|
172
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
174
|
- - ">="
|