Module: VagrantPlugins::ChefZero

Defined in:
lib/vagrant-chef-zero.rb,
lib/vagrant-chef-zero/env.rb,
lib/vagrant-chef-zero/action.rb,
lib/vagrant-chef-zero/config.rb,
lib/vagrant-chef-zero/plugin.rb,
lib/vagrant-chef-zero/version.rb,
lib/vagrant-chef-zero/action/stop.rb,
lib/vagrant-chef-zero/env_helpers.rb,
lib/vagrant-chef-zero/action/start.rb,
lib/vagrant-chef-zero/action/upload.rb,
lib/vagrant-chef-zero/server_helpers.rb,
lib/vagrant-chef-zero/action/reconfig.rb

Defined Under Namespace

Modules: Action, EnvHelpers, ServerHelpers Classes: Config, Env, Plugin

Constant Summary collapse

VERSION =
"2.0.0"
NAME =
"vagrant-chef-zero"

Class Method Summary collapse

Class Method Details

.describe(opts = {}) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/vagrant-chef-zero/version.rb', line 6

def self.describe(opts={})
  query = 'git describe --tags --match="v*"'
  args = opts.map do |k, v|
    "--#{k.to_s}=#{v.to_s}"
  end.join(" ")
  `#{query} #{args}`
end

.get_versionObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/vagrant-chef-zero/version.rb', line 20

def self.get_version
  if Gem.loaded_specs.key?(NAME)
    # installed version
    version = Gem.loaded_specs[NAME].version
  elsif ENV['USE_GIT_VERSION'] == "1"
    version = self.git_version()
    if Gem::Version.new(version) < Gem::Version.new(VERSION)
      version = VERSION
    end
  else
    version = VERSION
  end
  version
end

.git_version(options = {}) ⇒ Object



14
15
16
17
18
# File 'lib/vagrant-chef-zero/version.rb', line 14

def self.git_version(options = {})
  version = self.describe(options).chomp
  version.gsub!('-', '.')
  version = version[1..-1] if version.start_with?("v")
end