doggy 2.0.15 → 2.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/doggy.gemspec +1 -1
- data/lib/doggy/cli.rb +1 -1
- data/lib/doggy/cli/edit.rb +8 -0
- data/lib/doggy/cli/pull.rb +3 -3
- data/lib/doggy/model.rb +15 -1
- 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: bb97cb24320519a7bba30b15a873051f5948728c
|
4
|
+
data.tar.gz: 327e1a6e44d4fcec59eccca3ad057587a6000604
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07b2acceb8064210cb05db56b6544155a2228f7d2bc679dcbd6c773346dc436e91ad93c2400ffa344db0ab4c59ee4d9c395b93e547f29e90ccbf1bb1916e2e71
|
7
|
+
data.tar.gz: f0beada455921ce51d6b4b5a387654bcf352edef0b0810988a88b91428aebc08584340f1ffa13cafedb20b8a100698bb4f3fb08946a7cbd8d5d276dfad6d87b7
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/doggy.gemspec
CHANGED
@@ -19,7 +19,7 @@ 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.
|
22
|
+
spec.required_ruby_version = '~> 2.0'
|
23
23
|
|
24
24
|
spec.add_dependency "json", "~> 1.8.3"
|
25
25
|
spec.add_dependency "parallel", "~> 1.6.1"
|
data/lib/doggy/cli.rb
CHANGED
data/lib/doggy/cli/edit.rb
CHANGED
@@ -48,6 +48,14 @@ module Doggy
|
|
48
48
|
if @param =~ /^[0-9]+$/ then
|
49
49
|
id = @param.to_i
|
50
50
|
return resources.find { |res| res.id == id }
|
51
|
+
elsif @param =~ /^http/ then
|
52
|
+
id = case @param
|
53
|
+
when /com\/dash/ then Integer(@param[/dash\/(\d+)/i, 1])
|
54
|
+
when /com\/screen/ then Integer(@param[/screen\/(\d+)/i, 1])
|
55
|
+
when /com\/monitors/ then Integer(@param[/monitors#(\d+)/i, 1])
|
56
|
+
else raise StandardError.new('Unknown resource type, cannot edit.')
|
57
|
+
end
|
58
|
+
return resources.find { |res| res.id == id }
|
51
59
|
else
|
52
60
|
full_path = File.expand_path(@param, Doggy.object_root)
|
53
61
|
return resources.find { |res| res.path == full_path }
|
data/lib/doggy/cli/pull.rb
CHANGED
data/lib/doggy/model.rb
CHANGED
@@ -138,12 +138,22 @@ module Doggy
|
|
138
138
|
}.to_json)
|
139
139
|
end
|
140
140
|
|
141
|
+
def sort_by_key(hash, &block)
|
142
|
+
hash.keys.sort(&block).reduce({}) do |seed, key|
|
143
|
+
seed[key] = hash[key]
|
144
|
+
if seed[key].is_a?(Hash)
|
145
|
+
seed[key] = Doggy::Model.sort_by_key(seed[key], &block)
|
146
|
+
end
|
147
|
+
seed
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
141
151
|
protected
|
142
152
|
|
143
153
|
def resource_url(id = nil)
|
144
154
|
raise NotImplementedError, "#resource_url has to be implemented."
|
145
155
|
end
|
146
|
-
end
|
156
|
+
end # class << self
|
147
157
|
|
148
158
|
def initialize(attributes = nil)
|
149
159
|
root_key = self.class.root
|
@@ -160,6 +170,10 @@ module Doggy
|
|
160
170
|
File.open(@path, 'w') { |f| f.write(JSON.pretty_generate(to_h)) }
|
161
171
|
end
|
162
172
|
|
173
|
+
def to_h
|
174
|
+
Doggy::Model.sort_by_key(super)
|
175
|
+
end
|
176
|
+
|
163
177
|
def save
|
164
178
|
ensure_managed_emoji!
|
165
179
|
|
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.17
|
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-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
168
|
requirements:
|
169
169
|
- - "~>"
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version: '2.
|
171
|
+
version: '2.0'
|
172
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
174
|
- - ">="
|