mirror of https://github.com/hashicorp/packer
parent
cd23c39064
commit
37eb3043f5
@ -1,13 +1,3 @@
|
||||
source "https://rubygems.org"
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem "less", "~> 2.6"
|
||||
gem "middleman", "~> 3.3"
|
||||
gem "middleman-minify-html", "~> 3.4"
|
||||
gem "rack-contrib", "~> 1.1"
|
||||
gem "redcarpet", "~> 3.1"
|
||||
gem "therubyracer", "~> 0.12"
|
||||
gem "thin", "~> 1.6"
|
||||
|
||||
group :development do
|
||||
gem "highline", "~> 1.6"
|
||||
end
|
||||
gem 'middleman-hashicorp', github: 'hashicorp/middleman-hashicorp'
|
||||
|
||||
@ -1,93 +1,10 @@
|
||||
require "net/http"
|
||||
|
||||
raise "PACKER_VERSION must be set." if !ENV["PACKER_VERSION"]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Download the list of Packer downloads
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
$packer_files = {}
|
||||
$packer_os = []
|
||||
|
||||
if !ENV["PACKER_DISABLE_DOWNLOAD_FETCH"]
|
||||
raise "BINTRAY_API_KEY must be set." if !ENV["BINTRAY_API_KEY"]
|
||||
http = Net::HTTP.new("dl.bintray.com", 80)
|
||||
req = Net::HTTP::Get.new("/mitchellh/packer/")
|
||||
req.basic_auth "mitchellh", ENV["BINTRAY_API_KEY"]
|
||||
response = http.request(req)
|
||||
|
||||
response.body.split("\n").each do |line|
|
||||
next if line !~ /\/mitchellh\/packer\/packer_(#{Regexp.quote(ENV["PACKER_VERSION"])}.+?)'/
|
||||
filename = $1.to_s
|
||||
os = filename.split("_")[1]
|
||||
next if os == "SHA256SUMS"
|
||||
|
||||
$packer_files[os] ||= []
|
||||
$packer_files[os] << filename
|
||||
end
|
||||
|
||||
$packer_os = ["darwin", "linux", "windows"] & $packer_files.keys
|
||||
$packer_os += $packer_files.keys
|
||||
$packer_os.uniq!
|
||||
|
||||
$packer_files.each do |key, value|
|
||||
value.sort!
|
||||
end
|
||||
end
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Configure Middleman
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
set :css_dir, 'stylesheets'
|
||||
set :js_dir, 'javascripts'
|
||||
set :images_dir, 'images'
|
||||
|
||||
# Use the RedCarpet Markdown engine
|
||||
set :markdown_engine, :redcarpet
|
||||
set :markdown,
|
||||
:fenced_code_blocks => true,
|
||||
:with_toc_data => true
|
||||
|
||||
# Build-specific configuration
|
||||
configure :build do
|
||||
activate :asset_hash
|
||||
activate :minify_css
|
||||
activate :minify_html
|
||||
activate :minify_javascript
|
||||
end
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Helpers
|
||||
#-------------------------------------------------------------------------
|
||||
helpers do
|
||||
def download_arch(file)
|
||||
parts = file.split("_")
|
||||
return "" if parts.length != 3
|
||||
parts[2].split(".")[0]
|
||||
end
|
||||
|
||||
def download_os_human(os)
|
||||
if os == "darwin"
|
||||
return "Mac OS X"
|
||||
elsif os == "freebsd"
|
||||
return "FreeBSD"
|
||||
elsif os == "openbsd"
|
||||
return "OpenBSD"
|
||||
elsif os == "Linux"
|
||||
return "Linux"
|
||||
elsif os == "windows"
|
||||
return "Windows"
|
||||
else
|
||||
return os
|
||||
end
|
||||
end
|
||||
|
||||
def download_url(file)
|
||||
"https://dl.bintray.com/mitchellh/packer/packer_#{file}"
|
||||
end
|
||||
|
||||
def latest_version
|
||||
ENV["PACKER_VERSION"]
|
||||
end
|
||||
activate :hashicorp do |h|
|
||||
h.version = '0.7.1'
|
||||
h.bintray_repo = 'mitchellh/packer'
|
||||
h.bintray_user = 'mitchellh'
|
||||
h.bintray_key = ENV['BINTRAY_API_KEY']
|
||||
end
|
||||
|
||||
Loading…
Reference in new issue