Class: ChefDK::Command::Env
- Inherits:
-
Base
- Object
- Base
- ChefDK::Command::Env
show all
- Defined in:
- lib/chef-dk/command/env.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#check_license_acceptance, #needs_help?, #needs_version?, #run_with_default_options
Methods included from Helpers
#chefdk_home, #err, #git_bin_dir, #git_windows_bin_dir, #msg, #omnibus_apps_dir, #omnibus_bin_dir, #omnibus_chefdk_location, #omnibus_embedded_bin_dir, #omnibus_env, #omnibus_install?, #omnibus_root, #stderr, #stdout, #system_command, #usr_bin_path, #usr_bin_prefix
Constructor Details
#initialize(*args) ⇒ Env
Returns a new instance of Env.
33
34
35
36
|
# File 'lib/chef-dk/command/env.rb', line 33
def initialize(*args)
super
@ui = UI.new
end
|
Instance Attribute Details
#ui ⇒ Object
Returns the value of attribute ui.
31
32
33
|
# File 'lib/chef-dk/command/env.rb', line 31
def ui
@ui
end
|
Instance Method Details
#chefdk_info ⇒ Object
48
49
50
51
52
53
54
55
|
# File 'lib/chef-dk/command/env.rb', line 48
def chefdk_info
{}.tap do |chefdk|
chefdk["ChefDK Version"] = ChefDK::VERSION
chefdk["ChefDK Home"] = chefdk_home
chefdk["ChefDK Install Directory"] = omnibus_root
chefdk["Policyfile Config"] = policyfile_config
end
end
|
#gem_environment ⇒ Object
69
70
71
72
73
74
75
|
# File 'lib/chef-dk/command/env.rb', line 69
def gem_environment
{}.tap do |h|
h["GEM ROOT"] = omnibus_env["GEM_ROOT"]
h["GEM HOME"] = omnibus_env["GEM_HOME"]
h["GEM PATHS"] = omnibus_env["GEM_PATH"].split(File::PATH_SEPARATOR)
end
end
|
#paths ⇒ Object
77
78
79
|
# File 'lib/chef-dk/command/env.rb', line 77
def paths
omnibus_env["PATH"].split(File::PATH_SEPARATOR)
end
|
#policyfile_config ⇒ Object
81
82
83
84
85
86
|
# File 'lib/chef-dk/command/env.rb', line 81
def policyfile_config
{}.tap do |h|
h["Cache Path"] = CookbookOmnifetch.cache_path
h["Storage Path"] = CookbookOmnifetch.storage_path.to_s
end
end
|
#ruby_info ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/chef-dk/command/env.rb', line 57
def ruby_info
{}.tap do |ruby|
ruby["Ruby Executable"] = Gem.ruby
ruby["Ruby Version"] = RUBY_VERSION
ruby["RubyGems"] = {}.tap do |rubygems|
rubygems["RubyGems Version"] = Gem::VERSION
rubygems["RubyGems Platforms"] = Gem.platforms.map(&:to_s)
rubygems["Gem Environment"] = gem_environment
end
end
end
|
#run(params) ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'lib/chef-dk/command/env.rb', line 38
def run(params)
info = {}
info["#{ChefDK::Dist::PRODUCT}"] = {}.tap do |chefdk_env|
chefdk_env["ChefDK"] = chefdk_info
chefdk_env["Ruby"] = ruby_info
chefdk_env["Path"] = paths
end
ui.msg info.to_yaml
end
|