doggy 2.0.10 → 2.0.11

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: 20a23d44ef56b781817428436182c4b2d625302c
4
- data.tar.gz: 0847d3a2d3c4664bd2d97d0625bc668e92487219
3
+ metadata.gz: a03dea3042516cbe90113a39d58cbe0aeb080ebc
4
+ data.tar.gz: d42ed86f756843f49ac3e29fc520ab781f73a4fe
5
5
  SHA512:
6
- metadata.gz: 7fb46ebd393872965c2f097fcfcc6ffaa7a36bda96eb624adc2a129c5af7c9ec64e060357c6e66a1b53d994a4ae59ce471530673b376e370484ea08607bbefb6
7
- data.tar.gz: 87e506be484f04d2add6d6c59c802ce1673e660b3b219fd70f648252875b4e32752f4fecddd85c868b85343147a8df0dcc7bf113a82b761d759075f46606ff07
6
+ metadata.gz: 698c71f8b6b353dad00b4ee6522a91080a47927b528f666c900032ab40091552ad54d68f96d5c1e60c676c7843dc4ce8c0d3714398596cf690836a1e77c5f441
7
+ data.tar.gz: 97ecfe0e042c35edf5a63e8d4e6730aea763f7b7aa9c6f6cf321689b495871e6aeee3b8820c834f52b24d9cf685ed1f1298ba194622712080a15b5b2084a2ca9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- doggy (2.0.10)
4
+ doggy (2.0.11)
5
5
  json (~> 1.8.3)
6
6
  parallel (~> 1.6.1)
7
7
  rugged (~> 0.23.2)
@@ -2,14 +2,15 @@
2
2
 
3
3
  module Doggy
4
4
  class CLI::Pull
5
- def initialize(options)
5
+ def initialize(ids:, options:)
6
+ @ids = ids
6
7
  @options = options
7
8
  end
8
9
 
9
10
  def run
10
- pull_resources('dashboards', Models::Dashboard) if should_pull?('dashboards')
11
- pull_resources('monitors', Models::Monitor) if should_pull?('monitors')
12
- pull_resources('screens', Models::Screen) if should_pull?('screens')
11
+ pull_resources('dashboards', Models::Dashboard, @ids) if should_pull?('dashboards')
12
+ pull_resources('monitors', Models::Monitor, @ids) if should_pull?('monitors')
13
+ pull_resources('screens', Models::Screen, @ids) if should_pull?('screens')
13
14
  end
14
15
 
15
16
  private
@@ -18,11 +19,15 @@ module Doggy
18
19
  @options.empty? || @options[resource]
19
20
  end
20
21
 
21
- def pull_resources(name, klass)
22
- Doggy.ui.say "Pulling #{ name }"
22
+ def pull_resources(name, klass, ids)
23
+ if ids.any?
24
+ Doggy.ui.say "Pulling #{ name }: #{ids.join(', ')}"
25
+ remote_resources = klass.all.find_all { |m| ids.include?(m.id.to_s) }
26
+ else
27
+ Doggy.ui.say "Pulling #{ name }"
28
+ remote_resources = klass.all
29
+ end
23
30
  local_resources = klass.all_local
24
- remote_resources = klass.all
25
-
26
31
  klass.assign_paths(remote_resources, local_resources)
27
32
  remote_resources.each(&:save_local)
28
33
  end
data/lib/doggy/cli.rb CHANGED
@@ -16,8 +16,8 @@ module Doggy
16
16
  method_option "monitors", type: :boolean, desc: 'Pull monitors'
17
17
  method_option "screens", type: :boolean, desc: 'Pull screens'
18
18
 
19
- def pull
20
- CLI::Pull.new(options.dup).run
19
+ def pull(*ids)
20
+ CLI::Pull.new(ids: ids, options: options.dup).run
21
21
  end
22
22
 
23
23
  desc "push", "Pushes objects to 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.10"
4
+ VERSION = "2.0.11"
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.10
4
+ version: 2.0.11
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-07 00:00:00.000000000 Z
12
+ date: 2015-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json