vagrant-helpers 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vagrant-helpers.rb +19 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5efda86e932832ddf6d1337516b4a55307403a2026dc0de6d3aa59f288ef92d5
4
- data.tar.gz: 40f1fee300f12b9cf4b1fc4637bc8db1e38c26a57b43dae8cef0a0b5039986ad
3
+ metadata.gz: 695246df3540865c9a76f5d5492fb8c575641ac21ccfe5c3bf2af9d064bbafc8
4
+ data.tar.gz: 8daf3a520f9d37768bbd2797f78e66d546dfc1b1f8a66b349bff9f6a46116e83
5
5
  SHA512:
6
- metadata.gz: c0fbde03b0d63bef4e4acf755840e2702960520c508d697d2c89fe4f99333d31b82396d5351955711e658f53a1741baa4227edbe9faf1a3b0147e0b1c27c3bb1
7
- data.tar.gz: 1431fd551bdc4f2ce45509030bed4550d83d0962f1f9dbf1ee9184ddddde0db9f1d6fdd2e2f1e0d30229658487367b9d623128a5bc4ff6f642f91502f4056999
6
+ metadata.gz: 0abb798139b9b2ffc32807c144934ae8dc79b5d4a2ed8efd9c7966c15c963c0d376f97202c6fee973dc54711cea8c241c07ebc65b2d5b55bbbe834cbf35d8914
7
+ data.tar.gz: 9e68b775b172de06b7701a26c84e6aa0c8b98c26b4af7b148ccb0786cc11bf3ee14f264311327d4e0253b066550a51c5575fec21289f5619b7951c41b6ea0e0f
@@ -4,6 +4,7 @@ require 'dotenv'
4
4
  require 'socket'
5
5
  require 'ipaddr'
6
6
  require 'ip'
7
+ require 'shellwords'
7
8
 
8
9
  module VagrantPlugins
9
10
  module Helpers
@@ -164,10 +165,27 @@ module VagrantPlugins
164
165
  end
165
166
  end
166
167
 
168
+ def self.command_exist?(command)
169
+ system("which #{command} > /dev/null 2>&1")
170
+ end
171
+
172
+ def self.windows_path?(path)
173
+ r = /^[a-zA-Z]:\\[\\\S|*\S]?.*$/
174
+ !path.match(r).nil?
175
+ end
176
+
177
+ def self.wslpath(path)
178
+ `wslpath #{::Shellwords.escape(path)}`.strip
179
+ end
180
+
167
181
  def self.set_vm_extra_storage(config, vm_storage_drives)
168
182
  config.vm.provider :virtualbox do |v|
169
183
  vm_storage_drives.each_with_index do |entry, ndx|
170
- unless ::File.exist? entry['filename']
184
+ entry_path = entry['filename']
185
+ if windows_path?(entry_path) && command_exist?('wslpath')
186
+ entry_path = wslpath(entry['filename'])
187
+ end
188
+ unless ::File.exist?(entry_path)
171
189
  # create hdd
172
190
  v.customize [
173
191
  'createhd',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Pyatkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-31 00:00:00.000000000 Z
11
+ date: 2019-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv