Method: PackageCloud::Repository#install_script
- Defined in:
- lib/package_cloud/repository.rb
#install_script(type) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/package_cloud/repository.rb', line 90 def install_script(type) url = urls["install_script"].gsub(/:package_type/, type) # the URL we've obtained above already contains the correct tokens # because the install script URL uses a master token for access, not # your API token, so if we pass @config.base_url in to compute_url, # we'll end up generating a URL like: https://token:@https://token:@... # because @config.base_url has the url with the API token in it and url # has the url (lol) with the master token in it. # # so just pass url in here. url = PackageCloud::Util.compute_url(url, '') script = RestClient.get(url) # persist the script to a tempfile to make it easier to execute file = Tempfile.new('foo') file.write(script) file.close file end |