class Mixlib::Install::Generator::PowerShell

Public Class Methods

detect_platform_ps1() click to toggle source
# File lib/mixlib/install/generator/powershell.rb, line 35
def self.detect_platform_ps1
  detect_platform_command = []
  detect_platform_command << get_script("helpers.ps1")
  detect_platform_command << get_script("platform_detection.ps1")
  detect_platform_command.join("\n\n")
end
install_ps1(context) click to toggle source
# File lib/mixlib/install/generator/powershell.rb, line 24
def self.install_ps1(context)
  install_project_module = []
  install_project_module << get_script("helpers.ps1", context)
  install_project_module << get_script("get_project_metadata.ps1", context)
  install_project_module << get_script("install_project.ps1")

  install_command = []
  install_command << ps1_modularize(install_project_module.join("\n"), "Omnitruck")
  install_command.join("\n\n")
end
ps1_modularize(module_body, module_name) click to toggle source
# File lib/mixlib/install/generator/powershell.rb, line 57
def self.ps1_modularize(module_body, module_name)
  ps1_module = []
  ps1_module << "new-module -name #{module_name} -scriptblock {"
  ps1_module << module_body
  ps1_module << "}"
  ps1_module.join("\n")
end
script_base_path() click to toggle source
# File lib/mixlib/install/generator/powershell.rb, line 42
def self.script_base_path
  File.join(File.dirname(__FILE__), "powershell/scripts")
end

Public Instance Methods

install_command() click to toggle source
# File lib/mixlib/install/generator/powershell.rb, line 46
def install_command
  install_project_module = []
  install_project_module << get_script("helpers.ps1", user_agent_headers: options.user_agent_headers)
  install_project_module << get_script("get_project_metadata.ps1")
  install_project_module << get_script("install_project.ps1")
  install_command = []
  install_command << ps1_modularize(install_project_module.join("\n"), "Omnitruck")
  install_command << render_command
  install_command.join("\n\n")
end
install_command_params() click to toggle source
# File lib/mixlib/install/generator/powershell.rb, line 78
def install_command_params
  options.install_command_options.map { |key, value| " -#{key} '#{value}'" }.join
end
ps1_modularize(module_body, module_name) click to toggle source
# File lib/mixlib/install/generator/powershell.rb, line 65
def ps1_modularize(module_body, module_name)
  self.class.ps1_modularize(module_body, module_name)
end
render_command() click to toggle source
# File lib/mixlib/install/generator/powershell.rb, line 69
def render_command
  cmd = "install -project #{options.product_name}"
  cmd << " -version #{options.product_version}"
  cmd << " -channel #{options.channel}"
  cmd << " -architecture #{options.architecture}" if options.architecture
  cmd << install_command_params if options.install_command_options
  cmd << "\n"
end