tnargav 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Trap interrupts to quit cleanly. This will be overriden at some point
4
+ # by Vagrant. This is made to catch any interrupts while Vagrant is
5
+ # initializing which have historically resulted in stack traces.
6
+ Signal.trap("INT") { exit 1 }
7
+
8
+ require 'log4r'
9
+ require 'vagrant'
10
+ require 'vagrant/cli'
11
+ require 'vagrant/util/platform'
12
+
13
+ # Create a logger right away
14
+ logger = Log4r::Logger.new("vagrant::bin::vagrant")
15
+ logger.info("`vagrant` invoked: #{ARGV.inspect}")
16
+
17
+ # Stdout/stderr should not buffer output
18
+ $stdout.sync = true
19
+ $stderr.sync = true
20
+
21
+ # These will be the options that are passed to initialze the Vagrant
22
+ # environment.
23
+ opts = {}
24
+
25
+ # Disable color in a few cases:
26
+ #
27
+ # * --no-color is anywhere in our arguments
28
+ # * STDOUT is not a TTY
29
+ # * The terminal doesn't support colors (Windows)
30
+ #
31
+ if ARGV.include?("--no-color")
32
+ # Delete the argument from the list so that it doesn't
33
+ # cause any invalid arguments down the road.
34
+ ARGV.delete("--no-color")
35
+
36
+ opts[:ui_class] = Vagrant::UI::Basic
37
+ elsif !Vagrant::Util::Platform.terminal_supports_colors?
38
+ opts[:ui_class] = Vagrant::UI::Basic
39
+ elsif !$stdout.tty? && !Vagrant::Util::Platform.cygwin?
40
+ opts[:ui_class] = Vagrant::UI::Basic
41
+ end
42
+
43
+ # Also allow users to force colors.
44
+ if ARGV.include?("--color")
45
+ ARGV.delete("--color")
46
+ opts[:ui_class] = Vagrant::UI::Colored
47
+ end
48
+
49
+ # Default to colored output
50
+ opts[:ui_class] ||= Vagrant::UI::Colored
51
+
52
+ # This is kind of hacky, and I'd love to find a better way to do this, but
53
+ # if we're accessing the plugin interface, we want to NOT load plugins
54
+ # for this run, because they can actually interfere with the function
55
+ # of the plugin interface.
56
+ ARGV.each do |arg|
57
+ if !arg.start_with?("-")
58
+ ENV["VAGRANT_NO_PLUGINS"] = "1" if arg == "plugin"
59
+ break
60
+ end
61
+ end
62
+
63
+ # Fast path the version of Vagrant
64
+ if ARGV.include?("-v") || ARGV.include?("--version")
65
+ puts "Vagrant #{Vagrant::VERSION}"
66
+ exit 0
67
+ end
68
+
69
+ env = nil
70
+ begin
71
+ # Create the environment, which is the cwd of wherever the
72
+ # `vagrant` command was invoked from
73
+ logger.debug("Creating Vagrant environment")
74
+ env = Vagrant::Environment.new(opts)
75
+
76
+ if !Vagrant.in_installer?
77
+ warned = false
78
+
79
+ # If we're in a bundler environment, we assume it is for plugin
80
+ # development and will let the user know that.
81
+ if defined?(Bundler)
82
+ require 'bundler/shared_helpers'
83
+ if Bundler::SharedHelpers.in_bundle?
84
+ warned = true
85
+ end
86
+ end
87
+
88
+ # If we're not in the installer, warn.
89
+ env.ui.warn(I18n.t("vagrant.general.not_in_installer")) if !warned
90
+ end
91
+
92
+ begin
93
+ # Execute the CLI interface, and exit with the proper error code
94
+ exit_status = env.cli(ARGV)
95
+ ensure
96
+ # Unload the environment so cleanup can be done
97
+ env.unload
98
+ end
99
+
100
+ # Exit with the exit status from our CLI command
101
+ exit(exit_status)
102
+ rescue Vagrant::Errors::VagrantError => e
103
+ logger.error("Vagrant experienced an error! Details:")
104
+ logger.error(e.inspect)
105
+ logger.error(e.message)
106
+ logger.error(e.backtrace.join("\n"))
107
+
108
+ if env
109
+ opts = { :prefix => false }
110
+ env.ui.error e.message, opts if e.message
111
+ else
112
+ $stderr.puts "Vagrant failed to initialize at a very early stage:\n\n"
113
+ $stderr.puts e.message
114
+ end
115
+
116
+ exit e.status_code if e.respond_to?(:status_code)
117
+ exit 999 # An error occurred with no status code defined
118
+ end
@@ -0,0 +1,34 @@
1
+ Vagrant.configure("2") do |config|
2
+ config.vagrant.host = :detect
3
+
4
+ config.ssh.forward_agent = false
5
+ config.ssh.forward_x11 = false
6
+ config.ssh.guest_port = 22
7
+ config.ssh.keep_alive = true
8
+ config.ssh.shell = "bash -l"
9
+
10
+ config.ssh.default.username = "vagrant"
11
+
12
+ config.vm.usable_port_range = (2200..2250)
13
+ config.vm.box_url = nil
14
+ config.vm.base_mac = nil
15
+ config.vm.boot_timeout = 300
16
+ config.vm.graceful_halt_timeout = 60
17
+
18
+ # Share SSH locally by default
19
+ config.vm.network :forwarded_port,
20
+ guest: 22,
21
+ host: 2222,
22
+ host_ip: "127.0.0.1",
23
+ id: "ssh",
24
+ auto_correct: true
25
+
26
+ # Share the root folder. This can then be overridden by
27
+ # other Vagrantfiles, if they wish.
28
+ config.vm.synced_folder ".", "/vagrant"
29
+
30
+ config.nfs.map_uid = :auto
31
+ config.nfs.map_gid = :auto
32
+
33
+ config.package.name = 'package.box'
34
+ end
@@ -0,0 +1,10 @@
1
+ # Insecure Keypair
2
+
3
+ These keys are the "insecure" public/private keypair we offer to
4
+ [base box creators](http://docs.vagrantup.com/v1/docs/base_boxes.html) for use in their base boxes so that
5
+ vagrant installations can automatically SSH into the boxes.
6
+
7
+ If you're working with a team or company or with a custom box and
8
+ you want more secure SSH, you should create your own keypair
9
+ and configure the private key in the Vagrantfile with
10
+ `config.ssh.private_key_path`
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEogIBAAKCAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzI
3
+ w+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoP
4
+ kcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2
5
+ hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NO
6
+ Td0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW
7
+ yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQIBIwKCAQEA4iqWPJXtzZA68mKd
8
+ ELs4jJsdyky+ewdZeNds5tjcnHU5zUYE25K+ffJED9qUWICcLZDc81TGWjHyAqD1
9
+ Bw7XpgUwFgeUJwUlzQurAv+/ySnxiwuaGJfhFM1CaQHzfXphgVml+fZUvnJUTvzf
10
+ TK2Lg6EdbUE9TarUlBf/xPfuEhMSlIE5keb/Zz3/LUlRg8yDqz5w+QWVJ4utnKnK
11
+ iqwZN0mwpwU7YSyJhlT4YV1F3n4YjLswM5wJs2oqm0jssQu/BT0tyEXNDYBLEF4A
12
+ sClaWuSJ2kjq7KhrrYXzagqhnSei9ODYFShJu8UWVec3Ihb5ZXlzO6vdNQ1J9Xsf
13
+ 4m+2ywKBgQD6qFxx/Rv9CNN96l/4rb14HKirC2o/orApiHmHDsURs5rUKDx0f9iP
14
+ cXN7S1uePXuJRK/5hsubaOCx3Owd2u9gD6Oq0CsMkE4CUSiJcYrMANtx54cGH7Rk
15
+ EjFZxK8xAv1ldELEyxrFqkbE4BKd8QOt414qjvTGyAK+OLD3M2QdCQKBgQDtx8pN
16
+ CAxR7yhHbIWT1AH66+XWN8bXq7l3RO/ukeaci98JfkbkxURZhtxV/HHuvUhnPLdX
17
+ 3TwygPBYZFNo4pzVEhzWoTtnEtrFueKxyc3+LjZpuo+mBlQ6ORtfgkr9gBVphXZG
18
+ YEzkCD3lVdl8L4cw9BVpKrJCs1c5taGjDgdInQKBgHm/fVvv96bJxc9x1tffXAcj
19
+ 3OVdUN0UgXNCSaf/3A/phbeBQe9xS+3mpc4r6qvx+iy69mNBeNZ0xOitIjpjBo2+
20
+ dBEjSBwLk5q5tJqHmy/jKMJL4n9ROlx93XS+njxgibTvU6Fp9w+NOFD/HvxB3Tcz
21
+ 6+jJF85D5BNAG3DBMKBjAoGBAOAxZvgsKN+JuENXsST7F89Tck2iTcQIT8g5rwWC
22
+ P9Vt74yboe2kDT531w8+egz7nAmRBKNM751U/95P9t88EDacDI/Z2OwnuFQHCPDF
23
+ llYOUI+SpLJ6/vURRbHSnnn8a/XG+nzedGH5JGqEJNQsz+xT2axM0/W/CRknmGaJ
24
+ kda/AoGANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH
25
+ +vq/5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQ
26
+ NE5OgEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s=
27
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1 @@
1
+ ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
@@ -0,0 +1,265 @@
1
+ require 'log4r'
2
+
3
+ # Enable logging if it is requested. We do this before
4
+ # anything else so that we can setup the output before
5
+ # any logging occurs.
6
+ if ENV["VAGRANT_LOG"] && ENV["VAGRANT_LOG"] != ""
7
+ # Require Log4r and define the levels we'll be using
8
+ require 'log4r/config'
9
+ Log4r.define_levels(*Log4r::Log4rConfig::LogLevels)
10
+
11
+ level = nil
12
+ begin
13
+ level = Log4r.const_get(ENV["VAGRANT_LOG"].upcase)
14
+ rescue NameError
15
+ # This means that the logging constant wasn't found,
16
+ # which is fine. We just keep `level` as `nil`. But
17
+ # we tell the user.
18
+ level = nil
19
+ end
20
+
21
+ # Some constants, such as "true" resolve to booleans, so the
22
+ # above error checking doesn't catch it. This will check to make
23
+ # sure that the log level is an integer, as Log4r requires.
24
+ level = nil if !level.is_a?(Integer)
25
+
26
+ if !level
27
+ # We directly write to stderr here because the VagrantError system
28
+ # is not setup yet.
29
+ $stderr.puts "Invalid VAGRANT_LOG level is set: #{ENV["VAGRANT_LOG"]}"
30
+ $stderr.puts ""
31
+ $stderr.puts "Please use one of the standard log levels: debug, info, warn, or error"
32
+ exit 1
33
+ end
34
+
35
+ # Set the logging level on all "vagrant" namespaced
36
+ # logs as long as we have a valid level.
37
+ if level
38
+ logger = Log4r::Logger.new("vagrant")
39
+ logger.outputters = Log4r::Outputter.stderr
40
+ logger.level = level
41
+ logger = nil
42
+ end
43
+ end
44
+
45
+ require 'json'
46
+ require 'pathname'
47
+ require 'stringio'
48
+
49
+ require 'childprocess'
50
+ require 'i18n'
51
+
52
+ # OpenSSL must be loaded here since when it is loaded via `autoload`
53
+ # there are issues with ciphers not being properly loaded.
54
+ require 'openssl'
55
+
56
+ # Always make the version available
57
+ require 'vagrant/version'
58
+ global_logger = Log4r::Logger.new("vagrant::global")
59
+ global_logger.info("Vagrant version: #{Vagrant::VERSION}")
60
+
61
+ # We need these components always so instead of an autoload we
62
+ # just require them explicitly here.
63
+ require "vagrant/registry"
64
+
65
+ module Vagrant
66
+ autoload :Action, 'vagrant/action'
67
+ autoload :BatchAction, 'vagrant/batch_action'
68
+ autoload :Box, 'vagrant/box'
69
+ autoload :BoxCollection, 'vagrant/box_collection'
70
+ autoload :CLI, 'vagrant/cli'
71
+ autoload :Command, 'vagrant/command'
72
+ autoload :Config, 'vagrant/config'
73
+ autoload :Driver, 'vagrant/driver'
74
+ autoload :Environment, 'vagrant/environment'
75
+ autoload :Errors, 'vagrant/errors'
76
+ autoload :Guest, 'vagrant/guest'
77
+ autoload :Hosts, 'vagrant/hosts'
78
+ autoload :Machine, 'vagrant/machine'
79
+ autoload :MachineState, 'vagrant/machine_state'
80
+ autoload :Plugin, 'vagrant/plugin'
81
+ autoload :UI, 'vagrant/ui'
82
+ autoload :Util, 'vagrant/util'
83
+
84
+ # These are the various plugin versions and their components in
85
+ # a lazy loaded Hash-like structure.
86
+ PLUGIN_COMPONENTS = Registry.new.tap do |c|
87
+ c.register(:"1") { Plugin::V1::Plugin }
88
+ c.register([:"1", :command]) { Plugin::V1::Command }
89
+ c.register([:"1", :communicator]) { Plugin::V1::Communicator }
90
+ c.register([:"1", :config]) { Plugin::V1::Config }
91
+ c.register([:"1", :guest]) { Plugin::V1::Guest }
92
+ c.register([:"1", :host]) { Plugin::V1::Host }
93
+ c.register([:"1", :provider]) { Plugin::V1::Provider }
94
+ c.register([:"1", :provisioner]) { Plugin::V1::Provisioner }
95
+
96
+ c.register(:"2") { Plugin::V2::Plugin }
97
+ c.register([:"2", :command]) { Plugin::V2::Command }
98
+ c.register([:"2", :communicator]) { Plugin::V2::Communicator }
99
+ c.register([:"2", :config]) { Plugin::V2::Config }
100
+ c.register([:"2", :guest]) { Plugin::V2::Guest }
101
+ c.register([:"2", :host]) { Plugin::V2::Host }
102
+ c.register([:"2", :provider]) { Plugin::V2::Provider }
103
+ c.register([:"2", :provisioner]) { Plugin::V2::Provisioner }
104
+ end
105
+
106
+ # This returns a true/false showing whether we're running from the
107
+ # environment setup by the Vagrant installers.
108
+ #
109
+ # @return [Boolean]
110
+ def self.in_installer?
111
+ !!ENV["VAGRANT_INSTALLER_ENV"]
112
+ end
113
+
114
+ # The source root is the path to the root directory of
115
+ # the Vagrant gem.
116
+ def self.source_root
117
+ @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
118
+ end
119
+
120
+ # Configure a Vagrant environment. The version specifies the version
121
+ # of the configuration that is expected by the block. The block, based
122
+ # on that version, configures the environment.
123
+ #
124
+ # Note that the block isn't run immediately. Instead, the configuration
125
+ # block is stored until later, and is run when an environment is loaded.
126
+ #
127
+ # @param [String] version Version of the configuration
128
+ def self.configure(version, &block)
129
+ Config.run(version, &block)
130
+ end
131
+
132
+ # This checks if a plugin with the given name is installed. This can
133
+ # be used from the Vagrantfile to easily branch based on plugin
134
+ # availability.
135
+ def self.has_plugin?(name)
136
+ plugin("2").manager.registered.any? { |plugin| plugin.name == name }
137
+ end
138
+
139
+ # Returns a superclass to use when creating a plugin for Vagrant.
140
+ # Given a specific version, this returns a proper superclass to use
141
+ # to register plugins for that version.
142
+ #
143
+ # Optionally, if you give a specific component, then it will return
144
+ # the proper superclass for that component as well.
145
+ #
146
+ # Plugins and plugin components should subclass the classes returned by
147
+ # this method. This method lets Vagrant core control these superclasses
148
+ # and change them over time without affecting plugins. For example, if
149
+ # the V1 superclass happens to be "Vagrant::V1," future versions of
150
+ # Vagrant may move it to "Vagrant::Plugins::V1" and plugins will not be
151
+ # affected.
152
+ #
153
+ # @param [String] version
154
+ # @param [String] component
155
+ # @return [Class]
156
+ def self.plugin(version, component=nil)
157
+ # Build up the key and return a result
158
+ key = version.to_s.to_sym
159
+ key = [key, component.to_s.to_sym] if component
160
+ result = PLUGIN_COMPONENTS.get(key)
161
+
162
+ # If we found our component then we return that
163
+ return result if result
164
+
165
+ # If we didn't find a result, then raise an exception, depending
166
+ # on if we got a component or not.
167
+ raise ArgumentError, "Plugin superclass not found for version/component: " +
168
+ "#{version} #{component}"
169
+ end
170
+
171
+ # This should be used instead of Ruby's built-in `require` in order to
172
+ # load a Vagrant plugin. This will load the given plugin by first doing
173
+ # a normal `require`, giving a nice error message if things go wrong,
174
+ # and second by verifying that a Vagrant plugin was actually defined in
175
+ # the process.
176
+ #
177
+ # @param [String] name Name of the plugin to load.
178
+ def self.require_plugin(name)
179
+ if ENV["VAGRANT_NO_PLUGINS"]
180
+ logger = Log4r::Logger.new("vagrant::root")
181
+ logger.warn("VAGRANT_NO_PLUGINS is set, not loading 3rd party plugin: #{name}")
182
+ return
183
+ end
184
+
185
+ # Redirect stdout/stderr so that we can output it in our own way.
186
+ previous_stderr = $stderr
187
+ previous_stdout = $stdout
188
+ $stderr = StringIO.new
189
+ $stdout = StringIO.new
190
+
191
+ # Attempt the normal require
192
+ begin
193
+ require name
194
+ rescue Exception => e
195
+ # Since this is a rare case, we create a one-time logger here
196
+ # in order to output the error
197
+ logger = Log4r::Logger.new("vagrant::root")
198
+ logger.error("Failed to load plugin: #{name}")
199
+ logger.error(" -- Error: #{e.inspect}")
200
+ logger.error(" -- Backtrace:")
201
+ logger.error(e.backtrace.join("\n"))
202
+
203
+ # If it is a LoadError we first try to see if it failed loading
204
+ # the top-level entrypoint. If so, then we report a different error.
205
+ if e.is_a?(LoadError)
206
+ # Parse the message in order to get what failed to load, and
207
+ # add some extra protection around if the message is different.
208
+ parts = e.to_s.split(" -- ", 2)
209
+ if parts.length == 2 && parts[1] == name
210
+ raise Errors::PluginLoadError, :plugin => name
211
+ end
212
+ end
213
+
214
+ # Get the string data out from the stdout/stderr captures
215
+ stderr = $stderr.string
216
+ stdout = $stdout.string
217
+ if !stderr.empty? || !stdout.empty?
218
+ raise Errors::PluginLoadFailedWithOutput,
219
+ :plugin => name,
220
+ :stderr => stderr,
221
+ :stdout => stdout
222
+ end
223
+
224
+ # And raise an error itself
225
+ raise Errors::PluginLoadFailed,
226
+ :plugin => name
227
+ end
228
+ ensure
229
+ $stderr = previous_stderr if previous_stderr
230
+ $stdout = previous_stdout if previous_stdout
231
+ end
232
+ end
233
+
234
+ # Default I18n to load the en locale
235
+ I18n.load_path << File.expand_path("templates/locales/en.yml", Vagrant.source_root)
236
+
237
+ # A lambda that knows how to load plugins from a single directory.
238
+ plugin_load_proc = lambda do |directory|
239
+ # We only care about directories
240
+ next false if !directory.directory?
241
+
242
+ # If there is a plugin file in the top-level directory, then load
243
+ # that up.
244
+ plugin_file = directory.join("plugin.rb")
245
+ if plugin_file.file?
246
+ global_logger.debug("Loading core plugin: #{plugin_file}")
247
+ load(plugin_file)
248
+ next true
249
+ end
250
+ end
251
+
252
+ # Go through the `plugins` directory and attempt to load any plugins. The
253
+ # plugins are allowed to be in a directory in `plugins` or at most one
254
+ # directory deep within the plugins directory. So a plugin can be at
255
+ # `plugins/foo` or also at `plugins/foo/bar`, but no deeper.
256
+ Vagrant.source_root.join("plugins").children(true).each do |directory|
257
+ # Ignore non-directories
258
+ next if !directory.directory?
259
+
260
+ # Load from this directory, and exit if we successfully loaded a plugin
261
+ next if plugin_load_proc.call(directory)
262
+
263
+ # Otherwise, attempt to load from sub-directories
264
+ directory.children(true).each(&plugin_load_proc)
265
+ end
@@ -0,0 +1,5 @@
1
+ # Vagrant Core Plugins
2
+
3
+ These are plugins that ship with Vagrant. Vagrant core uses its own
4
+ plugin system to power a lot of the core pieces that ship with Vagrant.
5
+ Each plugin will have its own README which explains its specific role.
@@ -0,0 +1,113 @@
1
+ require 'digest/sha1'
2
+ require 'net/http'
3
+ require 'pathname'
4
+ require 'uri'
5
+ require 'yaml'
6
+
7
+ require 'childprocess'
8
+
9
+ require 'vagrant/util/file_checksum'
10
+
11
+ namespace :acceptance do
12
+ desc "Downloads the boxes required for running the acceptance tests."
13
+ task :boxes, :directory do |t, args|
14
+ # Create the directory where the boxes will be downloaded
15
+ box_dir = Pathname.new(args[:directory] || File.expand_path("../../boxes", __FILE__))
16
+ box_dir.mkpath
17
+ puts "Boxes will be placed in: #{box_dir}"
18
+
19
+ # Load the required boxes
20
+ boxes = YAML.load_file(File.expand_path("../../test/config/acceptance_boxes.yml", __FILE__))
21
+
22
+ boxes.each do |box|
23
+ puts "Box: #{box["name"]}"
24
+ box_file = box_dir.join("#{box["name"]}.box")
25
+ checksum = FileChecksum.new(box_file, Digest::SHA1)
26
+
27
+ # If the box exists, we need to check the checksum and determine if we need
28
+ # to redownload the file.
29
+ if box_file.exist?
30
+ print "Box exists, checking SHA1 sum... "
31
+ if checksum.checksum == box["checksum"]
32
+ print "OK\n"
33
+ next
34
+ else
35
+ print "FAIL\n"
36
+ end
37
+ end
38
+
39
+ # Download the file. Note that this has no error checking and just uses
40
+ # pure net/http. There could be a better way.
41
+ puts "Downloading: #{box["url"]}"
42
+ destination = box_file.open("wb")
43
+ uri = URI.parse(box["url"])
44
+ Net::HTTP.new(uri.host, uri.port).start do |http|
45
+ http.request_get(uri.request_uri) do |response|
46
+ total = response.content_length
47
+ progress = 0
48
+ count = 0
49
+
50
+ response.read_body do |segment|
51
+ # Really elementary progress meter
52
+ progress += segment.length
53
+ count += 1
54
+ puts "Progress: #{(progress.to_f / total.to_f) * 100}%" if count % 300 == 0
55
+
56
+ # Write out to the destination file
57
+ destination.write(segment)
58
+ end
59
+ end
60
+ end
61
+
62
+ destination.close
63
+
64
+ # Check the checksum of the new file to verify that it
65
+ # downloaded properly. This shouldn't happen, but it can!
66
+ if checksum.checksum != box["checksum"]
67
+ puts "Checksum didn't match! Download was corrupt!"
68
+ abort
69
+ end
70
+ end
71
+ end
72
+
73
+ desc "Generates the configuration for acceptance tests from current source."
74
+ task :config, :box_dir do |t, args|
75
+ require File.expand_path("../../lib/vagrant/version", __FILE__)
76
+ require File.expand_path('../../test/support/tempdir', __FILE__)
77
+
78
+ # Get the directory for the boxes
79
+ box_dir = Pathname.new(args[:box_dir] || File.expand_path("../../boxes", __FILE__))
80
+
81
+ # Generate the binstubs for the Vagrant binary
82
+ tempdir = Tempdir.new
83
+ process = ChildProcess.build("bundle", "install", "--binstubs", tempdir.path)
84
+ process.io.inherit!
85
+ process.start
86
+ process.poll_for_exit(64000)
87
+ if process.exit_code != 0
88
+ # Bundle install failed...
89
+ puts "Bundle install failed!"
90
+ abort
91
+ end
92
+
93
+ # Generate the actual configuration
94
+ config = {
95
+ "vagrant_path" => File.join(tempdir.path, "vagrant"),
96
+ "vagrant_version" => Vagrant::VERSION,
97
+ "env" => {
98
+ "BUNDLE_GEMFILE" => File.expand_path("../../Gemfile", __FILE__)
99
+ },
100
+ "box_directory" => box_dir.to_s
101
+ }
102
+
103
+ File.open("acceptance_config.yml", "w+") do |f|
104
+ f.write(YAML.dump(config))
105
+ end
106
+
107
+ puts <<-OUTPUT
108
+ Acceptance test configuration is now in this directory in
109
+ "acceptance_config.yml." Set your ACCEPTANCE_CONFIG environmental
110
+ variable to this file and run any of the acceptance tests now.
111
+ OUTPUT
112
+ end
113
+ end
@@ -0,0 +1,3 @@
1
+ # This installs the tasks that help with gem creation and
2
+ # publishing.
3
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,20 @@
1
+ require 'rake/testtask'
2
+ require 'rspec/core/rake_task'
3
+
4
+ namespace :test do
5
+ RSpec::Core::RakeTask.new do |t|
6
+ t.name = "unit"
7
+ t.pattern = "test/unit/**/*_test.rb"
8
+ end
9
+
10
+ Rake::TestTask.new do |t|
11
+ t.name = "unit_old"
12
+ t.libs << "test/unit_legacy"
13
+ t.pattern = "test/unit_legacy/**/*_test.rb"
14
+ end
15
+
16
+ RSpec::Core::RakeTask.new do |t|
17
+ t.name = "acceptance"
18
+ t.pattern = "test/acceptance/**/*_test.rb"
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ Vagrant::Config.run do |config|
2
+ # This Vagrantfile is auto-generated by `vagrant package` to contain
3
+ # the MAC address of the box. Custom configuration should be placed in
4
+ # the actual `Vagrantfile` in this box.
5
+ config.vm.base_mac = "<%= base_mac %>"
6
+ end
7
+
8
+ # Load include vagrant file if it exists after the auto-generated
9
+ # so it can override any of the settings
10
+ include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
11
+ load include_vagrantfile if File.exist?(include_vagrantfile)
@@ -0,0 +1,9 @@
1
+ # This file loads the proper rgloader/loader.rb file that comes packaged
2
+ # with Vagrant so that encoded files can properly run with Vagrant.
3
+
4
+ if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
5
+ require File.expand_path(
6
+ "rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
7
+ else
8
+ raise "Encoded files can't be read outside of the Vagrant installer."
9
+ end
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.add_development_dependency "rspec-mocks", "~> 2.11.0"
33
33
 
34
34
  root_path = File.dirname(__FILE__)
35
- all_files = Dir.chdir(root_path) { Dir.glob("**/{bin,config,keys,lib,plugins,tasks,templates,test}") }
35
+ all_files = Dir.chdir(root_path) { Dir.glob("{bin,config,keys,lib,plugins,tasks,templates,test}/**") }
36
36
  all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
37
37
  all_files += %w(CHANGELOG.md CONTRIBUTING.md Gemfile LICENSE README.md tnargav.gemspec)
38
38
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tnargav
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -225,10 +225,23 @@ description: Vagrant is a tool for building and distributing virtualized develop
225
225
  email:
226
226
  - mitchell.hashimoto@gmail.com
227
227
  - john.m.bender@gmail.com
228
- executables: []
228
+ executables:
229
+ - vagrant
229
230
  extensions: []
230
231
  extra_rdoc_files: []
231
232
  files:
233
+ - bin/vagrant
234
+ - config/default.rb
235
+ - keys/README.md
236
+ - keys/vagrant
237
+ - keys/vagrant.pub
238
+ - lib/vagrant.rb
239
+ - plugins/README.md
240
+ - tasks/acceptance.rake
241
+ - tasks/bundler.rake
242
+ - tasks/test.rake
243
+ - templates/package_Vagrantfile.erb
244
+ - templates/rgloader.rb
232
245
  - CHANGELOG.md
233
246
  - CONTRIBUTING.md
234
247
  - Gemfile