vagrant-layout 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2852387e8df22703fd65a71dc3194a8c817bf1af
4
- data.tar.gz: dee5f017bee57fb699658e33d978da3181ee88c0
3
+ metadata.gz: 1dd06af0864e15ef71a3c8a7fbe0aa0440448888
4
+ data.tar.gz: 2b3b2a6df8b6188182864110547e4bc1926b3d40
5
5
  SHA512:
6
- metadata.gz: f8c1d1c4e3b4166cab1750a7b36cc967922c076efe2d456e1c89f73e11d0e51aaacbd270d6a2b5280339f7e50282500008602b346d4ccda487651423fe91a35b
7
- data.tar.gz: f2e9020c888f981a26b7b0ba62d3da7cec27d25d33f2a0c23feabd3daa1e9c9295f284b1360899e89bbdb7a6eda138469ed8b95c84cef4e199177b16ecc68d6d
6
+ metadata.gz: 060a442d14c6b9f6a7af25223b3144b29009dc8e4677ebf8bea9b8300969f3f97b86388200724b9526ac05778c4058586cd7716a4afa1c8315dc8c46da8c1649
7
+ data.tar.gz: e11999ef371f7ba0b899918444ba3248234b6680ffbca7b5f9e8c63fcc78a69740b5ad1216592fcabec5fa796f4d9be72025e44f31120fbe5274fe1d89db6506
@@ -37,8 +37,7 @@ module VagrantPlugins
37
37
  else
38
38
  url += path
39
39
  end
40
-
41
- [:gist, url]
40
+ return [:gist, url]
42
41
  end
43
42
 
44
43
  target = target.split('/')
@@ -141,11 +140,32 @@ module VagrantPlugins
141
140
  end
142
141
  end
143
142
 
144
- def copy_layout(dir)
145
- Dir.open(dir).each do |src|
146
- next if src.to_s =~ /\A(README|\.git|LICENSE|\.\.?\z)/
147
- FileUtils.cp_r(File.join(dir, src), '.')
143
+ def copy_layout(source_dir)
144
+ sources = Dir.chdir(source_dir) { Dir.glob('**/*') }
145
+ sources.delete_if { |src| src =~ /\A(README|LICENSE|\.git)/ }
146
+
147
+ overwrite = []
148
+ sources.each do |src|
149
+ if File.exist?(src)
150
+ overwrite << src
151
+ end
152
+ end
153
+
154
+ unless overwrite.empty?
155
+ puts 'File already exists in this directory. Please specify -f to overwrite.'
156
+ overwrite.each { |src| puts " #{ src }" }
157
+ return false
158
+ end
159
+
160
+ sources.each do |src|
161
+ src_path = File.join(source_dir, src)
162
+ if File.directory?(src_path)
163
+ FileUtils.mkdir_p(src)
164
+ else
165
+ FileUtils.cp(src_path, src, preserve: true)
166
+ end
148
167
  end
168
+ true
149
169
  end
150
170
 
151
171
  def apply_patch(patch_file, github_dir)
@@ -3,6 +3,6 @@ module VagrantPlugins
3
3
  # Vagrant Layout Plugin
4
4
  #
5
5
  module Layout
6
- VERSION = '0.0.5'
6
+ VERSION = '0.0.6'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-layout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - KOSEKI Kengo