core: add Checkpoint
This commit is contained in:
parent
ba41ab956c
commit
09d2b6fd86
|
@ -4,6 +4,7 @@ require 'pathname'
|
|||
require 'set'
|
||||
require 'thread'
|
||||
|
||||
require "checkpoint"
|
||||
require 'log4r'
|
||||
|
||||
require 'vagrant/util/file_mode'
|
||||
|
@ -125,6 +126,18 @@ module Vagrant
|
|||
# Prepare the directories
|
||||
setup_home_path
|
||||
|
||||
# Run checkpoint in a background thread on every environment
|
||||
# initialization. The cache file will cause this to mostly be a no-op
|
||||
# most of the time.
|
||||
@checkpoint_thr = Thread.new do
|
||||
@checkpoint_result = Checkpoint.check(
|
||||
product: "vagrant",
|
||||
version: VERSION,
|
||||
signature_file: @data_dir.join("checkpoint_signature"),
|
||||
cache_file: @data_dir.join("checkpoint_cache"),
|
||||
)
|
||||
end
|
||||
|
||||
# Setup the local data directory. If a configuration path is given,
|
||||
# then it is expanded relative to the working directory. Otherwise,
|
||||
# we use the default which is expanded relative to the root path.
|
||||
|
@ -243,6 +256,16 @@ module Vagrant
|
|||
end
|
||||
end
|
||||
|
||||
# Checkpoint returns the checkpoint result data. If checkpoint is
|
||||
# disabled, this will return nil. See the hashicorp-checkpoint gem
|
||||
# for more documentation on the return value.
|
||||
#
|
||||
# @return [Hash]
|
||||
def checkpoint
|
||||
@checkpoint_thr.join
|
||||
return @checkpoint_result
|
||||
end
|
||||
|
||||
# Makes a call to the CLI with the given arguments as if they
|
||||
# came from the real command line (sometimes they do!). An example:
|
||||
#
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
require "tmpdir"
|
||||
require "rubygems"
|
||||
|
||||
# Gems
|
||||
require "checkpoint"
|
||||
require "rspec/autorun"
|
||||
|
||||
# Require Vagrant itself so we can reference the proper
|
||||
|
@ -49,3 +52,6 @@ Vagrant.plugin("2").manager.registered.dup.each do |plugin|
|
|||
Vagrant.plugin("2").manager.unregister(plugin)
|
||||
end
|
||||
end
|
||||
|
||||
# Disable checkpoint
|
||||
Checkpoint.disable!
|
||||
|
|
|
@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|||
s.add_dependency "erubis", "~> 2.7.0"
|
||||
s.add_dependency "i18n", "~> 0.6.0"
|
||||
s.add_dependency "listen", "~> 2.7.1"
|
||||
s.add_dependency "hashicorp-checkpoint", "~> 0.1.1"
|
||||
s.add_dependency "log4r", "~> 1.1.9", "< 1.1.11"
|
||||
s.add_dependency "net-ssh", ">= 2.6.6", "< 2.10.0"
|
||||
s.add_dependency "net-scp", "~> 1.1.0"
|
||||
|
|
Loading…
Reference in New Issue