vagrant-layout 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e62f9a4e800e11e58f60420932d03b06b7e80926
4
- data.tar.gz: f9c14b3ca68979cb8cd02ce608bd4ea3bb2c7c3b
3
+ metadata.gz: 7df38e9feb8a4e818a87ad7924a1452bcbf50d02
4
+ data.tar.gz: 25df792cda72734a15feafabf5e8b118f2024468
5
5
  SHA512:
6
- metadata.gz: bd3aed20b4075a60b5fe113cef4f8bf43aa43994dfc75a7905737398da35770148e30717f6d4549d8663be3d5f82e4e32438d81167559ea878b9bd65cee978b9
7
- data.tar.gz: 4e1d76fb84502b3682ebc006ee7050c3d8f5d5b7de5848f3842318bcef4aa17e588891d035e06d9cecba37576d76c73ea42ab4d7510275d56632c2fce2600277
6
+ metadata.gz: b231cae5fa8d2ee031deb77c5ddf3b86b48080d5e04043b1cddc6d88a6a4d8b60060affde27fa253c1c212cb660b7488ed3fe8c6951fab177fdec9bece1fdd7a
7
+ data.tar.gz: f10b53efc735c7988b05aed1e562e180416458367c9210fdd6e14fdad1fcb53e625184d9ec46bbd53d4876d063740eea8660f6c3a47dc3bdaf0f57600956eb59
@@ -13,28 +13,32 @@ module VagrantPlugins
13
13
  end
14
14
 
15
15
  def execute
16
- @opts = OptionParser.new do |o|
16
+ opts = { force: false }
17
+ oparser = OptionParser.new do |o|
17
18
  o.banner = 'Usage: vagrant layout init [gist-url]'
19
+ o.on('-f', '--force', 'Overwrite existing files') do |f|
20
+ opts[:force] = f
21
+ end
18
22
  o.separator ''
19
23
  end
20
24
 
21
- @argv = parse_options(@opts)
22
- if @argv.empty?
23
- puts @opts.help
25
+ opts[:argv] = parse_options(oparser)
26
+ if opts[:argv].empty?
27
+ puts oparser.help
24
28
  return -1
25
29
  end
26
30
 
27
- command = @argv.shift
31
+ command = opts[:argv].shift
28
32
 
29
33
  result = -1
30
34
  if command == 'help'
31
- puts @opts.help
35
+ puts oparser.help
32
36
  result = 0
33
37
  elsif command == 'init'
34
- result = CommandInit.new(@argv).execute
38
+ result = CommandInit.new(opts).execute
35
39
  end
36
40
 
37
- puts @opts.help unless result == 0
41
+ puts oparser.help unless result == 0
38
42
 
39
43
  result
40
44
  end
@@ -12,12 +12,12 @@ module VagrantPlugins
12
12
  class CommandInit
13
13
  DEFAULT_REPOSITORY = %w{koseki vagrant-layout master}
14
14
 
15
- def initialize(argv)
16
- @argv = argv
15
+ def initialize(opts)
16
+ @opts = opts
17
17
  end
18
18
 
19
19
  def execute
20
- target = parse_target(@argv.shift)
20
+ target = parse_target(@opts[:argv].shift)
21
21
  return -1 unless target
22
22
 
23
23
  Dir.mktmpdir do |root|
@@ -150,15 +150,19 @@ module VagrantPlugins
150
150
 
151
151
  overwrite = []
152
152
  sources.each do |src|
153
- if File.exist?(src)
153
+ if File.exist?(src) && ! File.directory?(src)
154
154
  overwrite << src
155
155
  end
156
156
  end
157
157
 
158
158
  unless overwrite.empty?
159
- puts 'File already exists in this directory. Please specify -f to overwrite.'
160
- overwrite.each { |src| puts " #{ src }" }
161
- return false
159
+ if @opts[:force]
160
+ overwrite.each { |src| puts "Overwrite: #{ src }" }
161
+ else
162
+ puts 'File already exists in this directory. Please specify -f to overwrite.'
163
+ overwrite.each { |src| puts " #{ src }" }
164
+ return false
165
+ end
162
166
  end
163
167
 
164
168
  sources.each do |src|
@@ -3,6 +3,6 @@ module VagrantPlugins
3
3
  # Vagrant Layout Plugin
4
4
  #
5
5
  module Layout
6
- VERSION = '0.0.7'
6
+ VERSION = '0.0.8'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-layout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - KOSEKI Kengo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-20 00:00:00.000000000 Z
11
+ date: 2014-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler