Class: JekyllAuth

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-auth.rb,
lib/jekyll_auth/helpers.rb,
lib/jekyll_auth/version.rb,
lib/jekyll_auth/commands.rb,
lib/jekyll_auth/auth_site.rb,
lib/jekyll_auth/jekyll_site.rb,
lib/jekyll_auth/config_error.rb

Defined Under Namespace

Modules: Helpers Classes: AuthSite, Commands, ConfigError, JekyllSite

Constant Summary collapse

VERSION =
'1.0.0'

Class Method Summary collapse

Class Method Details

.configObject



28
29
30
31
32
33
34
35
# File 'lib/jekyll-auth.rb', line 28

def self.config
  @config ||= begin
    config = YAML.safe_load_file(config_file)
    config["jekyll_auth"] || {}
  rescue
    {}
  end
end

.config_fileObject



24
25
26
# File 'lib/jekyll-auth.rb', line 24

def self.config_file
  File.join(Dir.pwd, "_config.yml")
end

.siteObject



17
18
19
20
21
22
# File 'lib/jekyll-auth.rb', line 17

def self.site
  Rack::Builder.new do
    use JekyllAuth::AuthSite
    run JekyllAuth::JekyllSite
  end
end

.ssl?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/jekyll-auth.rb', line 42

def self.ssl?
  !!JekyllAuth::config["ssl"]
end

.whitelistObject



37
38
39
40
# File 'lib/jekyll-auth.rb', line 37

def self.whitelist
  whitelist = JekyllAuth::config["whitelist"]
  Regexp.new(whitelist.join("|")) unless whitelist.nil?
end