Module: ChefDK::Helpers

Instance Method Summary collapse

Instance Method Details

#err(message) ⇒ Object



33
34
35
# File 'lib/chef-dk/helpers.rb', line 33

def err(message)
  stderr.print("#{message}\n")
end

#msg(message) ⇒ Object



37
38
39
# File 'lib/chef-dk/helpers.rb', line 37

def msg(message)
  stdout.print("#{message}\n")
end

#omnibus_apps_dirObject



61
62
63
# File 'lib/chef-dk/helpers.rb', line 61

def omnibus_apps_dir
  @ominbus_apps_dir ||= omnibus_expand_path(omnibus_root, "embedded", "apps")
end

#omnibus_bin_dirObject



65
66
67
# File 'lib/chef-dk/helpers.rb', line 65

def omnibus_bin_dir
  @omnibus_bin_dir ||= omnibus_expand_path(omnibus_root, "bin")
end

#omnibus_chefdk_locationObject



73
74
75
# File 'lib/chef-dk/helpers.rb', line 73

def omnibus_chefdk_location
  @omnibus_chefdk_location ||= File.expand_path('embedded/apps/chef-dk', expected_omnibus_root)
end

#omnibus_embedded_bin_dirObject



69
70
71
# File 'lib/chef-dk/helpers.rb', line 69

def omnibus_embedded_bin_dir
  @omnibus_embedded_bin_dir ||= omnibus_expand_path(omnibus_root, "embedded", "bin")
end

#omnibus_install?Boolean

Locates the omnibus directories

Returns:

  • (Boolean)


53
54
55
# File 'lib/chef-dk/helpers.rb', line 53

def omnibus_install?
  File.exist?(omnibus_chefdk_location)
end

#omnibus_rootObject



57
58
59
# File 'lib/chef-dk/helpers.rb', line 57

def omnibus_root
  @omnibus_root ||= omnibus_expand_path(expected_omnibus_root)
end

#stderrObject



45
46
47
# File 'lib/chef-dk/helpers.rb', line 45

def stderr
  $stderr
end

#stdoutObject



41
42
43
# File 'lib/chef-dk/helpers.rb', line 41

def stdout
  $stdout
end

#system_command(*command_args) ⇒ Object

Runs given commands using mixlib-shellout



27
28
29
30
31
# File 'lib/chef-dk/helpers.rb', line 27

def system_command(*command_args)
  cmd = Mixlib::ShellOut.new(*command_args)
  cmd.run_command
  cmd
end