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, #install_sh_from_upstream
Class Method Details
40
41
42
43
44
45
|
# File 'lib/mixlib/install/generator/powershell.rb', line 40
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
34
35
36
37
38
|
# 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"), "Installer-Module")
if context[:license_id] && !context[:license_id].to_s.empty?
install_command << "# License ID provided via context - adding to install command"
install_command << "install -license_id '#{context[:license_id]}'"
end
install_command.join("\n\n")
end
|
.ps1_modularize(module_body, module_name) ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/mixlib/install/generator/powershell.rb', line 62
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
47
48
49
|
# File 'lib/mixlib/install/generator/powershell.rb', line 47
def self.script_base_path
File.join(File.dirname(__FILE__), "powershell/scripts")
end
|
Instance Method Details
#install_command ⇒ Object
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/mixlib/install/generator/powershell.rb', line 51
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"), "Installer-Module")
install_command << render_command
install_command.join("\n\n")
end
|
#install_command_params ⇒ Object
84
85
86
|
# File 'lib/mixlib/install/generator/powershell.rb', line 84
def install_command_params
options.install_command_options.map { |key, value| " -#{key} '#{value}'" }.join
end
|
#ps1_modularize(module_body, module_name) ⇒ Object
70
71
72
|
# File 'lib/mixlib/install/generator/powershell.rb', line 70
def ps1_modularize(module_body, module_name)
self.class.ps1_modularize(module_body, module_name)
end
|
#render_command ⇒ Object
74
75
76
77
78
79
80
81
82
|
# File 'lib/mixlib/install/generator/powershell.rb', line 74
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 << " -license_id #{options.license_id}" if options.license_id && !options.license_id.to_s.empty?
cmd << install_command_params if options.install_command_options
cmd << "\n"
end
|