Module: VagrantPlugins::HostPath::Logic

Included in:
VagrantPlugins::HostPath::Legacy::Middleware, Middleware
Defined in:
lib/vagrant-host-path/logic.rb

Instance Method Summary collapse

Instance Method Details

#escape_shell(content) ⇒ Object



16
17
18
# File 'lib/vagrant-host-path/logic.rb', line 16

def escape_shell(content)
  content.gsub(/["`\\]/, '\\\\\0')
end

#profile_file(config) ⇒ Object



12
13
14
# File 'lib/vagrant-host-path/logic.rb', line 12

def profile_file(config)
  "[ -f \"#{config.path_file}\" ] && export #{config.env_key}=\`cat \"#{config.path_file}\"\`"
end

#put_path_file(config, cwd) ⇒ Object



4
5
6
# File 'lib/vagrant-host-path/logic.rb', line 4

def put_path_file(config, cwd)
  sudo("echo \"#{cwd.to_s}\" > \"#{config.path_file}\"")
end

#put_profile_file(config) ⇒ Object



8
9
10
# File 'lib/vagrant-host-path/logic.rb', line 8

def put_profile_file(config)
  sudo("echo \"#{escape_shell(profile_file(config))}\" > \"#{config.profile_path}\"")
end