dshelf 0.2.8 → 0.2.9
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.
- data/lib/dshelf.rb +17 -4
- metadata +2 -2
data/lib/dshelf.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module DistributedShelf
|
2
|
-
VERSION = '0.2.
|
2
|
+
VERSION = '0.2.9'
|
3
3
|
|
4
4
|
@@config = {}
|
5
5
|
|
@@ -11,7 +11,15 @@ module DistributedShelf
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def distributed? file
|
14
|
-
|
14
|
+
return false unless @@config[:distributed_path]
|
15
|
+
if @@config[:distributed_path].respond_to? :each then
|
16
|
+
@@config[:distributed_path].each do |distributed_path|
|
17
|
+
return true unless File.expand_path(file).match(distributed_path).nil?
|
18
|
+
end
|
19
|
+
else
|
20
|
+
return not(File.expand_path(file).match(@@config[:distributed_path]).nil?)
|
21
|
+
end
|
22
|
+
false
|
15
23
|
end
|
16
24
|
|
17
25
|
def proxy_method(method, &b)
|
@@ -27,7 +35,13 @@ module DistributedShelf
|
|
27
35
|
|
28
36
|
def self.config= conf
|
29
37
|
@@config = conf
|
30
|
-
@@config[:distributed_path]
|
38
|
+
if @@config[:distributed_path].respond_to? :each then
|
39
|
+
@@config[:distributed_path].each do |distributed_path|
|
40
|
+
@@config[:distributed_path] == Regexp.new('^' + distributed_path + '/')
|
41
|
+
end
|
42
|
+
else
|
43
|
+
@@config[:distributed_path] == Regexp.new('^' + @@config[:distributed_path] + '/')
|
44
|
+
end
|
31
45
|
end
|
32
46
|
|
33
47
|
def server_url
|
@@ -46,4 +60,3 @@ require 'dshelf/dir'
|
|
46
60
|
require 'dshelf/dfile'
|
47
61
|
require 'dshelf/file'
|
48
62
|
require 'dshelf/stat'
|
49
|
-
|