vagrant-mutagen-utilizer 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +85 -0
- data/Rakefile +3 -0
- data/lib/vagrant-mutagen-utilizer.rb +13 -0
- data/lib/vagrant_mutagen_utilizer/action/remove_config.rb +27 -0
- data/lib/vagrant_mutagen_utilizer/action/save_machine_identifier.rb +22 -0
- data/lib/vagrant_mutagen_utilizer/action/start_orchestration.rb +27 -0
- data/lib/vagrant_mutagen_utilizer/action/terminate_orchestration.rb +27 -0
- data/lib/vagrant_mutagen_utilizer/action/update_config.rb +28 -0
- data/lib/vagrant_mutagen_utilizer/config.rb +33 -0
- data/lib/vagrant_mutagen_utilizer/orchestrator.rb +169 -0
- data/lib/vagrant_mutagen_utilizer/plugin.rb +63 -0
- data/lib/vagrant_mutagen_utilizer/version.rb +7 -0
- data/vagrant-mutagen-utilizer.gemspec +22 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dd4daac4c84ca803dd88af7064506e7cc44673ca02faae37c1d6ead2d62df066
|
4
|
+
data.tar.gz: d8ba9fb0c995b258fdeecde18600e150c779483a356e1c00376058aaa65013e0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4c228743cb8b3809ff833d7eacdc8cc42f9246e3997e85ff91396676f5c142400592fbfd9fae04f0d25a7c66f09b942a496b208c4d81cc834143362be51f1d20
|
7
|
+
data.tar.gz: 8da39bc9ff094062f1e22d5a557ebe186244cb18736dbe2797f45e8287806f5a0f2246794ff5bff3e5478d3db5743cae1e2ef81102ccced89bdf3a1c7f0596e4
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Falk Kühnel
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# Vagrant::Mutagen::Utilizer
|
2
|
+
|
3
|
+
This plugin forked from [vagrant-mutagen](https://github.com/dasginganinja/vagrant-mutagen) and made the following modifications.
|
4
|
+
|
5
|
+
* Is is not to be elevated to administrative privileges
|
6
|
+
* In many cases, the plugin executor has permission of SSH user configuration file
|
7
|
+
* Organized orchestration related to VM status (Basic ideas is below)
|
8
|
+
* Have an entry in the SSH configuration file exist only while the VM is running
|
9
|
+
* Running an project of mutagen only while the VM is running
|
10
|
+
|
11
|
+
|
12
|
+
This plugin adds an entry to your `~/.ssh/config` file on the host system.
|
13
|
+
|
14
|
+
On **up**, **resume** and **reload** commands, it tries to add the information, if it does not already exist in your config file.
|
15
|
+
On **halt**, **destroy**, and **suspend**, those entries will be removed again.
|
16
|
+
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
$ vagrant plugin install vagrant-mutagen-utilizer
|
21
|
+
|
22
|
+
Uninstall it with:
|
23
|
+
|
24
|
+
$ vagrant plugin uninstall vagrant-mutagen-utilizer
|
25
|
+
|
26
|
+
Update the plugin with:
|
27
|
+
|
28
|
+
$ vagrant plugin update vagrant-mutagen-utilizer
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
You need to set `orchestrate` and `config.vm.hostname`.
|
33
|
+
|
34
|
+
config.mutagen_utilizer.orchestrate = true
|
35
|
+
|
36
|
+
This hostname will be used for the entry in the `~/.ssh/config` file.
|
37
|
+
|
38
|
+
Orchestration also requires a `mutagen.yml` file configured for your project.
|
39
|
+
|
40
|
+
### Example Project Orchestration Config (`mutagen.yml`)
|
41
|
+
|
42
|
+
As an example starting point you can use the following for a Drupal project:
|
43
|
+
```
|
44
|
+
sync:
|
45
|
+
defaults:
|
46
|
+
mode: "two-way-resolved"
|
47
|
+
ignore:
|
48
|
+
vcs: false
|
49
|
+
paths:
|
50
|
+
- /.idea/
|
51
|
+
- /vendor/**/.git/
|
52
|
+
- contrib/**/.git/
|
53
|
+
- node_modules/
|
54
|
+
- /web/sites/**/files/
|
55
|
+
symlink:
|
56
|
+
mode: "portable"
|
57
|
+
watch:
|
58
|
+
mode: "portable"
|
59
|
+
permissions:
|
60
|
+
defaultFileMode: 0644
|
61
|
+
defaultDirectoryMode: 0755
|
62
|
+
app:
|
63
|
+
alpha: "your-vm.hostname:/srv/www/app/"
|
64
|
+
beta: "./app/"
|
65
|
+
```
|
66
|
+
|
67
|
+
## Installing development version
|
68
|
+
|
69
|
+
If you would like to install vagrant-mutagen-utilizer on the development version perform the following:
|
70
|
+
|
71
|
+
```
|
72
|
+
git clone https://github.com/ryu-sato/vagrant-mutagen-utilizer
|
73
|
+
cd vagrant-mutagen-utilizer
|
74
|
+
git checkout develop
|
75
|
+
gem build vagrant-mutagen-utilizer.gemspec
|
76
|
+
vagrant plugin install vagrant-mutagen-utilizer-*.gem
|
77
|
+
```
|
78
|
+
|
79
|
+
## Contributing
|
80
|
+
|
81
|
+
1. Fork it
|
82
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
83
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
84
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
85
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'vagrant_mutagen_utilizer/version'
|
4
|
+
require 'vagrant_mutagen_utilizer/plugin'
|
5
|
+
|
6
|
+
module VagrantPlugins
|
7
|
+
# MutagenUtilizer
|
8
|
+
module MutagenUtilizer
|
9
|
+
def self.source_root
|
10
|
+
@source_root ||= Pathname.new(File.expand_path('..', __dir__))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../orchestrator'
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module MutagenUtilizer
|
7
|
+
module Action
|
8
|
+
# Remove SSH config entry from user ssh config file
|
9
|
+
class RemoveConfig
|
10
|
+
def initialize(app, env)
|
11
|
+
@app = app
|
12
|
+
@machine = env[:machine]
|
13
|
+
@config = env[:machine].config
|
14
|
+
@console = env[:ui]
|
15
|
+
end
|
16
|
+
|
17
|
+
def call(env)
|
18
|
+
return unless @config.orchestrate?
|
19
|
+
|
20
|
+
o = Orchestrator.new(@machine, @console)
|
21
|
+
o.remove_ssh_config_entry
|
22
|
+
@app.call(env)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../orchestrator'
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module MutagenUtilizer
|
7
|
+
module Action
|
8
|
+
class SaveMachineIdentifier
|
9
|
+
def initialize(app, env)
|
10
|
+
@app = app
|
11
|
+
@machine = env[:machine]
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
o = Orchestrator.new(@machine, @console)
|
16
|
+
o.save_machine_identifier
|
17
|
+
@app.call(env)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../orchestrator'
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module MutagenUtilizer
|
7
|
+
module Action
|
8
|
+
# Start mutagen project
|
9
|
+
class StartOrchestration
|
10
|
+
def initialize(app, env)
|
11
|
+
@app = app
|
12
|
+
@machine = env[:machine]
|
13
|
+
@config = env[:machine].config
|
14
|
+
@console = env[:ui]
|
15
|
+
end
|
16
|
+
|
17
|
+
def call(env)
|
18
|
+
return unless @config.orchestrate?
|
19
|
+
|
20
|
+
o = Orchestrator.new(@machine, @console)
|
21
|
+
o.start_orchestration
|
22
|
+
@app.call(env)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../orchestrator'
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module MutagenUtilizer
|
7
|
+
module Action
|
8
|
+
# Terminate mutagen project
|
9
|
+
class TerminateOrchestration
|
10
|
+
def initialize(app, env)
|
11
|
+
@app = app
|
12
|
+
@machine = env[:machine]
|
13
|
+
@config = env[:machine].config
|
14
|
+
@console = env[:ui]
|
15
|
+
end
|
16
|
+
|
17
|
+
def call(env)
|
18
|
+
return unless @config.orchestrate?
|
19
|
+
|
20
|
+
o = Orchestrator.new(@machine, @console)
|
21
|
+
o.terminate_orchestration
|
22
|
+
@app.call(env)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../orchestrator'
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module MutagenUtilizer
|
7
|
+
module Action
|
8
|
+
# Update ssh config entry
|
9
|
+
# If ssh config entry already exists, just entry appended
|
10
|
+
class UpdateConfig
|
11
|
+
def initialize(app, env)
|
12
|
+
@app = app
|
13
|
+
@machine = env[:machine]
|
14
|
+
@config = env[:machine].config
|
15
|
+
@console = env[:ui]
|
16
|
+
end
|
17
|
+
|
18
|
+
def call(env)
|
19
|
+
return unless @config.orchestrate?
|
20
|
+
|
21
|
+
o = Orchestrator.new(@machine, @console)
|
22
|
+
o.update_ssh_config_entry
|
23
|
+
@app.call(env)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'vagrant'
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module MutagenUtilizer
|
7
|
+
# Config
|
8
|
+
# You can access Config class through machine object (ex. machine.config)
|
9
|
+
class Config < Vagrant.plugin('2', :config)
|
10
|
+
attr_accessor :orchestrate
|
11
|
+
attr_accessor :ssh_user_config_path
|
12
|
+
|
13
|
+
# Only use private
|
14
|
+
attr_accessor :machine_id
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
super
|
18
|
+
|
19
|
+
@orchestrate = UNSET_VALUE
|
20
|
+
@ssh_user_config_path = UNSET_VALUE
|
21
|
+
end
|
22
|
+
|
23
|
+
def finalize!
|
24
|
+
@orchestrate = false if @orchestrate == UNSET_VALUE
|
25
|
+
@ssh_user_config_path = File.expand_path('~/.ssh/config') if @ssh_user_config_path == UNSET_VALUE
|
26
|
+
end
|
27
|
+
|
28
|
+
def orchestrate?
|
29
|
+
@orchestrate
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module MutagenUtilizer
|
5
|
+
# Class for orchestrate with mutagen
|
6
|
+
class Orchestrator
|
7
|
+
def initialize(machine, console)
|
8
|
+
@machine = machine
|
9
|
+
@console = console
|
10
|
+
end
|
11
|
+
|
12
|
+
# Update ssh config entry
|
13
|
+
# If ssh config entry already exists, just entry appended
|
14
|
+
def update_ssh_config_entry
|
15
|
+
hostname = @machine.config.vm.hostname
|
16
|
+
|
17
|
+
logging(:info, 'Checking for SSH config entries')
|
18
|
+
if ssh_config_entry_exist?
|
19
|
+
logging(:info, " updating SSH Config entry for: #{hostname}")
|
20
|
+
remove_from_ssh_config
|
21
|
+
else
|
22
|
+
logging(:info, " adding entry to SSH config for: #{hostname}")
|
23
|
+
end
|
24
|
+
append_to_ssh_config(ssh_config_entry)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Remove ssh config entry
|
28
|
+
def remove_ssh_config_entry
|
29
|
+
return unless ssh_config_entry_exist?
|
30
|
+
|
31
|
+
logging(:info, 'Removing SSH config entry')
|
32
|
+
remove_from_ssh_config
|
33
|
+
end
|
34
|
+
|
35
|
+
def start_orchestration
|
36
|
+
return if mutagen_project_started?
|
37
|
+
|
38
|
+
logging(:info, 'Starting mutagen project orchestration (config: /mutagen.yml)')
|
39
|
+
start_mutagen_project || logging(:error, 'Failed to start mutagen project (see error above)')
|
40
|
+
# show project status to indicate if there are conflicts
|
41
|
+
list_mutagen_project
|
42
|
+
end
|
43
|
+
|
44
|
+
def terminate_orchestration
|
45
|
+
return unless mutagen_project_started?
|
46
|
+
|
47
|
+
logging(:info, 'Terminating mutagen project orchestration')
|
48
|
+
terminate_mutagen_project || logging(:error, 'Failed to terminate mutagen project (see error above)')
|
49
|
+
end
|
50
|
+
|
51
|
+
def save_machine_identifier
|
52
|
+
@machine.config.mutagen_utilizer.machine_id = @machine.id
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def logging(level, message, with_prefix = true)
|
58
|
+
prefix = with_prefix ? '[vagrant-mutagen-utilize] ' : ''
|
59
|
+
|
60
|
+
@console.send(level, "#{prefix}#{message}")
|
61
|
+
end
|
62
|
+
|
63
|
+
def ssh_user_config_path
|
64
|
+
@machine.config.mutagen_utilizer.ssh_user_config_path
|
65
|
+
end
|
66
|
+
|
67
|
+
# Create a regular expression that will match the vagrant-mutagen-utilize signature
|
68
|
+
def ssh_config_entry_pattern
|
69
|
+
hostname = @machine.config.vm.hostname
|
70
|
+
|
71
|
+
Regexp.new("^(#{Regexp.escape(signature)}).*$\nHost #{hostname}.*$")
|
72
|
+
end
|
73
|
+
|
74
|
+
def ssh_config_removing_pattern
|
75
|
+
escaped_signature = Regexp.escape(signature)
|
76
|
+
|
77
|
+
Regexp.new("^(#{escaped_signature}).*?(^#{escaped_signature}).*$", Regexp::MULTILINE)
|
78
|
+
end
|
79
|
+
|
80
|
+
def signature
|
81
|
+
name = @machine.name
|
82
|
+
# When destroing a VM, the machine.id is set to nil, so it refer the ID saved before destroying.
|
83
|
+
uuid = @machine.id || @machine.config.mutagen_utilizer.machine_id
|
84
|
+
hashed_id = Digest::MD5.hexdigest(uuid)
|
85
|
+
|
86
|
+
%(# VAGRANT: #{hashed_id} (#{name}) / #{uuid})
|
87
|
+
end
|
88
|
+
|
89
|
+
def ssh_config_entry
|
90
|
+
hostname = @machine.config.vm.hostname
|
91
|
+
|
92
|
+
# Get the SSH config from Vagrant
|
93
|
+
sshconfig = `vagrant ssh-config --host #{hostname}`
|
94
|
+
# Trim Whitespace from end
|
95
|
+
sshconfig = sshconfig.gsub(/^$\n/, '')
|
96
|
+
sshconfig = sshconfig.chomp
|
97
|
+
|
98
|
+
%(#{signature}\n#{sshconfig}\n#{signature})
|
99
|
+
end
|
100
|
+
|
101
|
+
def ssh_config_entry_exist?
|
102
|
+
File.read(ssh_user_config_path).match?(ssh_config_entry_pattern)
|
103
|
+
end
|
104
|
+
|
105
|
+
def validate_ssh_config_writable
|
106
|
+
return true if File.writable_real?(ssh_user_config_path)
|
107
|
+
|
108
|
+
logging(:info, "You don't have permission of #{ssh_user_config_path}. " \
|
109
|
+
'You should manually adding equivalent entries to the config file.')
|
110
|
+
|
111
|
+
false
|
112
|
+
end
|
113
|
+
|
114
|
+
def append_to_ssh_config(entry)
|
115
|
+
return if entry.length.zero?
|
116
|
+
return unless validate_ssh_config_writable
|
117
|
+
|
118
|
+
logging(:info, "Writing the following config to (#{ssh_user_config_path})")
|
119
|
+
logging(:info, entry, false)
|
120
|
+
append_line_feed_to_end_of_file_if_not_exist(ssh_user_config_path)
|
121
|
+
File.open(ssh_user_config_path, 'a') do |f|
|
122
|
+
f.write(entry)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def remove_from_ssh_config
|
127
|
+
return unless validate_ssh_config_writable
|
128
|
+
|
129
|
+
content = File.read(ssh_user_config_path)
|
130
|
+
new_content = content.gsub(ssh_config_removing_pattern, '')
|
131
|
+
File.open(ssh_user_config_path, 'w') do |f|
|
132
|
+
f.write(new_content)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def append_line_feed_to_end_of_file_if_not_exist(path)
|
137
|
+
# It is set "true" as default because
|
138
|
+
# when it doesn't know if file is ending with line feed or not, it should not add the line feed.
|
139
|
+
is_file_end_with_line_feed = true
|
140
|
+
File.open(path, 'a+') do |f|
|
141
|
+
f.seek(-1, IO::SEEK_END).zero? || (logging(:warning, "Cannot seek file #{path}") && break)
|
142
|
+
c = f.getc
|
143
|
+
is_file_end_with_line_feed = false if c != "\r" && c != "\n"
|
144
|
+
end
|
145
|
+
return if is_file_end_with_line_feed
|
146
|
+
|
147
|
+
File.open(path, 'a') do |f|
|
148
|
+
f.puts('')
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# Define methods to controll mutagen
|
153
|
+
DISCARD_STDOUT = Vagrant::Util::Platform.windows? ? '>nul' : '>/dev/null'
|
154
|
+
DISCARD_STDERR = Vagrant::Util::Platform.windows? ? '2>nul' : '2>/dev/null'
|
155
|
+
MUTAGEN_METHODS = {
|
156
|
+
# mutagen project list returns 1 on error when no project is started
|
157
|
+
"mutagen_project_started?": "mutagen project list #{DISCARD_STDOUT} #{DISCARD_STDERR}",
|
158
|
+
'start_mutagen_project': 'mutagen project start',
|
159
|
+
'terminate_mutagen_project': 'mutagen project terminate',
|
160
|
+
'list_mutagen_project': 'mutagen project list'
|
161
|
+
}.freeze
|
162
|
+
MUTAGEN_METHODS.each_pair do |method_name, command|
|
163
|
+
define_method method_name do
|
164
|
+
system(command)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'action/update_config'
|
4
|
+
require_relative 'action/remove_config'
|
5
|
+
require_relative 'action/start_orchestration'
|
6
|
+
require_relative 'action/terminate_orchestration'
|
7
|
+
require_relative 'action/save_machine_identifier'
|
8
|
+
|
9
|
+
module VagrantPlugins
|
10
|
+
module MutagenUtilizer
|
11
|
+
# Plugin to utilize mutagen
|
12
|
+
class MutagenUtilizerPlugin < Vagrant.plugin('2')
|
13
|
+
name 'Mutagen Utilizer'
|
14
|
+
description <<-DESC
|
15
|
+
This plugin manages the ~/.ssh/config file for the host machine. An entry is
|
16
|
+
created for the hostname attribute in the vm.config.
|
17
|
+
DESC
|
18
|
+
|
19
|
+
config(:mutagen_utilizer) do
|
20
|
+
require_relative 'config'
|
21
|
+
Config
|
22
|
+
end
|
23
|
+
|
24
|
+
action_hook(:mutagen_utilizer, :machine_action_up) do |hook|
|
25
|
+
hook.append(Action::UpdateConfig)
|
26
|
+
hook.append(Action::StartOrchestration)
|
27
|
+
end
|
28
|
+
|
29
|
+
action_hook(:mutagen_utilizer, :machine_action_provision) do |hook|
|
30
|
+
hook.before(Vagrant::Action::Builtin::Provision, Action::UpdateConfig)
|
31
|
+
hook.before(Vagrant::Action::Builtin::Provision, Action::StartOrchestration)
|
32
|
+
end
|
33
|
+
|
34
|
+
action_hook(:mutagen_utilizer, :machine_action_halt) do |hook|
|
35
|
+
hook.append(Action::TerminateOrchestration)
|
36
|
+
hook.append(Action::RemoveConfig)
|
37
|
+
end
|
38
|
+
|
39
|
+
action_hook(:mutagen_utilizer, :machine_action_suspend) do |hook|
|
40
|
+
hook.append(Action::TerminateOrchestration)
|
41
|
+
hook.append(Action::RemoveConfig)
|
42
|
+
end
|
43
|
+
|
44
|
+
action_hook(:mutagen_utilizer, :machine_action_destroy) do |hook|
|
45
|
+
hook.prepend(Action::SaveMachineIdentifier)
|
46
|
+
hook.append(Action::RemoveConfig)
|
47
|
+
hook.append(Action::TerminateOrchestration)
|
48
|
+
end
|
49
|
+
|
50
|
+
action_hook(:mutagen_utilizer, :machine_action_reload) do |hook|
|
51
|
+
hook.append(Action::TerminateOrchestration)
|
52
|
+
hook.append(Action::UpdateConfig)
|
53
|
+
hook.append(Action::StartOrchestration)
|
54
|
+
end
|
55
|
+
|
56
|
+
action_hook(:mutagen_utilizer, :machine_action_resume) do |hook|
|
57
|
+
hook.append(Action::TerminateOrchestration)
|
58
|
+
hook.append(Action::UpdateConfig)
|
59
|
+
hook.append(Action::StartOrchestration)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'vagrant_mutagen_utilizer/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'vagrant-mutagen-utilizer'
|
7
|
+
spec.version = VagrantPlugins::MutagenUtilizer::VERSION
|
8
|
+
spec.authors = ['Ryu Sato']
|
9
|
+
spec.email = ['ryu@weseek.co.jp']
|
10
|
+
spec.description = 'Enables Vagrant to utilize mutagen for project sync'
|
11
|
+
spec.summary = spec.description
|
12
|
+
spec.homepage = 'https://github.com/ryu-sato/vagrant-mutagen-utilizer'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
21
|
+
spec.add_development_dependency 'rake'
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-mutagen-utilizer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryu Sato
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Enables Vagrant to utilize mutagen for project sync
|
42
|
+
email:
|
43
|
+
- ryu@weseek.co.jp
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/vagrant-mutagen-utilizer.rb
|
54
|
+
- lib/vagrant_mutagen_utilizer/action/remove_config.rb
|
55
|
+
- lib/vagrant_mutagen_utilizer/action/save_machine_identifier.rb
|
56
|
+
- lib/vagrant_mutagen_utilizer/action/start_orchestration.rb
|
57
|
+
- lib/vagrant_mutagen_utilizer/action/terminate_orchestration.rb
|
58
|
+
- lib/vagrant_mutagen_utilizer/action/update_config.rb
|
59
|
+
- lib/vagrant_mutagen_utilizer/config.rb
|
60
|
+
- lib/vagrant_mutagen_utilizer/orchestrator.rb
|
61
|
+
- lib/vagrant_mutagen_utilizer/plugin.rb
|
62
|
+
- lib/vagrant_mutagen_utilizer/version.rb
|
63
|
+
- vagrant-mutagen-utilizer.gemspec
|
64
|
+
homepage: https://github.com/ryu-sato/vagrant-mutagen-utilizer
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubygems_version: 3.0.3
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Enables Vagrant to utilize mutagen for project sync
|
87
|
+
test_files: []
|