From 7e434ecbb4c136cbb0ba3a1e57c3c4e087873b1f Mon Sep 17 00:00:00 2001 From: John Landis Date: Thu, 17 May 2018 16:35:39 -0400 Subject: [PATCH 1/2] Move newlines out of quoted header and footer. Match carriage return along with newline in hosts file pattern. --- lib/vagrant-hostmanager/hosts_file/updater.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/vagrant-hostmanager/hosts_file/updater.rb b/lib/vagrant-hostmanager/hosts_file/updater.rb index 4ba7d19..ba8f38b 100644 --- a/lib/vagrant-hostmanager/hosts_file/updater.rb +++ b/lib/vagrant-hostmanager/hosts_file/updater.rb @@ -88,8 +88,8 @@ module VagrantPlugins def update_content(file_content, resolving_machine, include_id, line_endings) id = include_id ? " id: #{read_or_create_id}" : "" - header = "## vagrant-hostmanager-start#{id}\n" - footer = "## vagrant-hostmanager-end\n" + header = "## vagrant-hostmanager-start#{id}" + footer = "## vagrant-hostmanager-end" body = get_machines .map { |machine| get_hosts_file_entry(machine, resolving_machine) } .join @@ -146,12 +146,12 @@ module VagrantPlugins if body.empty? block = "\n" else - block = "\n\n" + header + body + footer + "\n" + block = "\n\n" + header + "\n" + body + footer + "\n\n" end # Pattern for finding existing block header_pattern = Regexp.quote(header) footer_pattern = Regexp.quote(footer) - pattern = Regexp.new("\n*#{header_pattern}.*?#{footer_pattern}\n*", Regexp::MULTILINE) + pattern = Regexp.new("[\r\n]*#{header_pattern}.*?#{footer_pattern}[\r\n]*", Regexp::MULTILINE) # Replace existing block or append content = old_content.match(pattern) ? old_content.sub(pattern, block) : old_content.rstrip + block if line_endings == "crlf" From 93b672d82940e2e0dcc44bdd99429a83bd89155f Mon Sep 17 00:00:00 2001 From: Seth Reeser Date: Fri, 18 May 2018 10:23:04 -0400 Subject: [PATCH 2/2] Releasing v1.8.9 --- lib/vagrant-hostmanager/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-hostmanager/version.rb b/lib/vagrant-hostmanager/version.rb index fa6acc5..ae0a99a 100644 --- a/lib/vagrant-hostmanager/version.rb +++ b/lib/vagrant-hostmanager/version.rb @@ -1,5 +1,5 @@ module VagrantPlugins module HostManager - VERSION = '1.8.8' + VERSION = '1.8.9' end end