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
#needs_help?, #needs_version?, #run_with_default_options
Methods included from Helpers
#chefdk_home, #err, #msg, #omnibus_apps_dir, #omnibus_bin_dir, #omnibus_chefdk_location, #omnibus_embedded_bin_dir, #omnibus_install?, #omnibus_root, #stderr, #stdout, #system_command
Constructor Details
#initialize(*args) ⇒ Env
Returns a new instance of Env.
32
33
34
35
|
# File 'lib/chef-dk/command/env.rb', line 32
def initialize(*args)
super
@ui = UI.new
end
|
Instance Attribute Details
#ui ⇒ Object
Returns the value of attribute ui.
30
31
32
|
# File 'lib/chef-dk/command/env.rb', line 30
def ui
@ui
end
|
Instance Method Details
#chefdk_info ⇒ Object
47
48
49
50
51
52
53
54
|
# File 'lib/chef-dk/command/env.rb', line 47
def chefdk_info
Hash.new.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
68
69
70
71
72
73
74
|
# File 'lib/chef-dk/command/env.rb', line 68
def gem_environment
Hash.new.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
76
77
78
|
# File 'lib/chef-dk/command/env.rb', line 76
def paths
omnibus_env['PATH'].split(File::PATH_SEPARATOR)
end
|
#policyfile_config ⇒ Object
80
81
82
83
84
85
|
# File 'lib/chef-dk/command/env.rb', line 80
def policyfile_config
Hash.new.tap do |h|
h['Cache Path'] = CookbookOmnifetch.cache_path
h['Storage Path'] = CookbookOmnifetch.storage_path.to_s
end
end
|
#ruby_info ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/chef-dk/command/env.rb', line 56
def ruby_info
Hash.new.tap do |ruby|
ruby['Ruby Executable'] = Gem.ruby
ruby['Ruby Version'] = RUBY_VERSION
ruby['RubyGems'] = Hash.new.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
37
38
39
40
41
42
43
44
45
|
# File 'lib/chef-dk/command/env.rb', line 37
def run(params)
info = {}
info['Chef Development Kit'] = Hash.new.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
|