rbbt-util 5.5.11 → 5.5.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/rbbt/resource.rb +26 -10
- data/lib/rbbt/util/misc.rb +1 -0
- data/test/rbbt/test_resource.rb +10 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Zjg3YjYwNzBjODk3NmYzYTQ4MTI2NDRkZGYyNmUzMGMzNWZjOGVkMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmExODdlZjVkYWZkN2E0M2YyYzc4NjA0MGU2YjA1ZjhhYzY2MjE0ZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTllODgwMzFhZDFmYzJjMWNjZWZjMmQ3MTBjNDdhZjJkY2FiNTliM2IxYjQ4
|
10
|
+
YjQ4ZjNmODg5M2ZiMjBhOTMzY2EwN2IyY2M3ZTRjNTkzOWZlMzc2MDhlZDI3
|
11
|
+
Mjk2MzJlYWY0MTRjZDgwOTY1YjgwMWExNThiZTk2YjlhMmI1ODg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzdmZWU4YjMxN2M2ZTJkNTNjNTBlYzZhYTZmZTI5MWM1N2ZlNTMyMWQ3MTZl
|
14
|
+
YzdlNDFjMmNiZjI1ZThhMzNhYTMzY2RmZjY5NWU2ZjQ5ZGU2ZDZmMGRhNWI0
|
15
|
+
ZTcxY2MzNWVhZTBkMTI2ZTllNjkyMGQxYzI4MjUwYmFhZDk5OWE=
|
data/lib/rbbt/resource.rb
CHANGED
@@ -3,20 +3,21 @@ require 'rbbt/util/log'
|
|
3
3
|
require 'rbbt/resource/path'
|
4
4
|
|
5
5
|
module Resource
|
6
|
-
def self.
|
7
|
-
|
8
|
-
|
9
|
-
attr_accessor :pkgdir, :subdir, :resources, :rake_dirs
|
10
|
-
end
|
6
|
+
def self.remote_servers
|
7
|
+
@remote_servers = Rbbt.etc.file_servers.exists? ? Rbbt.etc.file_servers.yaml : {}
|
8
|
+
end
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
def self.extended(base)
|
11
|
+
base.pkgdir = 'rbbt'
|
12
|
+
base.subdir = ''
|
13
|
+
base.resources = {}
|
14
|
+
base.rake_dirs = {}
|
15
|
+
base.remote_server = Resource.remote_servers[base.to_s]
|
17
16
|
base
|
18
17
|
end
|
19
18
|
|
19
|
+
attr_accessor :pkgdir, :subdir, :resources, :rake_dirs, :remote_server
|
20
|
+
|
20
21
|
def root()
|
21
22
|
Path.setup @subdir || "", @pkgdir, self
|
22
23
|
end
|
@@ -52,6 +53,20 @@ module Resource
|
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
56
|
+
def get_from_server(path, final_path)
|
57
|
+
url = File.join(remote_server, '/resource/', self.to_s, 'get_file')
|
58
|
+
url << "?" << Misc.hash2GET_params(:file => path, :create => false)
|
59
|
+
begin
|
60
|
+
Open.write(final_path, Open.read(url, :nocache => true))
|
61
|
+
return true
|
62
|
+
rescue
|
63
|
+
Log.warn "Could not retrieve (#{self.to_s}) #{ path } from #{ remote_server }"
|
64
|
+
Log.error $!.message
|
65
|
+
FileUtils.rm final_path if File.exists? final_path
|
66
|
+
return false
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
55
70
|
def produce(path, force = false)
|
56
71
|
case
|
57
72
|
when @resources.include?(path)
|
@@ -68,6 +83,7 @@ module Resource
|
|
68
83
|
if not File.exists? final_path or force
|
69
84
|
Log.medium "Producing: #{ final_path }"
|
70
85
|
Misc.lock final_path + '.produce' do
|
86
|
+
(remote_server and get_from_server(path, final_path)) or
|
71
87
|
begin
|
72
88
|
case type
|
73
89
|
when :string
|
data/lib/rbbt/util/misc.rb
CHANGED
data/test/rbbt/test_resource.rb
CHANGED
@@ -60,8 +60,16 @@ class TestTSV < Test::Unit::TestCase
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def test_libdir
|
63
|
-
assert File.exists? TestResource[].share.
|
64
|
-
assert File.exists? TestResource[].share.
|
63
|
+
assert File.exists? TestResource[].share.Rlib["util.R"].find :lib
|
64
|
+
assert File.exists? TestResource[].share.Rlib["util.R"].find
|
65
|
+
end
|
66
|
+
|
67
|
+
def __test_server
|
68
|
+
require 'rbbt/sources/organism'
|
69
|
+
TmpFile.with_file do |tmp|
|
70
|
+
Organism.get_from_server("Hsa/jun2011/identifiers", tmp)
|
71
|
+
assert Open.read(tmp).length > 10000
|
72
|
+
end
|
65
73
|
end
|
66
74
|
|
67
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.5.
|
4
|
+
version: 5.5.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|