doggy 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/doggy/model/dash.rb +1 -1
- data/lib/doggy/model/monitor.rb +4 -2
- data/lib/doggy/model/screen.rb +1 -1
- data/lib/doggy/shared_helpers.rb +27 -0
- data/lib/doggy/version.rb +1 -1
- data/lib/doggy.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf029d6c55560584ae887c90bb30d74c330e028b
|
4
|
+
data.tar.gz: c3e318a4c4ef35243fbc5e95f163e896b81b7cc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8413005760d002bbb137e09ba19b1907ac0ed778873c680d6ca2f1e659bd621a36fada78843a837da862e207ba369d5a48779f4ee117b7dc30db40f2ee91825
|
7
|
+
data.tar.gz: 7df10df686ff27ec591e6dd5acfe405d701c4f36fbcf3b3ef1c3c5f3e70021feb4fc015713bf2ae6321de668f8e23f426b817912558bf42bcb4aae2408ab6d4d
|
data/lib/doggy/model/dash.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Doggy
|
2
2
|
class Dash
|
3
3
|
def self.upload_all
|
4
|
-
objects = all_local_items.find_all { |(type, id), object| type == 'dash' }
|
4
|
+
objects = Doggy.all_local_items.find_all { |(type, id), object| type == 'dash' }
|
5
5
|
puts "Uploading #{objects.size} dashboards"
|
6
6
|
upload(objects.map { |(type, id), object| id })
|
7
7
|
rescue => e
|
data/lib/doggy/model/monitor.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Doggy
|
2
2
|
class Monitor
|
3
3
|
def self.upload_all
|
4
|
-
objects = all_local_items.find_all { |(type, id), object| type == 'monitor' }
|
4
|
+
objects = Doggy.all_local_items.find_all { |(type, id), object| type == 'monitor' }
|
5
5
|
puts "Uploading #{objects.size} monitors"
|
6
6
|
upload(objects.map { |(type, id), object| id })
|
7
7
|
rescue => e
|
@@ -88,6 +88,8 @@ module Doggy
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def push
|
91
|
+
@name ||= raw_local['name']
|
92
|
+
|
91
93
|
return if @name =~ Doggy::DOG_SKIP_REGEX
|
92
94
|
return unless Doggy.determine_type(raw_local) == 'monitor'
|
93
95
|
|
@@ -132,7 +134,7 @@ module Doggy
|
|
132
134
|
end
|
133
135
|
|
134
136
|
def mute_state_for(id)
|
135
|
-
if remote_state = Doggy.
|
137
|
+
if remote_state = Doggy.all_local_items.detect { |key, value| key == [ 'monitor', id.to_i ] }
|
136
138
|
remote_state[1]['options']['silenced'] if remote_state[1]['options']
|
137
139
|
end
|
138
140
|
end
|
data/lib/doggy/model/screen.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Doggy
|
2
2
|
class Screen
|
3
3
|
def self.upload_all
|
4
|
-
objects = all_local_items.find_all { |(type, id), object| type == 'screen' }
|
4
|
+
objects = Doggy.all_local_items.find_all { |(type, id), object| type == 'screen' }
|
5
5
|
puts "Uploading #{objects.size} screens"
|
6
6
|
upload(objects.map { |(type, id), object| id })
|
7
7
|
rescue => e
|
data/lib/doggy/shared_helpers.rb
CHANGED
@@ -32,5 +32,32 @@ module Doggy
|
|
32
32
|
puts
|
33
33
|
line == "Y"
|
34
34
|
end
|
35
|
+
|
36
|
+
def self.error(msg)
|
37
|
+
puts "[ERROR] #{ msg }"
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.find_root
|
41
|
+
File.dirname(find_file("Gemfile"))
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.find_file(*names)
|
45
|
+
search_up(*names) do |filename|
|
46
|
+
return filename if File.file?(filename)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.search_up(*names)
|
51
|
+
previous = nil
|
52
|
+
current = File.expand_path(Pathname.pwd)
|
53
|
+
|
54
|
+
until !File.directory?(current) || current == previous
|
55
|
+
names.each do |name|
|
56
|
+
filename = File.join(current, name)
|
57
|
+
yield filename
|
58
|
+
end
|
59
|
+
current, previous = File.expand_path("..", current), current
|
60
|
+
end
|
61
|
+
end
|
35
62
|
end
|
36
63
|
end
|
data/lib/doggy/version.rb
CHANGED
data/lib/doggy.rb
CHANGED
@@ -35,7 +35,7 @@ module Doggy
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def objects_path
|
38
|
-
@objects_path ||= Pathname.new('objects').expand_path(
|
38
|
+
@objects_path ||= Pathname.new('objects').expand_path(SharedHelpers.find_root).expand_path.tap { |path| FileUtils.mkdir_p(path) }
|
39
39
|
end
|
40
40
|
|
41
41
|
def load_item(f)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doggy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vlad Gorodetsky
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|