Module: VagrantBindfs::Vagrant::Capabilities::All::Bindfs

Defined in:
lib/vagrant-bindfs/vagrant/capabilities/all/bindfs.rb

Overview

:nodoc:

Constant Summary collapse

INSTALL_SCRIPT =
<<-SHELL
  for u in "%<urls>s"; do
    if wget -q --spider $u; then
      url=$u;
      break;
    fi;
  done;
  [ -n "$url" ]               && \
  wget $url -O bindfs.tar.gz  && \
  tar -zxvf bindfs.tar.gz     && \
  [ -d ./%<dirname>s ]        && \
  cd %<dirname>s              && \
  ./configure                 && \
  make                        && \
  sudo make install
SHELL

Class Method Summary collapse

Class Method Details

.bindfs_bindfs_full_path(machine) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/vagrant-bindfs/vagrant/capabilities/all/bindfs.rb', line 9

def bindfs_bindfs_full_path(machine)
  machine.communicate.execute('bash -c "type -P bindfs || true"') do |_, output|
    path = output.strip
    return path unless path.empty?
  end
  'bindfs'
end

.bindfs_bindfs_install_from_source(machine, version) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/vagrant-bindfs/vagrant/capabilities/all/bindfs.rb', line 33

def bindfs_bindfs_install_from_source(machine, version)
  tar_urls = VagrantBindfs::Bindfs.source_tar_urls(version)
  tar_dirname = VagrantBindfs::Bindfs.source_tar_basename(version)

  begin
    machine.communicate.execute format(INSTALL_SCRIPT, urls: tar_urls.join('" "'), dirname: tar_dirname)
  ensure
    machine.communicate.execute('([ -f ./bindfs.tar.gz ] && rm ./bindfs.tar.gz) || true')
    machine.communicate.execute("([ -d ./#{tar_dirname} ] && rm -rf ./#{tar_dirname}) || true")
  end
end

.bindfs_bindfs_installed(machine) ⇒ Object



17
18
19
20
# File 'lib/vagrant-bindfs/vagrant/capabilities/all/bindfs.rb', line 17

def bindfs_bindfs_installed(machine)
  bindfs_full_path = machine.guest.capability(:bindfs_bindfs_full_path)
  machine.communicate.test("#{bindfs_full_path} --help")
end

.bindfs_bindfs_version(machine) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/vagrant-bindfs/vagrant/capabilities/all/bindfs.rb', line 22

def bindfs_bindfs_version(machine)
  bindfs_full_path = machine.guest.capability(:bindfs_bindfs_full_path)
  bindfs_bindfs_version_detection_commands(bindfs_full_path).each do |command|
    machine.communicate.execute(command) do |_, output|
      version = output.strip
      return Gem::Version.new(version) if !version.empty? && Gem::Version.correct?(version)
    end
  end
  Gem::Version.new('0.0')
end