Class: Jekyll::GitHubMetadata::Pages
- Inherits:
-
Object
- Object
- Jekyll::GitHubMetadata::Pages
- Defined in:
- lib/jekyll-github-metadata/pages.rb
Constant Summary collapse
- DEFAULTS =
{ "PAGES_ENV" => "development".freeze, "PAGES_API_URL" => "https://api.github.com".freeze, "PAGES_HELP_URL" => "https://help.github.com".freeze, "PAGES_GITHUB_HOSTNAME" => "github.com".freeze, "PAGES_PAGES_HOSTNAME" => "github.io".freeze, "SSL" => "false".freeze, "SUBDOMAIN_ISOLATION" => "false".freeze, "PAGES_PREVIEW_HTML_URL" => nil, "PAGE_BUILD_ID" => nil, }.freeze
Class Method Summary collapse
- .api_url ⇒ Object
- .configuration ⇒ Object
- .custom_domains_enabled? ⇒ Boolean
- .development? ⇒ Boolean
- .dotcom? ⇒ Boolean
- .enterprise? ⇒ Boolean
- .env ⇒ Object
- .github_hostname ⇒ Object
- .github_url ⇒ Object
- .help_url ⇒ Object
- .page_build? ⇒ Boolean
- .pages_hostname ⇒ Object
- .repo_pages_html_url_preview? ⇒ Boolean
- .scheme ⇒ Object
-
.ssl? ⇒ Boolean
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.
- .subdomain_isolation? ⇒ Boolean
- .test? ⇒ Boolean
Class Method Details
.api_url ⇒ Object
61 62 63 |
# File 'lib/jekyll-github-metadata/pages.rb', line 61 def api_url trim_last_slash env_var("PAGES_API_URL", ENV["API_URL"]) end |
.configuration ⇒ Object
83 84 85 86 87 |
# File 'lib/jekyll-github-metadata/pages.rb', line 83 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? ⇒ Boolean
41 42 43 |
# File 'lib/jekyll-github-metadata/pages.rb', line 41 def custom_domains_enabled? dotcom? || test? end |
.development? ⇒ Boolean
39 |
# File 'lib/jekyll-github-metadata/pages.rb', line 39 def development?; env == "development" end |
.dotcom? ⇒ Boolean
35 |
# File 'lib/jekyll-github-metadata/pages.rb', line 35 def dotcom?; env == "dotcom" end |
.enterprise? ⇒ Boolean
37 |
# File 'lib/jekyll-github-metadata/pages.rb', line 37 def enterprise?; env == "enterprise" end |
.env ⇒ Object
45 46 47 |
# File 'lib/jekyll-github-metadata/pages.rb', line 45 def env env_var "PAGES_ENV", ENV["JEKYLL_ENV"] end |
.github_hostname ⇒ Object
69 70 71 |
# File 'lib/jekyll-github-metadata/pages.rb', line 69 def github_hostname trim_last_slash env_var("PAGES_GITHUB_HOSTNAME", ENV["GITHUB_HOSTNAME"]) end |
.github_url ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/jekyll-github-metadata/pages.rb', line 53 def github_url if dotcom? "https://github.com".freeze else "#{scheme}://#{github_hostname}" end end |
.help_url ⇒ Object
65 66 67 |
# File 'lib/jekyll-github-metadata/pages.rb', line 65 def help_url trim_last_slash env_var("PAGES_HELP_URL", ENV["HELP_URL"]) end |
.page_build? ⇒ Boolean
79 80 81 |
# File 'lib/jekyll-github-metadata/pages.rb', line 79 def page_build? !env_var("PAGE_BUILD_ID").to_s.empty? end |
.pages_hostname ⇒ Object
73 74 75 76 77 |
# File 'lib/jekyll-github-metadata/pages.rb', line 73 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? ⇒ Boolean
49 50 51 |
# File 'lib/jekyll-github-metadata/pages.rb', line 49 def repo_pages_html_url_preview? env_var "PAGES_PREVIEW_HTML_URL" end |
.scheme ⇒ Object
25 26 27 |
# File 'lib/jekyll-github-metadata/pages.rb', line 25 def scheme ssl? ? "https" : "http" end |
.ssl? ⇒ Boolean
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
21 22 23 |
# File 'lib/jekyll-github-metadata/pages.rb', line 21 def ssl? env_var("SSL") == "true" || test? end |
.subdomain_isolation? ⇒ Boolean
29 30 31 |
# File 'lib/jekyll-github-metadata/pages.rb', line 29 def subdomain_isolation? env_var("SUBDOMAIN_ISOLATION").eql? "true" end |
.test? ⇒ Boolean
33 |
# File 'lib/jekyll-github-metadata/pages.rb', line 33 def test?; env == "test" end |