vagrant/plugins/provisioners/chef/omnibus.rb

40 lines
1.0 KiB
Ruby
Raw Normal View History

module VagrantPlugins
module Chef
2015-11-19 23:01:09 +00:00
# Read more about the Omnibus installer here:
#
# https://docs.chef.io/install_omnibus.html
#
module Omnibus
2015-11-19 23:01:09 +00:00
OMNITRUCK = "https://omnitruck.chef.io".freeze
2015-11-19 23:01:09 +00:00
def sh_command(project, version, channel, options = {})
2016-01-05 14:23:22 +00:00
command = "curl -sL #{OMNITRUCK}/install.sh | bash"
2015-11-19 23:01:09 +00:00
command << " -s -- -P \"#{project}\" -c \"#{channel}\""
2015-11-19 23:01:09 +00:00
if version != :latest
command << " -v \"#{version}\""
end
2015-11-19 23:01:09 +00:00
if options[:download_path]
command << " -d \"#{options[:download_path]}\""
end
2015-11-19 23:01:09 +00:00
command
end
module_function :sh_command
2015-11-19 23:01:09 +00:00
def ps_command(project, version, channel, options = {})
command = ". { iwr -useb #{OMNITRUCK}/install.ps1 } | iex; install"
command << " -project '#{project}' -channel '#{channel}'"
if version != :latest
command << " -version '#{version}'"
end
command
end
2015-11-19 23:01:09 +00:00
module_function :ps_command
end
end
end