vagrant-bindfs 0.4.14 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +66 -4
  3. data/Rakefile +11 -7
  4. data/Vagrantfile +10 -8
  5. data/lib/vagrant-bindfs.rb +10 -16
  6. data/lib/vagrant-bindfs/bindfs.rb +15 -0
  7. data/lib/vagrant-bindfs/bindfs/command.rb +47 -0
  8. data/lib/vagrant-bindfs/bindfs/folder.rb +38 -0
  9. data/lib/vagrant-bindfs/bindfs/option_definitions.json +67 -0
  10. data/lib/vagrant-bindfs/bindfs/option_set.rb +105 -0
  11. data/lib/vagrant-bindfs/bindfs/validators.rb +9 -0
  12. data/lib/vagrant-bindfs/bindfs/validators/config.rb +58 -0
  13. data/lib/vagrant-bindfs/bindfs/validators/runtime.rb +56 -0
  14. data/lib/vagrant-bindfs/vagrant.rb +12 -0
  15. data/lib/vagrant-bindfs/vagrant/actions.rb +11 -0
  16. data/lib/vagrant-bindfs/vagrant/actions/concerns.rb +11 -0
  17. data/lib/vagrant-bindfs/vagrant/actions/concerns/log.rb +34 -0
  18. data/lib/vagrant-bindfs/vagrant/actions/concerns/machine.rb +31 -0
  19. data/lib/vagrant-bindfs/vagrant/actions/installer.rb +99 -0
  20. data/lib/vagrant-bindfs/vagrant/actions/mounter.rb +65 -0
  21. data/lib/vagrant-bindfs/vagrant/capabilities.rb +108 -0
  22. data/lib/vagrant-bindfs/vagrant/capabilities/all.rb +12 -0
  23. data/lib/vagrant-bindfs/vagrant/capabilities/all/bindfs.rb +53 -0
  24. data/lib/vagrant-bindfs/vagrant/capabilities/all/package_manager.rb +17 -0
  25. data/lib/vagrant-bindfs/vagrant/capabilities/all/system_checks.rb +20 -0
  26. data/lib/vagrant-bindfs/vagrant/capabilities/darwin.rb +13 -0
  27. data/lib/vagrant-bindfs/vagrant/capabilities/darwin/bindfs.rb +33 -0
  28. data/lib/vagrant-bindfs/vagrant/capabilities/darwin/fuse.rb +32 -0
  29. data/lib/vagrant-bindfs/vagrant/capabilities/darwin/package_manager.rb +24 -0
  30. data/lib/vagrant-bindfs/{cap/darwin/checks.rb → vagrant/capabilities/darwin/system_checks.rb} +7 -8
  31. data/lib/vagrant-bindfs/vagrant/capabilities/debian.rb +12 -0
  32. data/lib/vagrant-bindfs/vagrant/capabilities/debian/bindfs.rb +39 -0
  33. data/lib/vagrant-bindfs/vagrant/capabilities/debian/fuse.rb +16 -0
  34. data/lib/vagrant-bindfs/vagrant/capabilities/debian/package_manager.rb +20 -0
  35. data/lib/vagrant-bindfs/vagrant/capabilities/linux.rb +12 -0
  36. data/lib/vagrant-bindfs/vagrant/capabilities/linux/fuse.rb +24 -0
  37. data/lib/vagrant-bindfs/vagrant/capabilities/linux/package_manager.rb +16 -0
  38. data/lib/vagrant-bindfs/vagrant/capabilities/linux/system_checks.rb +26 -0
  39. data/lib/vagrant-bindfs/vagrant/capabilities/redhat.rb +12 -0
  40. data/lib/vagrant-bindfs/vagrant/capabilities/redhat/bindfs.rb +39 -0
  41. data/lib/vagrant-bindfs/vagrant/capabilities/redhat/fuse.rb +17 -0
  42. data/lib/vagrant-bindfs/vagrant/capabilities/redhat/package_manager.rb +20 -0
  43. data/lib/vagrant-bindfs/vagrant/capabilities/suse.rb +12 -0
  44. data/lib/vagrant-bindfs/vagrant/capabilities/suse/bindfs.rb +41 -0
  45. data/lib/vagrant-bindfs/vagrant/capabilities/suse/fuse.rb +17 -0
  46. data/lib/vagrant-bindfs/vagrant/capabilities/suse/package_manager.rb +20 -0
  47. data/lib/vagrant-bindfs/vagrant/capabilities/ubuntu.rb +10 -0
  48. data/lib/vagrant-bindfs/vagrant/capabilities/ubuntu/fuse.rb +23 -0
  49. data/lib/vagrant-bindfs/vagrant/config.rb +86 -0
  50. data/lib/vagrant-bindfs/vagrant/errors.rb +12 -0
  51. data/lib/vagrant-bindfs/vagrant/plugin.rb +43 -0
  52. data/lib/vagrant-bindfs/version.rb +3 -12
  53. data/locales/en.yml +71 -26
  54. metadata +48 -23
  55. data/lib/vagrant-bindfs/bind.rb +0 -109
  56. data/lib/vagrant-bindfs/cap/all/bindfs_installed.rb +0 -17
  57. data/lib/vagrant-bindfs/cap/all/checks.rb +0 -17
  58. data/lib/vagrant-bindfs/cap/darwin/fuse_loaded.rb +0 -19
  59. data/lib/vagrant-bindfs/cap/darwin/install_bindfs.rb +0 -61
  60. data/lib/vagrant-bindfs/cap/debian/install_bindfs.rb +0 -17
  61. data/lib/vagrant-bindfs/cap/fedora/install_bindfs.rb +0 -17
  62. data/lib/vagrant-bindfs/cap/linux/bindfs_installed.rb +0 -17
  63. data/lib/vagrant-bindfs/cap/linux/checks.rb +0 -21
  64. data/lib/vagrant-bindfs/cap/linux/enable_fuse.rb +0 -17
  65. data/lib/vagrant-bindfs/cap/linux/fuse_loaded.rb +0 -17
  66. data/lib/vagrant-bindfs/cap/redhat/install_bindfs.rb +0 -52
  67. data/lib/vagrant-bindfs/cap/suse/install_bindfs.rb +0 -17
  68. data/lib/vagrant-bindfs/cap/ubuntu/fuse_loaded.rb +0 -19
  69. data/lib/vagrant-bindfs/command.rb +0 -212
  70. data/lib/vagrant-bindfs/config.rb +0 -119
  71. data/lib/vagrant-bindfs/errors.rb +0 -7
  72. data/lib/vagrant-bindfs/plugin.rb +0 -145
  73. data/test/test_helper.rb +0 -20
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module All
6
+ autoload :SystemChecks, 'vagrant-bindfs/vagrant/capabilities/all/system_checks'
7
+ autoload :PackageManager, 'vagrant-bindfs/vagrant/capabilities/all/package_manager'
8
+ autoload :Bindfs, 'vagrant-bindfs/vagrant/capabilities/all/bindfs'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module All
6
+ module Bindfs
7
+ class << self
8
+ def bindfs_bindfs_installed(machine)
9
+ machine.communicate.test('bindfs --help')
10
+ end
11
+
12
+ def bindfs_bindfs_version(machine)
13
+ [%(sudo bindfs --version | cut -d" " -f2), %(sudo -i bindfs --version | cut -d" " -f2)].each do |command|
14
+ machine.communicate.execute(command) do |_, output|
15
+ version = output.strip
16
+ return Gem::Version.new(version) if !version.empty? && Gem::Version.correct?(version)
17
+ end
18
+ end
19
+ Gem::Version.new('0.0')
20
+ end
21
+
22
+ def bindfs_bindfs_install_from_source(machine, version)
23
+ version = version.to_s.strip.gsub(/\.0$/, '')
24
+ source_urls = VagrantBindfs::Bindfs::SOURCE_URLS.map { |url| url.gsub('%{bindfs_version}', version) }
25
+
26
+ begin
27
+ machine.communicate.execute <<-SHELL
28
+ for u in "#{source_urls.join('" "')}"; do
29
+ if wget -q --spider $u; then
30
+ url=$u;
31
+ break;
32
+ fi;
33
+ done;
34
+ [ -n "$url" ] && \
35
+ wget $url -O bindfs.tar.gz && \
36
+ tar -zxvf bindfs.tar.gz && \
37
+ [ -d ./bindfs-#{version} ] && \
38
+ cd bindfs-#{version} && \
39
+ ./configure && \
40
+ make && \
41
+ sudo make install
42
+ SHELL
43
+ ensure
44
+ machine.communicate.execute('[ -f ./bindfs.tar.gz ] && rm ./bindfs.tar.gz')
45
+ machine.communicate.execute("[ -d ./bindfs-#{version} ] && rm -rf ./bindfs-#{version}")
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module All
6
+ module PackageManager
7
+ class << self
8
+ def bindfs_package_manager_installed(machine)
9
+ package_manager_name = machine.guest.capability(:bindfs_package_manager_name)
10
+ machine.communicate.test("#{package_manager_name} --help")
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module All
6
+ module SystemChecks
7
+ class << self
8
+ def bindfs_exists_directory(machine, directory)
9
+ machine.communicate.test("test -d #{directory.shellescape}")
10
+ end
11
+
12
+ def bindfs_exists_mount(machine, directory)
13
+ machine.communicate.test("mount | grep '^bindfs' | grep #{directory.shellescape}")
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module Darwin
6
+ autoload :SystemChecks, 'vagrant-bindfs/vagrant/capabilities/darwin/system_checks'
7
+ autoload :PackageManager, 'vagrant-bindfs/vagrant/capabilities/darwin/package_manager'
8
+ autoload :Fuse, 'vagrant-bindfs/vagrant/capabilities/darwin/fuse'
9
+ autoload :Bindfs, 'vagrant-bindfs/vagrant/capabilities/darwin/bindfs'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module Darwin
6
+ module Bindfs
7
+ class << self
8
+ def bindfs_bindfs_install(machine)
9
+ machine.guest.capability(:bindfs_package_manager_update)
10
+ machine.communicate.execute('brew install homebrew/fuse/bindfs')
11
+ end
12
+
13
+ # Homebrew does not provide any method to install
14
+ # an older version of a formula
15
+ def bindfs_bindfs_search_version(_machine, _version)
16
+ false
17
+ end
18
+
19
+ def bindfs_bindfs_install_version(machine)
20
+ # Pass
21
+ end
22
+
23
+ # Homebrew requires the development tools to be installed
24
+ def bindfs_bindfs_install_compilation_requirements(machine)
25
+ machine.guest.capability(:bindfs_package_manager_update)
26
+ machine.communicate.execute('brew install autoconf automake libtool pkg-config wget')
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module Darwin
6
+ module Fuse
7
+ class << self
8
+ def bindfs_fuse_installed(machine)
9
+ machine.communicate.test('test -d /Library/Frameworks/OSXFUSE.framework/')
10
+ end
11
+
12
+ def bindfs_fuse_install(machine)
13
+ machine.guest.capability(:bindfs_package_manager_update)
14
+ machine.communicate.execute('brew tap caskroom/cask && brew cask install osxfuse')
15
+ end
16
+
17
+ # OSXFuse is automatically loaded.
18
+ # Just check if it is installed
19
+
20
+ def bindfs_fuse_loaded(machine)
21
+ machine.guest.capability(:bindfs_fuse_installed)
22
+ end
23
+
24
+ def bindfs_fuse_load(machine)
25
+ machine.guest.capability(:bindfs_fuse_installed)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module Darwin
6
+ module PackageManager
7
+ class << self
8
+ def bindfs_package_manager_name(_machine)
9
+ 'brew'
10
+ end
11
+
12
+ def bindfs_package_manager_install(machine)
13
+ machine.communicate.execute('/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"')
14
+ end
15
+
16
+ def bindfs_package_manager_update(machine)
17
+ machine.communicate.execute('brew update')
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,24 +1,23 @@
1
- module VagrantPlugins
2
- module Bindfs
3
- module Cap
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
4
5
  module Darwin
5
- module Checks
6
+ module SystemChecks
6
7
  class << self
7
-
8
- def bindfs_check_user(machine, user)
8
+ def bindfs_exists_user(machine, user)
9
9
  (
10
10
  user.nil? || \
11
11
  machine.communicate.test("test -n \"$(dscacheutil -q user -a name #{user.shellescape})\"")
12
12
  )
13
13
  end
14
14
 
15
- def bindfs_check_group(machine, group)
15
+ def bindfs_exists_group(machine, group)
16
16
  (
17
17
  group.nil? || \
18
18
  machine.communicate.test("test -n \"$(dscacheutil -q group -a name #{group.shellescape})\"")
19
19
  )
20
20
  end
21
-
22
21
  end
23
22
  end
24
23
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module Debian
6
+ autoload :PackageManager, 'vagrant-bindfs/vagrant/capabilities/debian/package_manager'
7
+ autoload :Fuse, 'vagrant-bindfs/vagrant/capabilities/debian/fuse'
8
+ autoload :Bindfs, 'vagrant-bindfs/vagrant/capabilities/debian/bindfs'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module Debian
6
+ module Bindfs
7
+ class << self
8
+ def bindfs_bindfs_install(machine)
9
+ machine.guest.capability(:bindfs_package_manager_update)
10
+ machine.communicate.sudo('apt-get install -y bindfs')
11
+ end
12
+
13
+ def bindfs_bindfs_search_version(machine, version)
14
+ machine.guest.capability(:bindfs_package_manager_update)
15
+ machine.communicate.tap do |comm|
16
+ comm.sudo("aptitude versions bindfs | sed -n '/p/,${p}' | sed 's/\s\+/ /g' | cut -d' ' -f2") do |_, output|
17
+ package_version = output.strip
18
+ return "bindfs-#{package_version}" if !package_version.empty? && !package_version.match(/^#{version}/).nil?
19
+ end
20
+ end
21
+ false
22
+ end
23
+
24
+ def bindfs_bindfs_install_version(machine, version)
25
+ machine.guest.capability(:bindfs_package_manager_update)
26
+ package_version = machine.guest.capability(:bindfs_bindfs_search_version, version)
27
+ machine.communicate.sudo("apt-get install -y bindfs=#{package_version.shellescape}")
28
+ end
29
+
30
+ def bindfs_bindfs_install_compilation_requirements(machine)
31
+ machine.guest.capability(:bindfs_package_manager_update)
32
+ machine.communicate.sudo('apt-get install -y build-essential pkg-config wget tar libfuse-dev')
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module Debian
6
+ module Fuse
7
+ class << self
8
+ def bindfs_fuse_install(machine)
9
+ machine.communicate.sudo('apt-get install -y fuse')
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module Debian
6
+ module PackageManager
7
+ class << self
8
+ def bindfs_package_manager_name(_machine)
9
+ 'apt-get'
10
+ end
11
+
12
+ def bindfs_package_manager_update(machine)
13
+ machine.communicate.sudo('apt-get update')
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module Linux
6
+ autoload :SystemChecks, 'vagrant-bindfs/vagrant/capabilities/linux/system_checks'
7
+ autoload :PackageManager, 'vagrant-bindfs/vagrant/capabilities/linux/package_manager'
8
+ autoload :Fuse, 'vagrant-bindfs/vagrant/capabilities/linux/fuse'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module Linux
6
+ module Fuse
7
+ class << self
8
+ def bindfs_fuse_installed(machine)
9
+ machine.communicate.test('test -f /etc/fuse.conf')
10
+ end
11
+
12
+ def bindfs_fuse_loaded(machine)
13
+ machine.communicate.test('lsmod | grep -q fuse')
14
+ end
15
+
16
+ def bindfs_fuse_load(machine)
17
+ machine.communicate.sudo('/sbin/modprobe fuse')
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module Linux
6
+ module PackageManager
7
+ class << self
8
+ def bindfs_package_manager_install(_machine)
9
+ raise VagrantBindfs::Vagrant::Error, :package_manager_missing
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module Linux
6
+ module SystemChecks
7
+ class << self
8
+ def bindfs_exists_user(machine, user)
9
+ (
10
+ user.nil? || \
11
+ machine.communicate.test("getent passwd #{user.shellescape}")
12
+ )
13
+ end
14
+
15
+ def bindfs_exists_group(machine, group)
16
+ (
17
+ group.nil? || \
18
+ machine.communicate.test("getent group #{group.shellescape}")
19
+ )
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ module VagrantBindfs
3
+ module Vagrant
4
+ module Capabilities
5
+ module RedHat
6
+ autoload :PackageManager, 'vagrant-bindfs/vagrant/capabilities/redhat/package_manager'
7
+ autoload :Fuse, 'vagrant-bindfs/vagrant/capabilities/redhat/fuse'
8
+ autoload :Bindfs, 'vagrant-bindfs/vagrant/capabilities/redhat/bindfs'
9
+ end
10
+ end
11
+ end
12
+ end