Class: VagrantPlugins::Tmuxme::Cap::EnsureTmuxme

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-tmuxme/cap/ensure_tmuxme.rb

Class Method Summary collapse

Class Method Details

.ensure_tmuxme(machine, env) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/vagrant-tmuxme/cap/ensure_tmuxme.rb', line 6

def self.ensure_tmuxme(machine, env)
  return unless machine.communicate.ready?
 
  if tmuxme_installed?(machine)
    env.ui.info I18n.t('vagrant_tmuxme.tmuxme_installed')
  else
    env.ui.info I18n.t('vagrant_tmuxme.installing_tmuxme')
    install_tmuxme!(machine)
  end
end

.install_tmuxme!(machine) ⇒ Object



21
22
23
24
25
# File 'lib/vagrant-tmuxme/cap/ensure_tmuxme.rb', line 21

def self.install_tmuxme!(machine)
  machine.communicate.tap do |comm|
    comm.sudo "gem install tmuxme"
  end
end

.tmuxme_installed?(machine) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/vagrant-tmuxme/cap/ensure_tmuxme.rb', line 17

def self.tmuxme_installed?(machine)
  machine.communicate.execute("tmuxme") rescue false
end