2016-01-19 18:08:53 +00:00
|
|
|
set :base_url, "https://www.vagrantup.com/"
|
|
|
|
|
2018-02-20 19:56:40 +00:00
|
|
|
set :vmware_utility_name, "vagrant-vmware-utility"
|
2018-10-27 00:06:57 +00:00
|
|
|
set :vmware_utility_version, "1.0.5"
|
2018-02-20 19:56:40 +00:00
|
|
|
|
2016-01-19 18:08:53 +00:00
|
|
|
activate :hashicorp do |h|
|
2017-03-28 01:19:52 +00:00
|
|
|
h.name = "vagrant"
|
2018-11-15 23:20:54 +00:00
|
|
|
h.version = "2.2.1"
|
2017-11-03 03:52:59 +00:00
|
|
|
h.github_slug = "hashicorp/vagrant"
|
2017-03-28 01:19:52 +00:00
|
|
|
h.website_root = "website"
|
2016-01-19 18:08:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
helpers do
|
2018-03-08 20:48:43 +00:00
|
|
|
# Returns a segment tracking ID such that local development is not
|
|
|
|
# tracked to production systems.
|
|
|
|
def segmentId()
|
|
|
|
if (ENV['ENV'] == 'production')
|
|
|
|
'wFMyBE4PJCZttWfu0pNhYdWr7ygW0io4'
|
|
|
|
else
|
|
|
|
'0EXTgkNx0Ydje2PGXVbRhpKKoe5wtzcE'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-04-06 22:11:50 +00:00
|
|
|
# Returns the FQDN of the image URL.
|
|
|
|
#
|
|
|
|
# @param [String] path
|
|
|
|
#
|
|
|
|
# @return [String]
|
|
|
|
def image_url(path)
|
|
|
|
File.join(base_url, image_path(path))
|
|
|
|
end
|
|
|
|
|
2017-03-28 01:19:52 +00:00
|
|
|
# Get the title for the page.
|
|
|
|
#
|
|
|
|
# @param [Middleman::Page] page
|
|
|
|
#
|
|
|
|
# @return [String]
|
|
|
|
def title_for(page)
|
|
|
|
if page && page.data.page_title
|
|
|
|
return "#{page.data.page_title} - Vagrant by HashiCorp"
|
|
|
|
end
|
|
|
|
|
|
|
|
"Vagrant by HashiCorp"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Get the description for the page
|
|
|
|
#
|
|
|
|
# @param [Middleman::Page] page
|
|
|
|
#
|
|
|
|
# @return [String]
|
|
|
|
def description_for(page)
|
|
|
|
description = (page.data.description || "")
|
|
|
|
.gsub('"', '')
|
|
|
|
.gsub(/\n+/, ' ')
|
|
|
|
.squeeze(' ')
|
|
|
|
|
|
|
|
return escape_html(description)
|
|
|
|
end
|
|
|
|
|
2016-01-19 18:08:53 +00:00
|
|
|
# This helps by setting the "active" class for sidebar nav elements
|
|
|
|
# if the YAML frontmatter matches the expected value.
|
|
|
|
def sidebar_current(expected)
|
|
|
|
current = current_page.data.sidebar_current || ""
|
|
|
|
if current.start_with?(expected)
|
|
|
|
return " class=\"active\""
|
|
|
|
else
|
|
|
|
return ""
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-03-28 01:19:52 +00:00
|
|
|
# Returns the id for this page.
|
|
|
|
# @return [String]
|
|
|
|
def body_id_for(page)
|
|
|
|
if !(name = page.data.sidebar_current).blank?
|
|
|
|
return "page-#{name.strip}"
|
|
|
|
end
|
|
|
|
if page.url == "/" || page.url == "/index.html"
|
|
|
|
return "page-home"
|
|
|
|
end
|
|
|
|
if !(title = page.data.page_title).blank?
|
|
|
|
return title
|
|
|
|
.downcase
|
|
|
|
.gsub('"', '')
|
|
|
|
.gsub(/[^\w]+/, '-')
|
|
|
|
.gsub(/_+/, '-')
|
|
|
|
.squeeze('-')
|
|
|
|
.squeeze(' ')
|
|
|
|
end
|
|
|
|
return ""
|
2016-01-19 18:08:53 +00:00
|
|
|
end
|
|
|
|
|
2017-03-28 01:19:52 +00:00
|
|
|
# Returns the list of classes for this page.
|
|
|
|
# @return [String]
|
|
|
|
def body_classes_for(page)
|
2016-01-19 18:08:53 +00:00
|
|
|
classes = []
|
|
|
|
|
2017-03-28 01:19:52 +00:00
|
|
|
if !(layout = page.data.layout).blank?
|
|
|
|
classes << "layout-#{page.data.layout}"
|
2016-01-19 18:08:53 +00:00
|
|
|
end
|
|
|
|
|
2017-03-28 01:19:52 +00:00
|
|
|
if !(title = page.data.page_title).blank?
|
|
|
|
title = title
|
|
|
|
.downcase
|
|
|
|
.gsub('"', '')
|
|
|
|
.gsub(/[^\w]+/, '-')
|
|
|
|
.gsub(/_+/, '-')
|
|
|
|
.squeeze('-')
|
|
|
|
.squeeze(' ')
|
|
|
|
classes << "page-#{title}"
|
2016-01-19 18:08:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return classes.join(" ")
|
|
|
|
end
|
|
|
|
end
|