Class: ConfCtl::NixCopy
- Inherits:
-
Object
- Object
- ConfCtl::NixCopy
- Defined in:
- lib/confctl/nix_copy.rb
Instance Method Summary collapse
-
#initialize(target, store_path) ⇒ NixCopy
constructor
A new instance of NixCopy.
- #run! {|progress, total, path| ... } ⇒ Object
Constructor Details
#initialize(target, store_path) ⇒ NixCopy
Returns a new instance of NixCopy.
5 6 7 8 9 10 |
# File 'lib/confctl/nix_copy.rb', line 5 def initialize(target, store_path) @target = target @store_path = store_path @total = nil @progress = 0 end |
Instance Method Details
#run! {|progress, total, path| ... } ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/confctl/nix_copy.rb', line 15 def run!(&block) cmd = SystemCommand.new line_buf = StdLineBuffer.new do |_out, err| parse_line(err, &block) if err && block end ret = cmd.run!( 'nix-copy-closure', '--to', "root@#{target}", store_path, &line_buf.feed_block ) line_buf.flush ret end |