rbcm 0.0.3 → 0.0.4
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 +4 -4
- data/app/node/file.rb +10 -3
- data/app/node/filesystem.rb +2 -7
- data/app/node/sandbox.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18358db563420dbb86ff61c82e2ebfe670f8878eae1e0039ff584585e0e6934f
|
4
|
+
data.tar.gz: 949374f2d7334a4f1e5a252af5b482fc96fcbe40492edca9c800eabd5fc89cec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c96e1fa1201ea22c1d0f6ba043c5b22e874b5ab617ec3cdd5bdf46bc8844ef291ce29ed34b584c1c935bd2cbb5f698a566e9426927396c733e700a8eea59fbcb
|
7
|
+
data.tar.gz: 5d4e5b694a7d7b805a420fdb8284538b705f161208bc186f27a90debfa5f60cde25050d023385d2f51d24f811baf822bc1cf2fe4cc97eed0ff0d8d7d89f8ab46
|
data/app/node/file.rb
CHANGED
@@ -4,13 +4,20 @@ class Node::File
|
|
4
4
|
@filesystem = filesystem
|
5
5
|
end
|
6
6
|
|
7
|
-
attr_writer :content, :mode
|
7
|
+
attr_writer :content, :mode
|
8
8
|
|
9
9
|
def content
|
10
|
-
@content ||=
|
10
|
+
@content ||= (
|
11
|
+
log "DOWNLOADING #{@filesystem.node.name}: '#{@path}'"
|
12
|
+
response = @filesystem.node.remote.execute("cat '#{@path}'")
|
13
|
+
response = "" if response.exitstatus != 0
|
14
|
+
response
|
15
|
+
)
|
11
16
|
end
|
12
17
|
|
13
18
|
def mode
|
14
|
-
@mode ||= @filesystem.
|
19
|
+
@mode ||= @filesystem.node.remote.execute(
|
20
|
+
"stat -c \"%a\" * '#{@path}'"
|
21
|
+
).chomp.chomp.to_i
|
15
22
|
end
|
16
23
|
end
|
data/app/node/filesystem.rb
CHANGED
@@ -5,6 +5,8 @@ class Node::Filesystem
|
|
5
5
|
@files = {}
|
6
6
|
end
|
7
7
|
|
8
|
+
attr_reader :node
|
9
|
+
|
8
10
|
def [] path
|
9
11
|
if @underlying
|
10
12
|
@files[path] || @underlying[path]
|
@@ -12,11 +14,4 @@ class Node::Filesystem
|
|
12
14
|
@files[path] ||= Node::File.new path: path, filesystem: self
|
13
15
|
end
|
14
16
|
end
|
15
|
-
|
16
|
-
def download path
|
17
|
-
log "DOWNLOADING #{@node.name}: '#{path}'"
|
18
|
-
response = @node.remote.execute("cat '#{path}'")
|
19
|
-
response = "" if response.exitstatus != 0
|
20
|
-
response
|
21
|
-
end
|
22
17
|
end
|
data/app/node/sandbox.rb
CHANGED
@@ -15,7 +15,14 @@ class Node::Sandbox
|
|
15
15
|
# define in instance, otherwise method-binding will be wrong (to class)
|
16
16
|
@@capabilities = @node.rbcm.project.capabilities.each.name
|
17
17
|
@node.rbcm.project.capabilities.each do |capability|
|
18
|
-
|
18
|
+
__add_capability capability
|
19
|
+
end
|
20
|
+
# wrap base_capabilities
|
21
|
+
[:file, :run].each do |base_capability|
|
22
|
+
__add_capability Project::Capability.new(
|
23
|
+
name: base_capability,
|
24
|
+
content: method(base_capability).unbind
|
25
|
+
)
|
19
26
|
end
|
20
27
|
end
|
21
28
|
|
@@ -174,7 +181,7 @@ class Node::Sandbox
|
|
174
181
|
@cache[reset] = [] if reset
|
175
182
|
end
|
176
183
|
|
177
|
-
def
|
184
|
+
def __add_capability capability
|
178
185
|
@@capabilities << capability.name unless capability.name[-1] == "!"
|
179
186
|
# define capability method
|
180
187
|
define_singleton_method :"__#{capability.name}", &capability.content.bind(self)
|