File tree Expand file tree Collapse file tree 7 files changed +227
-220
lines changed Expand file tree Collapse file tree 7 files changed +227
-220
lines changed Original file line number Diff line number Diff line change 1
- require 'vagrant-hostmanager/hosts_file'
1
+ require 'vagrant-hostmanager/hosts_file/updater '
2
2
require 'vagrant-hostmanager/util'
3
3
4
4
module VagrantPlugins
5
5
module HostManager
6
6
module Action
7
7
class UpdateAll
8
- include HostsFile
9
8
10
9
def initialize ( app , env )
11
10
@app = app
12
11
@machine = env [ :machine ]
13
12
@global_env = @machine . env
14
13
@provider = @machine . provider_name
15
14
@config = Util . get_config ( @global_env )
15
+ @updater = HostsFile ::Updater . new ( @global_env , @provider )
16
16
@logger = Log4r ::Logger . new ( 'vagrant::hostmanager::update_all' )
17
17
end
18
18
@@ -31,14 +31,14 @@ def call(env)
31
31
@global_env . active_machines . each do |name , p |
32
32
if p == @provider
33
33
machine = @global_env . machine ( name , p )
34
- update_guest ( machine )
34
+ @updater . update_guest ( machine )
35
35
end
36
36
end
37
37
38
38
# update /etc/hosts files on host if enabled
39
39
if @machine . config . hostmanager . manage_host?
40
40
env [ :ui ] . info I18n . t ( 'vagrant_hostmanager.action.update_host' )
41
- update_host
41
+ @updater . update_host
42
42
end
43
43
end
44
44
end
Original file line number Diff line number Diff line change 1
- require 'vagrant-hostmanager/hosts_file'
1
+ require 'vagrant-hostmanager/hosts_file/updater '
2
2
require 'vagrant-hostmanager/util'
3
3
4
4
module VagrantPlugins
5
5
module HostManager
6
6
module Action
7
7
class UpdateGuest
8
- include HostsFile
9
8
10
9
def initialize ( app , env )
11
10
@app = app
12
11
@machine = env [ :machine ]
13
- @global_env = @machine . env
14
- @provider = env [ :provider ]
15
- @config = Util . get_config ( @global_env )
12
+ @updater = HostsFile ::Updater . new ( @machine . env , env [ :provider ] )
16
13
@logger = Log4r ::Logger . new ( 'vagrant::hostmanager::update_guest' )
17
14
end
18
15
19
16
def call ( env )
20
17
env [ :ui ] . info I18n . t ( 'vagrant_hostmanager.action.update_guest' , {
21
18
:name => @machine . name
22
19
} )
23
- update_guest ( @machine )
20
+ @updater . update_guest ( @machine )
24
21
25
22
@app . call ( env )
26
23
end
Original file line number Diff line number Diff line change 1
- require 'vagrant-hostmanager/hosts_file'
1
+ require 'vagrant-hostmanager/hosts_file/updater '
2
2
require 'vagrant-hostmanager/util'
3
3
4
4
module VagrantPlugins
5
5
module HostManager
6
6
module Action
7
7
class UpdateHost
8
- include HostsFile
9
8
10
9
def initialize ( app , env )
11
10
@app = app
12
- @global_env = env [ :global_env ]
13
- @provider = env [ :provider ]
14
- @config = Util . get_config ( @global_env )
11
+
12
+ global_env = env [ :global_env ]
13
+ @config = Util . get_config ( global_env )
14
+ @updater = HostsFile ::Updater . new ( global_env , env [ :provider ] )
15
+
15
16
@logger = Log4r ::Logger . new ( 'vagrant::hostmanager::update_host' )
16
17
end
17
18
18
19
def call ( env )
19
20
if @config . hostmanager . manage_host?
20
21
env [ :ui ] . info I18n . t ( 'vagrant_hostmanager.action.update_host' )
21
- update_host
22
+ @updater . update_host
22
23
end
23
24
24
25
@app . call ( env )
25
26
end
26
27
end
27
28
end
28
29
end
29
- end
30
-
30
+ end
Original file line number Diff line number Diff line change 1
1
module VagrantPlugins
2
2
module HostManager
3
3
class Command < Vagrant . plugin ( '2' , :command )
4
- include HostsFile
5
4
6
5
# Show description when `vagrant list-commands` is triggered
7
6
def self . synopsis
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments