class Jekyll::GitHubMetadata::Pages

Constants

DEFAULTS

Public Class Methods

api_url() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 71
def api_url
  trim_last_slash env_var("PAGES_API_URL", ENV["API_URL"])
end
configuration() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 93
def configuration
  (methods - Object.methods - [:configuration]).sort.each_with_object({}) do |meth, memo|
    memo[meth.to_s] = public_send(meth)
  end
end
custom_domains_enabled?() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 51
def custom_domains_enabled?
  dotcom? || test?
end
development?() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 47
def development?
  env == "development"
end
dotcom?() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 39
def dotcom?
  env == "dotcom"
end
enterprise?() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 43
def enterprise?
  env == "enterprise"
end
env() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 55
def env
  env_var "PAGES_ENV", ENV["JEKYLL_ENV"]
end
github_hostname() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 79
def github_hostname
  trim_last_slash env_var("PAGES_GITHUB_HOSTNAME", ENV["GITHUB_HOSTNAME"])
end
github_url() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 63
def github_url
  if dotcom? || github_hostname == "github.com"
    "https://github.com"
  else
    "#{scheme}://#{github_hostname}"
  end
end
help_url() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 75
def help_url
  trim_last_slash env_var("PAGES_HELP_URL", ENV["HELP_URL"])
end
page_build?() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 89
def page_build?
  !env_var("PAGE_BUILD_ID").to_s.empty?
end
pages_hostname() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 83
def pages_hostname
  intermediate_default = ENV["PAGES_HOSTNAME"]
  intermediate_default ||= "localhost:4000" if development?
  trim_last_slash env_var("PAGES_PAGES_HOSTNAME", intermediate_default)
end
repo_pages_html_url_preview?() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 59
def repo_pages_html_url_preview?
  env_var "PAGES_PREVIEW_HTML_URL"
end
scheme() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 27
def scheme
  ssl? ? "https" : "http"
end
ssl?() click to toggle source

Whether the GitHub instance supports HTTPS Note: this will be the same as how sites are served in Enterprise, but may be different from how sites are served on GitHub.com. See Repository#url_scheme

# File lib/jekyll-github-metadata/pages.rb, line 23
def ssl?
  env_var("SSL") == "true" || test?
end
subdomain_isolation?() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 31
def subdomain_isolation?
  env_var("SUBDOMAIN_ISOLATION").eql? "true"
end
test?() click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 35
def test?
  env == "test"
end

Private Class Methods

env_var(key, intermediate_default = nil) click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 101
def env_var(key, intermediate_default = nil)
  !ENV[key].to_s.empty? ? ENV[key] : (intermediate_default || DEFAULTS[key])
end
trim_last_slash(url) click to toggle source
# File lib/jekyll-github-metadata/pages.rb, line 105
def trim_last_slash(url)
  if url[-1] == "/"
    url[0..-2]
  else
    url
  end
end