From 14b84a4a76dc3bc3e7693b2388b37072370169b6 Mon Sep 17 00:00:00 2001 From: Rob Kinyon Date: Tue, 28 Oct 2014 21:53:41 -0400 Subject: [PATCH] Added a --plugin-clean-sources parameter that will allow for only those sources that are defined by the user to be used. --- .gitignore | 4 ++++ lib/vagrant/bundler.rb | 5 ----- plugins/commands/plugin/command/mixin_install_opts.rb | 11 ++++++++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 47b95a67e..8fe665031 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ # OS-specific .DS_Store +# Editor swapfiles +.*.sw? +*~ + # Vagrant stuff acceptance_config.yml boxes/* diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb index 05867da15..e12b89174 100644 --- a/lib/vagrant/bundler.rb +++ b/lib/vagrant/bundler.rb @@ -178,11 +178,6 @@ module Vagrant f = File.open(Tempfile.new("vagrant").path + "2", "w+") f.tap do |gemfile| - if !sources.include?("http://rubygems.org") - gemfile.puts(%Q[source "https://rubygems.org"]) - end - - gemfile.puts(%Q[source "http://gems.hashicorp.com"]) sources.each do |source| next if source == "" gemfile.puts(%Q[source "#{source}"]) diff --git a/plugins/commands/plugin/command/mixin_install_opts.rb b/plugins/commands/plugin/command/mixin_install_opts.rb index 0b1b0973a..ffee55cde 100644 --- a/plugins/commands/plugin/command/mixin_install_opts.rb +++ b/plugins/commands/plugin/command/mixin_install_opts.rb @@ -3,6 +3,11 @@ module VagrantPlugins module Command module MixinInstallOpts def build_install_opts(o, options) + options[:plugin_sources] = [ + "https://rubygems.org", + "http://gems.hashicorp.com", + ] + o.on("--entry-point NAME", String, "The name of the entry point file for loading the plugin.") do |entry_point| options[:entry_point] = entry_point @@ -17,9 +22,13 @@ module VagrantPlugins puts end + o.on("--plugin-clean-sources", String, + "Remove all plugin sources defined so far (including defaults)") do + options[:plugin_sources] = [] + end + o.on("--plugin-source PLUGIN_SOURCE", String, "Add a RubyGems repository source") do |plugin_source| - options[:plugin_sources] ||= [] options[:plugin_sources] << plugin_source end