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 }.freeze
Class Method Summary collapse
- .api_url ⇒ Object
- .custom_domains_enabled? ⇒ Boolean
- .development? ⇒ Boolean
- .dotcom? ⇒ Boolean
- .enterprise? ⇒ Boolean
- .env ⇒ Object
- .github_hostname ⇒ Object
- .github_url ⇒ Object
- .help_url ⇒ Object
- .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
60 61 62 |
# File 'lib/jekyll-github-metadata/pages.rb', line 60 def api_url trim_last_slash env_var("PAGES_API_URL", ENV["API_URL"]) end |
.custom_domains_enabled? ⇒ Boolean
40 41 42 |
# File 'lib/jekyll-github-metadata/pages.rb', line 40 def custom_domains_enabled? dotcom? || test? end |
.development? ⇒ Boolean
38 |
# File 'lib/jekyll-github-metadata/pages.rb', line 38 def development?; env == "development" end |
.dotcom? ⇒ Boolean
34 |
# File 'lib/jekyll-github-metadata/pages.rb', line 34 def dotcom?; env == "dotcom" end |
.enterprise? ⇒ Boolean
36 |
# File 'lib/jekyll-github-metadata/pages.rb', line 36 def enterprise?; env == "enterprise" end |
.env ⇒ Object
44 45 46 |
# File 'lib/jekyll-github-metadata/pages.rb', line 44 def env env_var "PAGES_ENV", ENV["JEKYLL_ENV"] end |
.github_hostname ⇒ Object
68 69 70 |
# File 'lib/jekyll-github-metadata/pages.rb', line 68 def github_hostname trim_last_slash env_var("PAGES_GITHUB_HOSTNAME", ENV["GITHUB_HOSTNAME"]) end |
.github_url ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/jekyll-github-metadata/pages.rb', line 52 def github_url if dotcom? "https://github.com".freeze else "#{scheme}://#{github_hostname}" end end |
.help_url ⇒ Object
64 65 66 |
# File 'lib/jekyll-github-metadata/pages.rb', line 64 def help_url trim_last_slash env_var("PAGES_HELP_URL", ENV["HELP_URL"]) end |
.pages_hostname ⇒ Object
72 73 74 75 76 |
# File 'lib/jekyll-github-metadata/pages.rb', line 72 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
48 49 50 |
# File 'lib/jekyll-github-metadata/pages.rb', line 48 def repo_pages_html_url_preview? env_var "PAGES_PREVIEW_HTML_URL" end |
.scheme ⇒ Object
24 25 26 |
# File 'lib/jekyll-github-metadata/pages.rb', line 24 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
20 21 22 |
# File 'lib/jekyll-github-metadata/pages.rb', line 20 def ssl? env_var("SSL") == "true" || test? end |
.subdomain_isolation? ⇒ Boolean
28 29 30 |
# File 'lib/jekyll-github-metadata/pages.rb', line 28 def subdomain_isolation? env_var("SUBDOMAIN_ISOLATION").eql? "true" end |
.test? ⇒ Boolean
32 |
# File 'lib/jekyll-github-metadata/pages.rb', line 32 def test?; env == "test" end |