commands/init: minimal flag [GH-3611]
This commit is contained in:
parent
ddf4ec0754
commit
e3ec1027f1
|
@ -52,6 +52,7 @@ IMPROVEMENTS:
|
|||
1 means everything was declined. 2 means some were declined. [GH-811]
|
||||
- commands/destroy: Doesn't require box to exist anymore. [GH-1629]
|
||||
- commands/init: force flag. [GH-3564]
|
||||
- commands/init: flag for minimal Vagrantfile creation (no comments). [GH-3611]
|
||||
- commands/rsync-auto: Picks up and syncs provisioner folders if
|
||||
provisioners are backed by rsync.
|
||||
- commands/rsync-auto: Detects when new synced folders were added and warns
|
||||
|
|
|
@ -12,6 +12,7 @@ module VagrantPlugins
|
|||
def execute
|
||||
options = {
|
||||
force: false,
|
||||
minimal: false,
|
||||
output: "Vagrantfile",
|
||||
}
|
||||
|
||||
|
@ -25,6 +26,10 @@ module VagrantPlugins
|
|||
options[:force] = f
|
||||
end
|
||||
|
||||
o.on("-m", "--minimal", "Create minimal Vagrantfile (no help comments)") do |m|
|
||||
options[:minimal] = m
|
||||
end
|
||||
|
||||
o.on("--output FILE", String,
|
||||
"Output path for the box. '-' for stdout") do |output|
|
||||
options[:output] = output
|
||||
|
@ -42,7 +47,12 @@ module VagrantPlugins
|
|||
raise Vagrant::Errors::VagrantfileExistsError if save_path.exist?
|
||||
end
|
||||
|
||||
template_path = ::Vagrant.source_root.join("templates/commands/init/Vagrantfile")
|
||||
template = "templates/commands/init/Vagrantfile"
|
||||
if options[:minimal]
|
||||
template = "templates/commands/init/Vagrantfile.min"
|
||||
end
|
||||
|
||||
template_path = ::Vagrant.source_root.join(template)
|
||||
contents = Vagrant::Util::TemplateRenderer.render(template_path,
|
||||
:box_name => argv[0] || "base",
|
||||
:box_url => argv[1])
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
config.vm.box = "<%= box_name %>"
|
||||
<% if box_url -%>
|
||||
config.vm.box_url = "<%= box_url %>"
|
||||
<% end -%>
|
||||
end
|
Loading…
Reference in New Issue