Class: Mixlib::Install::Generator::PowerShell
- Inherits:
-
Base
- Object
- Base
- Mixlib::Install::Generator::PowerShell
show all
- Defined in:
- lib/mixlib/install/generator/powershell.rb
Instance Attribute Summary
Attributes inherited from Base
#options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#get_script, get_script, #initialize
Class Method Details
35
36
37
38
39
40
|
# 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) ⇒ Object
24
25
26
27
28
29
30
31
32
33
|
# 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) ⇒ Object
57
58
59
60
61
62
63
|
# 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 ⇒ Object
42
43
44
|
# File 'lib/mixlib/install/generator/powershell.rb', line 42
def self.script_base_path
File.join(File.dirname(__FILE__), "powershell/scripts")
end
|
Instance Method Details
#install_command ⇒ Object
46
47
48
49
50
51
52
53
54
55
|
# 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.)
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 ⇒ Object
78
79
80
|
# 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) ⇒ Object
65
66
67
|
# 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 ⇒ Object
69
70
71
72
73
74
75
76
|
# 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
|