vagrant-mountaineer 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -0
- data/README.md +17 -0
- data/lib/vagrant/mountaineer.rb +2 -1
- data/lib/vagrant/mountaineer/action.rb +1 -2
- data/lib/vagrant/mountaineer/action/hook_projects.rb +9 -1
- data/lib/vagrant/mountaineer/command.rb +66 -0
- data/lib/vagrant/mountaineer/config.rb +1 -1
- data/lib/vagrant/mountaineer/plugin.rb +4 -0
- data/lib/vagrant/mountaineer/projectfile.rb +1 -1
- data/lib/vagrant/mountaineer/registry.rb +2 -2
- data/lib/vagrant/mountaineer/util.rb +6 -0
- data/lib/vagrant/mountaineer/version.rb +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f358b480e0de95b796c8826290bc505fcde1a79009940492561f073077f79cd2
|
4
|
+
data.tar.gz: df09a5ed6049241b926ad1edfe7d34a7aeccb2b4f3585a2577cf0c738baf49bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d703380f4903badc053e240870a84f387b911847ea461d6b1ca9b93e00b235db2c3a3b1455eda2aa54c7238acd24330eb6d641fff6ae25029ffc36276de5b964
|
7
|
+
data.tar.gz: '074038c6a312607a121e66a2cb7ea5746c6632073818db8595429835cd256d7ba968dc0a069a50bb430750e27b18c3ba285258aa4046989dc68b095e6e22d9a3'
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -42,12 +42,29 @@ project 'test_nfs',
|
|
42
42
|
options: {
|
43
43
|
type: :nfs
|
44
44
|
}
|
45
|
+
|
46
|
+
project 'optional',
|
47
|
+
guestpath: '/data/plugin-optional',
|
48
|
+
hostpath: './may-not-exist',
|
49
|
+
optional: true
|
45
50
|
```
|
46
51
|
|
47
52
|
Values for `:guestpath ` and `:hostpath` are required. Additional options
|
48
53
|
(like `type`) can be configuring using the `:options` key. The name of the
|
49
54
|
project will be used as the mount identifier.
|
50
55
|
|
56
|
+
If a project is defined as `optional` it will not be mounted if the host
|
57
|
+
path is missing. For the time being this is done silently.
|
58
|
+
|
59
|
+
|
60
|
+
### Mountpoint Listing
|
61
|
+
|
62
|
+
You can list all known mountpoints in all machines:
|
63
|
+
|
64
|
+
```shell
|
65
|
+
vagrant mountaineer info
|
66
|
+
```
|
67
|
+
|
51
68
|
|
52
69
|
## License
|
53
70
|
|
data/lib/vagrant/mountaineer.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'vagrant'
|
2
2
|
|
3
|
-
I18n.load_path << File.expand_path('
|
3
|
+
I18n.load_path << File.expand_path('../../locales/en.yml', __dir__)
|
4
4
|
I18n.reload!
|
5
5
|
|
6
6
|
require 'vagrant/mountaineer/synopsis'
|
@@ -12,5 +12,6 @@ require 'vagrant/mountaineer/util'
|
|
12
12
|
|
13
13
|
require 'vagrant/mountaineer/action'
|
14
14
|
require 'vagrant/mountaineer/action/hook_projects'
|
15
|
+
require 'vagrant/mountaineer/command'
|
15
16
|
require 'vagrant/mountaineer/config'
|
16
17
|
require 'vagrant/mountaineer/plugin'
|
@@ -1,12 +1,11 @@
|
|
1
1
|
module VagrantPlugins
|
2
2
|
module Mountaineer
|
3
|
-
#
|
3
|
+
# Action hook definition
|
4
4
|
module Action
|
5
5
|
include Vagrant::Action::Builtin
|
6
6
|
|
7
7
|
def self.hook_projects
|
8
8
|
Vagrant::Action::Builder.new.tap do |builder|
|
9
|
-
builder.use ConfigValidate
|
10
9
|
builder.use HookProjects
|
11
10
|
end
|
12
11
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module VagrantPlugins
|
2
2
|
module Mountaineer
|
3
3
|
module Action
|
4
|
-
#
|
4
|
+
# Project hook to load and mount projectfile contents
|
5
5
|
class HookProjects
|
6
6
|
PROJECTFILE = VagrantPlugins::Mountaineer::Projectfile
|
7
7
|
REGISTRY = VagrantPlugins::Mountaineer::Registry
|
@@ -35,6 +35,8 @@ module VagrantPlugins
|
|
35
35
|
|
36
36
|
def mount_projects
|
37
37
|
@registry.projects.each do |name, project|
|
38
|
+
next if skip_mount?(project)
|
39
|
+
|
38
40
|
@machine.config.vm.synced_folders[name] = project[:options].merge(
|
39
41
|
disabled: false,
|
40
42
|
guestpath: project[:guestpath],
|
@@ -42,6 +44,12 @@ module VagrantPlugins
|
|
42
44
|
)
|
43
45
|
end
|
44
46
|
end
|
47
|
+
|
48
|
+
def skip_mount?(project)
|
49
|
+
project.key?(:optional) &&
|
50
|
+
project[:optional] == true &&
|
51
|
+
!File.directory?(project[:hostpath])
|
52
|
+
end
|
45
53
|
end
|
46
54
|
end
|
47
55
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Mountaineer
|
3
|
+
# Defines the mountaineer command
|
4
|
+
class Command < Vagrant.plugin(2, :command)
|
5
|
+
HOOK_PROJECTS = VagrantPlugins::Mountaineer::Action::HookProjects
|
6
|
+
UTIL = VagrantPlugins::Mountaineer::Util
|
7
|
+
|
8
|
+
def self.synopsis
|
9
|
+
'mountaineer utility commands'
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute
|
13
|
+
send(select_command(@argv))
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def display_help
|
19
|
+
@env.ui.info('Available commands:')
|
20
|
+
@env.ui.info(' - help')
|
21
|
+
@env.ui.info(' - info')
|
22
|
+
end
|
23
|
+
|
24
|
+
def display_info
|
25
|
+
first_vm = true
|
26
|
+
|
27
|
+
with_target_vms do |vm|
|
28
|
+
vm.action_raw(:mountaineer_command, HOOK_PROJECTS)
|
29
|
+
|
30
|
+
vm.env.ui.info("Machine: #{vm.name}")
|
31
|
+
display_machine_mounts(vm)
|
32
|
+
|
33
|
+
vm.env.ui.info('') if first_vm
|
34
|
+
|
35
|
+
first_vm = false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def display_machine_mounts(machine)
|
40
|
+
mounts = get_machine_mounts(machine)
|
41
|
+
pad_to = UTIL.pad_to(mounts)
|
42
|
+
|
43
|
+
mounts.each do |guestpath, hostpath|
|
44
|
+
guestpath = guestpath.ljust(pad_to)
|
45
|
+
hostpath = Pathname.new(machine.env.root_path) + hostpath
|
46
|
+
|
47
|
+
machine.env.ui.info(" - #{guestpath} (Host: #{hostpath})")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def get_machine_mounts(machine)
|
52
|
+
machine.config.vm.synced_folders.sort.map do |_name, sf|
|
53
|
+
[sf[:guestpath], sf[:hostpath]]
|
54
|
+
end.to_h
|
55
|
+
end
|
56
|
+
|
57
|
+
def select_command(argv)
|
58
|
+
case argv[0]
|
59
|
+
when 'help' then :display_help
|
60
|
+
when 'info' then :display_info
|
61
|
+
else :display_help
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module VagrantPlugins
|
2
2
|
module Mountaineer
|
3
|
-
#
|
3
|
+
# Project registry
|
4
4
|
class Registry
|
5
5
|
I18N_KEY = 'vagrant_mountaineer.registry'.freeze
|
6
6
|
|
@@ -25,7 +25,7 @@ module VagrantPlugins
|
|
25
25
|
|
26
26
|
def project(name, config = nil)
|
27
27
|
config = {} unless config.is_a?(Hash)
|
28
|
-
config[:options] = {} unless config.is_a?(Hash)
|
28
|
+
config[:options] = {} unless config[:options].is_a?(Hash)
|
29
29
|
|
30
30
|
return config_warning(name) unless valid_config?(config)
|
31
31
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-mountaineer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Neudert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '12.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.7'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.55'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.55'
|
69
69
|
description: Vagrant plugin to mount projects specified in a Projectfile to one of
|
70
70
|
your vagrant boxes
|
71
71
|
email:
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- lib/vagrant/mountaineer.rb
|
81
81
|
- lib/vagrant/mountaineer/action.rb
|
82
82
|
- lib/vagrant/mountaineer/action/hook_projects.rb
|
83
|
+
- lib/vagrant/mountaineer/command.rb
|
83
84
|
- lib/vagrant/mountaineer/config.rb
|
84
85
|
- lib/vagrant/mountaineer/plugin.rb
|
85
86
|
- lib/vagrant/mountaineer/projectfile.rb
|
@@ -109,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
110
|
version: '0'
|
110
111
|
requirements: []
|
111
112
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.7.6
|
113
114
|
signing_key:
|
114
115
|
specification_version: 4
|
115
116
|
summary: Mounts projects from a Projectfile
|