roozer_client 0.7 → 0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/CHANGELOG +1 -0
- data/README +12 -0
- data/lib/roozer_client.rb +20 -0
- data/roozer_client.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmIwZWU0ZTJlZjQyMzQwZGU5Mjc5YWUyZWUxOTQyNWQxOGViOWQwMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzU2NTk4YWVjMzliNjdhZmNjMzhmZWU3MTA5MzBiYzQ2NTAwYWJkZg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTg1MTQzNGY2Mjc0ZDMyNTJkM2I0MmMxZWQxNTE0Y2MwMjgzNzZjMDRkOTMy
|
10
|
+
ZGZkZjIzMzg5MTI4MjBmYzM4YWVlYWFlZmZjZDBjNWRhNDNhNmIyZWY0MjJl
|
11
|
+
NThjZGZhN2MxYjk4OTRkMTE2Y2VlYzBkNTlkNDU5MGZhYmY0MTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGJjNTk3NTgyY2UyMTk2YjIwYTdmZDk3N2JiZWY3Yzc3YmI3NGViNjg4ZGQ3
|
14
|
+
NGNiYzFhODlkMjdiNmI2YmYzNDEwYWU4MTkwYTE2ZjRlMGU4MzYwZjMyNjE5
|
15
|
+
YmYxMmE2NGVkYjQ3MGI3NjBjZGQ3ZmE2N2IxYWNjNGFhNGRkNzA=
|
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -7,15 +7,27 @@ require 'roozer_client'
|
|
7
7
|
|
8
8
|
rc = RoozerClient.new(url: 'http://orch1:2987;http://orch2:2987', path: 'rootpath')
|
9
9
|
|
10
|
+
# Create a file
|
10
11
|
rc['subpath'] = { data: "abc" }
|
11
12
|
|
13
|
+
# List dirs
|
12
14
|
rc.list
|
13
15
|
=> ['subpath']
|
14
16
|
|
17
|
+
# Read a file
|
15
18
|
rc['subpath']
|
16
19
|
=> { "data" => "abc" }
|
17
20
|
|
21
|
+
# List all dirs in a depth-first traversal
|
22
|
+
rc['dir1/dir2/dir3'] = true
|
23
|
+
rc.tree 'dir1'
|
24
|
+
=> ["/dir1/dir2/dir3", "/dir1/dir2", "/dir1"]
|
25
|
+
|
26
|
+
# Delete a file
|
18
27
|
rc.delete 'subpath/data'
|
19
28
|
|
29
|
+
# Delete all files in a directory tree
|
30
|
+
rc.deltree 'dir1'
|
31
|
+
|
20
32
|
# sets the data only if is different to what is already there
|
21
33
|
rc.update(path, {...data...})
|
data/lib/roozer_client.rb
CHANGED
@@ -39,6 +39,26 @@ class RoozerClient
|
|
39
39
|
request(:delete, path)
|
40
40
|
end
|
41
41
|
|
42
|
+
def deltree(path)
|
43
|
+
tree(path).each do |entry|
|
44
|
+
begin
|
45
|
+
delete(entry)
|
46
|
+
rescue RestClient::ResourceNotFound:
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def tree(path=nil)
|
52
|
+
result = []
|
53
|
+
entries = list(path)
|
54
|
+
if entries
|
55
|
+
entries.each do |entry|
|
56
|
+
result.push(*tree("#{path}/#{entry}"))
|
57
|
+
end
|
58
|
+
end
|
59
|
+
result.push path
|
60
|
+
end
|
61
|
+
|
42
62
|
def update(path, data)
|
43
63
|
existing_data = get(path) rescue nil
|
44
64
|
put(path, data) unless data && existing_data == JSON.parse(data.to_json)
|
data/roozer_client.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "roozer_client"
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.8"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Andrew Snow"]
|
9
|
-
s.date = "2013-
|
9
|
+
s.date = "2013-06-05"
|
10
10
|
s.description = "Ruby client for Roozer server"
|
11
11
|
s.email = "andrew@modulus.org"
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "README", "lib/roozer_client.rb"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roozer_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Snow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
type: :runtime
|