rbcm 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d21ced32c1ebdeeef149cd3c77faad5cad48be90f874233f57fdd78dee5fa45
4
- data.tar.gz: 62351e19844eaf2b263b6f52fbfef46ec25386bc0ff9ffa3318134ebc91bb7ee
3
+ metadata.gz: 18358db563420dbb86ff61c82e2ebfe670f8878eae1e0039ff584585e0e6934f
4
+ data.tar.gz: 949374f2d7334a4f1e5a252af5b482fc96fcbe40492edca9c800eabd5fc89cec
5
5
  SHA512:
6
- metadata.gz: 627acffbfa4465ac33f6386b5bb2a2ec9ff1a03429175eddf52ecc4b69f137f30c0c70ba7cf36ee92a79720527c03da28d4438184fb0920314c7d38331550e84
7
- data.tar.gz: 9ecb0e4228b86142e20610de4ab86c77e93fcce56ca4b00b276b90c7267d118b5e58408490edb2251b9c8a8e2e835602aaf25e9189328d5562be47cf81697a93
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 ||= @filesystem.download @path
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.mode @path
19
+ @mode ||= @filesystem.node.remote.execute(
20
+ "stat -c \"%a\" * '#{@path}'"
21
+ ).chomp.chomp.to_i
15
22
  end
16
23
  end
@@ -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
- add_capability capability
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 add_capability capability
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbcm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Wiegand