class Jekyll::RemoteTheme::Theme
Constants
- NAME_REGEX
- OWNER_REGEX
- REF_REGEX
- THEME_REGEX
Public Class Methods
new(raw_theme)
click to toggle source
Initializes a new Jekyll::RemoteTheme::Theme
raw_theme can be in the form of:
-
owner/theme-name - a GitHub owner + theme-name string
-
owner/theme-name - a GitHub owner + theme-name + Git ref string
-
http://github.<yourEnterprise>.com/owner/theme-name
-
An enterprise GitHub instance + a GitHub owner + a theme-name string
-
http://github.<yourEnterprise>.com/owner/theme-name@git_ref
-
An enterprise GitHub instance + a GitHub owner + a theme-name + Git ref string
Calls superclass method
# File lib/jekyll-remote-theme/theme.rb, line 21 def initialize(raw_theme) @raw_theme = raw_theme.to_s.downcase.strip super(@raw_theme) end
Public Instance Methods
git_ref()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 53 def git_ref theme_parts[:ref] || "HEAD" end
host()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 34 def host uri&.host end
inspect()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 61 def inspect "#<Jekyll::RemoteTheme::Theme host=\"#{host}\" owner=\"#{owner}\" name=\"#{name}\"" \ " ref=\"#{git_ref}\" root=\"#{root}\">" end
name()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 26 def name theme_parts[:name] end
name_with_owner()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 42 def name_with_owner [owner, name].join("/") end
Also aliased as: nwo
owner()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 30 def owner theme_parts[:owner] end
root()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 57 def root @root ||= File.realpath Dir.mktmpdir(TEMP_PREFIX) end
scheme()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 38 def scheme uri&.scheme end
valid?()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 47 def valid? return false unless uri && theme_parts && name && owner host && valid_hosts.include?(host) end
Private Instance Methods
gemspec()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 88 def gemspec @gemspec ||= MockGemspec.new(self) end
theme_parts()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 84 def theme_parts @theme_parts ||= uri.path[1..-1].match(THEME_REGEX) if uri end
uri()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 68 def uri return @uri if defined? @uri @uri = if THEME_REGEX.match?(@raw_theme) Addressable::URI.new( :scheme => "https", :host => "github.com", :path => @raw_theme ) else Addressable::URI.parse @raw_theme end rescue Addressable::URI::InvalidURIError @uri = nil end
valid_hosts()
click to toggle source
# File lib/jekyll-remote-theme/theme.rb, line 92 def valid_hosts @valid_hosts ||= [ "github.com", ENV["PAGES_GITHUB_HOSTNAME"], ENV["GITHUB_HOSTNAME"], ].compact.to_set end