vagrant-bindfs 0.4.14 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-bindfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.14
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gaël-Ian Havard
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-11-29 00:00:00.000000000 Z
13
+ date: 2016-12-04 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: " A Vagrant plugin to automate bindfs mount in the VM. This allow you
16
16
  to change owner, group and permissions on files and, for example, work around NFS
@@ -27,28 +27,54 @@ files:
27
27
  - Rakefile
28
28
  - Vagrantfile
29
29
  - lib/vagrant-bindfs.rb
30
- - lib/vagrant-bindfs/bind.rb
31
- - lib/vagrant-bindfs/cap/all/bindfs_installed.rb
32
- - lib/vagrant-bindfs/cap/all/checks.rb
33
- - lib/vagrant-bindfs/cap/darwin/checks.rb
34
- - lib/vagrant-bindfs/cap/darwin/fuse_loaded.rb
35
- - lib/vagrant-bindfs/cap/darwin/install_bindfs.rb
36
- - lib/vagrant-bindfs/cap/debian/install_bindfs.rb
37
- - lib/vagrant-bindfs/cap/fedora/install_bindfs.rb
38
- - lib/vagrant-bindfs/cap/linux/bindfs_installed.rb
39
- - lib/vagrant-bindfs/cap/linux/checks.rb
40
- - lib/vagrant-bindfs/cap/linux/enable_fuse.rb
41
- - lib/vagrant-bindfs/cap/linux/fuse_loaded.rb
42
- - lib/vagrant-bindfs/cap/redhat/install_bindfs.rb
43
- - lib/vagrant-bindfs/cap/suse/install_bindfs.rb
44
- - lib/vagrant-bindfs/cap/ubuntu/fuse_loaded.rb
45
- - lib/vagrant-bindfs/command.rb
46
- - lib/vagrant-bindfs/config.rb
47
- - lib/vagrant-bindfs/errors.rb
48
- - lib/vagrant-bindfs/plugin.rb
30
+ - lib/vagrant-bindfs/bindfs.rb
31
+ - lib/vagrant-bindfs/bindfs/command.rb
32
+ - lib/vagrant-bindfs/bindfs/folder.rb
33
+ - lib/vagrant-bindfs/bindfs/option_definitions.json
34
+ - lib/vagrant-bindfs/bindfs/option_set.rb
35
+ - lib/vagrant-bindfs/bindfs/validators.rb
36
+ - lib/vagrant-bindfs/bindfs/validators/config.rb
37
+ - lib/vagrant-bindfs/bindfs/validators/runtime.rb
38
+ - lib/vagrant-bindfs/vagrant.rb
39
+ - lib/vagrant-bindfs/vagrant/actions.rb
40
+ - lib/vagrant-bindfs/vagrant/actions/concerns.rb
41
+ - lib/vagrant-bindfs/vagrant/actions/concerns/log.rb
42
+ - lib/vagrant-bindfs/vagrant/actions/concerns/machine.rb
43
+ - lib/vagrant-bindfs/vagrant/actions/installer.rb
44
+ - lib/vagrant-bindfs/vagrant/actions/mounter.rb
45
+ - lib/vagrant-bindfs/vagrant/capabilities.rb
46
+ - lib/vagrant-bindfs/vagrant/capabilities/all.rb
47
+ - lib/vagrant-bindfs/vagrant/capabilities/all/bindfs.rb
48
+ - lib/vagrant-bindfs/vagrant/capabilities/all/package_manager.rb
49
+ - lib/vagrant-bindfs/vagrant/capabilities/all/system_checks.rb
50
+ - lib/vagrant-bindfs/vagrant/capabilities/darwin.rb
51
+ - lib/vagrant-bindfs/vagrant/capabilities/darwin/bindfs.rb
52
+ - lib/vagrant-bindfs/vagrant/capabilities/darwin/fuse.rb
53
+ - lib/vagrant-bindfs/vagrant/capabilities/darwin/package_manager.rb
54
+ - lib/vagrant-bindfs/vagrant/capabilities/darwin/system_checks.rb
55
+ - lib/vagrant-bindfs/vagrant/capabilities/debian.rb
56
+ - lib/vagrant-bindfs/vagrant/capabilities/debian/bindfs.rb
57
+ - lib/vagrant-bindfs/vagrant/capabilities/debian/fuse.rb
58
+ - lib/vagrant-bindfs/vagrant/capabilities/debian/package_manager.rb
59
+ - lib/vagrant-bindfs/vagrant/capabilities/linux.rb
60
+ - lib/vagrant-bindfs/vagrant/capabilities/linux/fuse.rb
61
+ - lib/vagrant-bindfs/vagrant/capabilities/linux/package_manager.rb
62
+ - lib/vagrant-bindfs/vagrant/capabilities/linux/system_checks.rb
63
+ - lib/vagrant-bindfs/vagrant/capabilities/redhat.rb
64
+ - lib/vagrant-bindfs/vagrant/capabilities/redhat/bindfs.rb
65
+ - lib/vagrant-bindfs/vagrant/capabilities/redhat/fuse.rb
66
+ - lib/vagrant-bindfs/vagrant/capabilities/redhat/package_manager.rb
67
+ - lib/vagrant-bindfs/vagrant/capabilities/suse.rb
68
+ - lib/vagrant-bindfs/vagrant/capabilities/suse/bindfs.rb
69
+ - lib/vagrant-bindfs/vagrant/capabilities/suse/fuse.rb
70
+ - lib/vagrant-bindfs/vagrant/capabilities/suse/package_manager.rb
71
+ - lib/vagrant-bindfs/vagrant/capabilities/ubuntu.rb
72
+ - lib/vagrant-bindfs/vagrant/capabilities/ubuntu/fuse.rb
73
+ - lib/vagrant-bindfs/vagrant/config.rb
74
+ - lib/vagrant-bindfs/vagrant/errors.rb
75
+ - lib/vagrant-bindfs/vagrant/plugin.rb
49
76
  - lib/vagrant-bindfs/version.rb
50
77
  - locales/en.yml
51
- - test/test_helper.rb
52
78
  homepage: https://github.com/gael-ian/vagrant-bindfs
53
79
  licenses:
54
80
  - MIT
@@ -76,5 +102,4 @@ signing_key:
76
102
  specification_version: 4
77
103
  summary: A Vagrant plugin to automate bindfs mount in the VM
78
104
  test_files:
79
- - test/test_helper.rb
80
105
  - Vagrantfile
@@ -1,109 +0,0 @@
1
- require "vagrant-bindfs/command"
2
-
3
- module VagrantPlugins
4
- module Bindfs
5
- module Action
6
- class Bind
7
-
8
- def initialize(app, env, hook)
9
- @app = app
10
- @env = env
11
- @hook = hook
12
- end
13
-
14
- def call(env)
15
- @app.call(env)
16
- @env = env
17
-
18
- @machine = env[:machine]
19
-
20
- unless binded_folders.empty?
21
- handle_bindfs_installation
22
- bind_folders
23
- end
24
- end
25
-
26
- def binded_folders
27
- @binded_folders ||= begin
28
- @machine.config.bindfs.bind_folders.reduce({}) do |binded, (name, options)|
29
- binded[name] = options if options[:hook] == @hook
30
- binded
31
- end
32
- end
33
- end
34
-
35
- def bind_folders
36
- @env[:ui].info I18n.t("vagrant.config.bindfs.status.binding_all")
37
-
38
- binded_folders.each do |id, options|
39
-
40
- command = VagrantPlugins::Bindfs::Command.new(@env, options)
41
-
42
- unless @machine.communicate.test("test -d #{command.source}")
43
- @env[:ui].error I18n.t(
44
- "vagrant.config.bindfs.errors.source_path_not_exist",
45
- path: command.source
46
- )
47
- next
48
- end
49
-
50
- unless options[:skip_verify_user] == true || @machine.guest.capability(:bindfs_check_user, command.user)
51
- @env[:ui].error I18n.t(
52
- "vagrant.config.bindfs.errors.user_not_exist",
53
- user: command.user
54
- )
55
- next
56
- end
57
-
58
- unless options[:skip_verify_user] == true || @machine.guest.capability(:bindfs_check_group, command.group)
59
- @env[:ui].error I18n.t(
60
- "vagrant.config.bindfs.errors.group_not_exist",
61
- group: command.group
62
- )
63
- next
64
- end
65
-
66
- if @machine.guest.capability(:bindfs_check_mount, command.destination)
67
- @env[:ui].info I18n.t(
68
- "vagrant.config.bindfs.already_mounted",
69
- dest: command.destination
70
- )
71
- next
72
- end
73
-
74
- @env[:ui].info I18n.t(
75
- "vagrant.config.bindfs.status.binding_entry",
76
- dest: command.destination,
77
- source: command.source
78
- )
79
-
80
- @machine.communicate.tap do |comm|
81
- comm.sudo("mkdir -p #{command.destination}")
82
- comm.sudo(command.build, error_class: Error, error_key: :binding_failed)
83
- @env[:ui].info(command.build) if @machine.config.bindfs.debug
84
- end
85
- end
86
- end
87
-
88
- def handle_bindfs_installation
89
- unless @machine.guest.capability(:bindfs_installed)
90
- @env[:ui].warn(I18n.t("vagrant.config.bindfs.not_installed"))
91
-
92
- unless @machine.guest.capability(:install_bindfs)
93
- raise Vagrant::Bindfs::Error, :cannot_install
94
- end
95
- end
96
-
97
- unless @machine.guest.capability(:fuse_loaded)
98
- @env[:ui].warn(I18n.t("vagrant.config.bindfs.not_loaded"))
99
-
100
- unless @machine.guest.capability(:enable_fuse)
101
- raise Vagrant::Bindfs::Error, :cannot_enable_fuse
102
- end
103
- end
104
- end
105
-
106
- end
107
- end
108
- end
109
- end
@@ -1,17 +0,0 @@
1
- module VagrantPlugins
2
- module Bindfs
3
- module Cap
4
- module All
5
- module BindfsInstalled
6
- class << self
7
-
8
- def bindfs_installed(machine)
9
- machine.communicate.test("bindfs --help")
10
- end
11
-
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- module VagrantPlugins
2
- module Bindfs
3
- module Cap
4
- module All
5
- module Checks
6
- class << self
7
-
8
- def bindfs_check_mount(machine, directory)
9
- machine.communicate.test("mount | grep '^bindfs' | grep #{directory.shellescape}")
10
- end
11
-
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,19 +0,0 @@
1
- module VagrantPlugins
2
- module Bindfs
3
- module Cap
4
- module Darwin
5
- module FuseLoaded
6
- class << self
7
-
8
- def fuse_loaded(machine)
9
- # OSXFuse is automatically loaded.
10
- # Just check if it is installed
11
- machine.communicate.test("test -d /Library/Frameworks/OSXFUSE.framework/")
12
- end
13
-
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,61 +0,0 @@
1
- module VagrantPlugins
2
- module Bindfs
3
- module Cap
4
- module Darwin
5
- module InstallBindfs
6
- class << self
7
-
8
- def install_bindfs(machine)
9
- @machine = machine
10
-
11
- unless homebrew_installed?
12
- warn(I18n.t("vagrant.config.bindfs.homebrew_not_installed"))
13
- homebrew_install
14
- else
15
- execute("brew update")
16
- end
17
-
18
- unless osxfuse_installed?
19
- warn(I18n.t("vagrant.config.bindfs.osxfuse_not_installed"))
20
- osxfuse_install
21
- end
22
-
23
- execute("brew install homebrew/fuse/bindfs")
24
- end
25
-
26
- def warn(message)
27
- @machine.env.ui.warn(message)
28
- end
29
-
30
- def execute(command)
31
- @machine.communicate.execute(command)
32
- end
33
-
34
- def test(command)
35
- @machine.communicate.test(command)
36
- end
37
-
38
- protected
39
-
40
- def homebrew_installed?
41
- test("brew --help")
42
- end
43
-
44
- def homebrew_install
45
- execute("/usr/bin/ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"")
46
- end
47
-
48
- def osxfuse_installed?
49
- test("[ -d /Library/Frameworks/OSXFUSE.framework/ ]")
50
- end
51
-
52
- def osxfuse_install
53
- execute("brew tap caskroom/cask && brew cask install osxfuse")
54
- end
55
-
56
- end
57
- end
58
- end
59
- end
60
- end
61
- end
@@ -1,17 +0,0 @@
1
- module VagrantPlugins
2
- module Bindfs
3
- module Cap
4
- module Debian
5
- module InstallBindfs
6
- class << self
7
-
8
- def install_bindfs(machine)
9
- machine.communicate.sudo("apt-get update && apt-get install -y bindfs")
10
- end
11
-
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- module VagrantPlugins
2
- module Bindfs
3
- module Cap
4
- module Fedora
5
- module InstallBindfs
6
- class << self
7
-
8
- def install_bindfs(machine)
9
- machine.communicate.sudo('yum -y install bindfs')
10
- end
11
-
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- module VagrantPlugins
2
- module Bindfs
3
- module Cap
4
- module Linux
5
- module BindfsInstalled
6
- class << self
7
-
8
- def bindfs_installed(machine)
9
- machine.communicate.test("bindfs --help")
10
- end
11
-
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,21 +0,0 @@
1
- module VagrantPlugins
2
- module Bindfs
3
- module Cap
4
- module Linux
5
- module Checks
6
- class << self
7
-
8
- def bindfs_check_user(machine, user)
9
- (user.nil? || machine.communicate.test("getent passwd #{user.shellescape}"))
10
- end
11
-
12
- def bindfs_check_group(machine, group)
13
- (group.nil? || machine.communicate.test("getent group #{group.shellescape}"))
14
- end
15
-
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,17 +0,0 @@
1
- module VagrantPlugins
2
- module Bindfs
3
- module Cap
4
- module Linux
5
- module EnableFuse
6
- class << self
7
-
8
- def enable_fuse(machine)
9
- machine.communicate.sudo("/sbin/modprobe fuse")
10
- end
11
-
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- module VagrantPlugins
2
- module Bindfs
3
- module Cap
4
- module Linux
5
- module FuseLoaded
6
- class << self
7
-
8
- def fuse_loaded(machine)
9
- machine.communicate.test("lsmod | grep -q fuse")
10
- end
11
-
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end