doggy 2.0.28 → 2.0.29

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: bfcc017d59badc8a0675e416fa434442b398c9a5
4
- data.tar.gz: a12619e920d86487a3f4f9c0cd34965887a4f287
3
+ metadata.gz: 91c2b9cacf34931798638f66cd8b715c7a82fe90
4
+ data.tar.gz: fcc7987e9cb35c25fe11aeaeb300837417cda15b
5
5
  SHA512:
6
- metadata.gz: 0af17fe252387b340ed14e4af39d3d55b2cb0daba4ea459e253625a77f1fab39208a953934077e7d4ec09c775be1c36a233927dbf74e865b6af7fbff1689856a
7
- data.tar.gz: 4a101b17faf5d51ccefb88d68cd6f051462d709c87cfcac59bc5520d9afd211af73ae2ca63631ddd8371d1aa27aaab5011940835ef3d9951be0de146b0878a84
6
+ metadata.gz: 20dc45a9c05aa91769f94f02dbf99431476826926b89d6380aa0dd3aaf9581ac70fc17fb9b6fbaf75c5c9d9cb00ddb6a6160b544483641cda9cf7bdf975372b2
7
+ data.tar.gz: fd65d752b941303a69f195b9c1de9f3db838c230771fb31ffcc01b2f71a0366f2d14b8649fb6a86cc86e1fcdc9a1f75c6b71fffb701042a8ae5c0b64886bec51
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.1
data/Gemfile CHANGED
@@ -1,3 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ group :test do
6
+ gem 'mocha'
7
+ gem 'webmock'
8
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- doggy (2.0.28)
4
+ doggy (2.0.27)
5
5
  json (~> 1.8.3)
6
6
  parallel (~> 1.6.1)
7
7
  rugged (~> 0.23.2)
@@ -11,21 +11,31 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
+ addressable (2.5.0)
15
+ public_suffix (~> 2.0, >= 2.0.2)
14
16
  axiom-types (0.1.1)
15
17
  descendants_tracker (~> 0.0.4)
16
18
  ice_nine (~> 0.11.0)
17
19
  thread_safe (~> 0.3, >= 0.3.1)
18
20
  coercible (1.0.0)
19
21
  descendants_tracker (~> 0.0.1)
22
+ crack (0.4.3)
23
+ safe_yaml (~> 1.0.0)
20
24
  descendants_tracker (0.0.4)
21
25
  thread_safe (~> 0.3, >= 0.3.1)
22
26
  equalizer (0.0.11)
27
+ hashdiff (0.2.3)
23
28
  ice_nine (0.11.2)
24
29
  json (1.8.3)
30
+ metaclass (0.0.4)
25
31
  minitest (5.9.0)
32
+ mocha (1.1.0)
33
+ metaclass (~> 0.0.1)
26
34
  parallel (1.6.2)
35
+ public_suffix (2.0.4)
27
36
  rake (10.5.0)
28
37
  rugged (0.23.3)
38
+ safe_yaml (1.0.4)
29
39
  thor (0.19.1)
30
40
  thread_safe (0.3.5)
31
41
  virtus (1.0.5)
@@ -33,6 +43,10 @@ GEM
33
43
  coercible (~> 1.0)
34
44
  descendants_tracker (~> 0.0, >= 0.0.3)
35
45
  equalizer (~> 0.0, >= 0.0.9)
46
+ webmock (1.22.6)
47
+ addressable (>= 2.3.6)
48
+ crack (>= 0.3.2)
49
+ hashdiff
36
50
 
37
51
  PLATFORMS
38
52
  ruby
@@ -41,7 +55,9 @@ DEPENDENCIES
41
55
  bundler (~> 1.10)
42
56
  doggy!
43
57
  minitest
58
+ mocha
44
59
  rake (~> 10.0)
60
+ webmock
45
61
 
46
62
  BUNDLED WITH
47
63
  1.13.6
@@ -9,6 +9,7 @@ module Doggy
9
9
 
10
10
  def run
11
11
  resource = resource_by_param
12
+ resource.read_only = false
12
13
  return Doggy.ui.error("Could not find resource with #{ @param }") unless resource
13
14
 
14
15
  Dir.chdir(File.dirname(resource.path)) do
@@ -28,6 +28,7 @@ module Doggy
28
28
  def push_resources(name, klass)
29
29
  Doggy.ui.say "Pushing #{ name }"
30
30
  local_resources = klass.all_local(only_changed: !@options['all_objects'])
31
+ local_resources.each(&:ensure_read_only!)
31
32
  Doggy.ui.say "#{ local_resources.size } objects to push"
32
33
  local_resources.each(&:save)
33
34
  end
data/lib/doggy/model.rb CHANGED
@@ -9,6 +9,8 @@ module Doggy
9
9
  class Model
10
10
  include Virtus.model
11
11
 
12
+ attribute :read_only, Boolean
13
+
12
14
  # This stores the path on disk. We don't define it as a model attribute so
13
15
  # it doesn't get serialized.
14
16
  attr_accessor :path
@@ -150,6 +152,8 @@ module Doggy
150
152
  seed[key] = hash[key]
151
153
  if seed[key].is_a?(Hash)
152
154
  seed[key] = Doggy::Model.sort_by_key(seed[key], &block)
155
+ elsif seed[key].is_a?(Array)
156
+ seed[key].each_with_index { |e, i| seed[key][i] = sort_by_key(e, &block) if e.is_a?(Hash) }
153
157
  end
154
158
  seed
155
159
  end
@@ -172,7 +176,12 @@ module Doggy
172
176
  super(attributes)
173
177
  end
174
178
 
179
+ def ensure_read_only!
180
+ self.read_only = true
181
+ end
182
+
175
183
  def save_local
184
+ ensure_read_only!
176
185
  prefix = case self.class.name
177
186
  when 'Doggy::Models::Dashboard' then 'dash'
178
187
  when 'Doggy::Models::Monitor' then 'monitor'
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.28"
4
+ VERSION = "2.0.29"
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.28
4
+ version: 2.0.29
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-11-23 00:00:00.000000000 Z
12
+ date: 2016-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -133,6 +133,7 @@ extensions: []
133
133
  extra_rdoc_files: []
134
134
  files:
135
135
  - ".gitignore"
136
+ - ".ruby-version"
136
137
  - ".travis.yml"
137
138
  - CODE_OF_CONDUCT.md
138
139
  - Gemfile
@@ -176,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
177
  version: '0'
177
178
  requirements: []
178
179
  rubyforge_project:
179
- rubygems_version: 2.6.8
180
+ rubygems_version: 2.5.1
180
181
  signing_key:
181
182
  specification_version: 4
182
183
  summary: Syncs DataDog dashboards, alerts, screenboards, and monitors.