Class: RoDaemon::Rmt
- Inherits:
-
RoCell::Rmt
- Object
- RoCell::Rmt
- RoDaemon::Rmt
- Defined in:
- lib/ro_daemon/rmt.rb
Instance Method Summary collapse
- #_daemonize(cmd, *args, &blk) ⇒ Object
- #daemonize(cmd, *args, &blk) ⇒ Object
-
#initialize(user_at_host = nil, *args, &blk) ⇒ Rmt
constructor
A new instance of Rmt.
- #pj ⇒ Object
- #sync(_pj, *args, &blk) ⇒ Object
Constructor Details
#initialize(user_at_host = nil, *args, &blk) ⇒ Rmt
Returns a new instance of Rmt.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ro_daemon/rmt.rb', line 4 def initialize(user_at_host=nil, *args, &blk) if (user_at_host.nil?) or user_at_host.match(%r{vagrant}) super("vagrant@localhost", se: Net::SSH.start( "localhost", "vagrant", auth_methods: ["publickey"], port: 2222, keys: [Pj.home(".vagrant.d/insecure_private_key")])) else super end end |
Instance Method Details
#_daemonize(cmd, *args, &blk) ⇒ Object
40 41 42 |
# File 'lib/ro_daemon/rmt.rb', line 40 def _daemonize(cmd, *args, &blk) sh "cd #{pj}; ro_daemonize #{cmd}" end |
#daemonize(cmd, *args, &blk) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ro_daemon/rmt.rb', line 27 def daemonize(cmd, *args, &blk) begin _daemonize(cmd, *args, &blk) rescue ::RoErr::RmtErr => e if e.match(%r{ro_daemonize: command not found}) sh 'sudo gem install ro_daemon' _daemonize(cmd, *args, &blk) else raise e end end end |
#pj ⇒ Object
23 24 25 |
# File 'lib/ro_daemon/rmt.rb', line 23 def pj @pj ||= home end |
#sync(_pj, *args, &blk) ⇒ Object
17 18 19 20 21 |
# File 'lib/ro_daemon/rmt.rb', line 17 def sync(_pj, *args, &blk) @pj = up(_pj, *args, &blk) sh "cd #{pj}; bundle install" self end |