lib/cloudstrap/config.rb in cloudstrap-0.42.4.pre vs lib/cloudstrap/config.rb in cloudstrap-0.42.9.pre

- old
+ new

@@ -89,11 +89,40 @@ Contract None => String def ssh_username lookup(:ssh_username) { 'ubuntu' } end + Contract None => Enum['dev', 'release'] + def channel + lookup(:channel) { 'release' } + end + Contract None => String + def artifact_origin + lookup(:artifact_origin) do + case channel + when 'release' + 'release.stackato.com' + when 'dev' + 'dev.stackato.com' + end + end + end + + Contract None => String + def artifact_prefix + lookup(:artifact_prefix) { '/downloads' } + end + + Contract None => String + def hcp_prefix + lookup(:hcp_prefix) do + "#{artifact_prefix}/hcp" + end.squeeze('/') + end + + Contract None => String def hcp_dir @hcp_dir ||= File.expand_path(ENV.fetch('BOOTSTRAP_HCP_DIR') { dir }) end Contract None => String @@ -111,10 +140,16 @@ alias hcp_version hcp_bootstrap_version Contract None => String def hcp_bootstrap_package_url lookup(:hcp_bootstrap_package_url) do - "#{hcp_origin}/hcp-bootstrap_#{hcp_version.gsub('+', '%2B')}_amd64.deb" + version = hcp_bootstrap_version.gsub('+', '%2B') + 'https://' + [ + artifact_origin, + hcp_prefix, + 'bootstrap', + "hcp-bootstrap_#{version}_amd64.deb" + ].join('/').squeeze('/') end end alias hcp_package_url hcp_bootstrap_package_url