Module: VagrantBindfs::Vagrant::Capabilities::All::Bindfs
- Defined in:
- lib/vagrant-bindfs/vagrant/capabilities/all/bindfs.rb
Class Method Summary collapse
- .bindfs_bindfs_full_path(machine) ⇒ Object
- .bindfs_bindfs_install_from_source(machine, version) ⇒ Object
- .bindfs_bindfs_installed(machine) ⇒ Object
- .bindfs_bindfs_version(machine) ⇒ Object
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/vagrant-bindfs/vagrant/capabilities/all/bindfs.rb', line 33 def bindfs_bindfs_install_from_source(machine, version) version = version.to_s.strip.gsub(/\.0$/, '') source_urls = VagrantBindfs::Bindfs::SOURCE_URLS.map { |url| url.gsub('%<bindfs_version>', version) } begin machine.communicate.execute <<-SHELL for u in "#{source_urls.join('" "')}"; 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 ./bindfs-#{version} ] && \ cd bindfs-#{version} && \ ./configure && \ make && \ sudo make install SHELL ensure machine.communicate.execute('[ -f ./bindfs.tar.gz ] && rm ./bindfs.tar.gz') machine.communicate.execute("[ -d ./bindfs-#{version} ] && rm -rf ./bindfs-#{version}") 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) [%(sudo #{bindfs_full_path} --version | cut -d" " -f2), %(sudo -i #{bindfs_full_path} --version | cut -d" " -f2)].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 |