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")
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
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
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
#artifactory_urls ⇒ Object
74
75
76
77
|
# File 'lib/mixlib/install/generator/powershell.rb', line 74
def artifactory_urls
get_script("get_project_metadata_for_artifactory.ps1",
artifacts: artifacts)
end
|
#install_command ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/mixlib/install/generator/powershell.rb', line 46
def install_command
install_project_module = []
install_project_module << get_script("helpers.ps1")
install_project_module << if options.for_artifactory?
artifactory_urls
else
get_script("get_project_metadata.ps1")
end
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
|
#product_version ⇒ Object
83
84
85
86
87
88
89
|
# File 'lib/mixlib/install/generator/powershell.rb', line 83
def product_version
if options.for_artifactory?
artifacts.first.version
else
options.product_version
end
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
91
92
93
94
95
96
97
|
# File 'lib/mixlib/install/generator/powershell.rb', line 91
def render_command
cmd = "install -project #{options.product_name}"
cmd << " -version #{product_version}"
cmd << " -channel #{options.channel}"
cmd << " -architecture #{options.architecture}" if options.architecture
cmd << "\n"
end
|