Module: J1App
- Defined in:
- lib/j1_app.rb,
lib/j1_app/j1_auth_manager/config.rb,
lib/j1_app/j1_auth_manager/helpers.rb,
lib/j1_app/j1_auth_manager/commands.rb,
lib/j1_app/j1_site_manager/static_site.rb,
lib/j1_app/j1_auth_manager/auth_manager.rb,
lib/j1_app/j1_auth_manager/helpers_disqus.rb,
lib/j1_app/j1_auth_manager/helpers_github.rb,
lib/j1_app/j1_auth_manager/helpers_patreon.rb,
lib/j1_app/j1_auth_manager/helpers_twitter.rb,
lib/j1_app/j1_auth_manager/helpers_facebook.rb
Overview
Defined Under Namespace
Modules: DisqusHelpers, FacebookHelpers, GithubHelpers, Helpers, PatreonHelpers, TwitterHelpers
Classes: AuthManager, Commands, ConfigError, SiteManager
Class Method Summary
collapse
Class Method Details
.active_providers ⇒ Object
53
54
55
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 53
def self.active_providers
auth_config['providers']['activated']
end
|
.auth? ⇒ Boolean
35
36
37
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 35
def self.auth?
!!auth_config['enabled']
end
|
.auth_config ⇒ Object
28
29
30
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 28
def self.auth_config
jekyll_config.fetch('j1_auth', {})
end
|
.conditions(arg) ⇒ Object
82
83
84
85
86
87
88
89
90
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 82
def self.conditions (arg)
condition_profile = {}
provider = arg
provider_conditions = auth_config['providers']["#{provider}"]['conditions']
provider_conditions.each do |key, value|
condition_profile[key] = value
end
condition_profile
end
|
.config_file ⇒ Object
3
4
5
6
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 3
def self.config_file
File.join(Dir.pwd, '_config.yml')
end
|
.default_provider ⇒ Object
57
58
59
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 57
def self.default_provider
auth_config['providers']['activated'][0]
end
|
.destination ⇒ Object
24
25
26
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 24
def self.destination
jekyll_config.fetch('destination', File.expand_path('_site', Dir.pwd))
end
|
.get_condition(arg) ⇒ Object
78
79
80
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 78
def self.get_condition(arg)
auth_config['provider']['condition']["#{arg}"]
end
|
.jekyll_config ⇒ Object
8
9
10
11
12
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 8
def self.jekyll_config
@config ||= YAML.safe_load_file(config_file)
rescue StandardError
{}
end
|
.permissions ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 61
def self.permissions
permission_profile = {
:protected => [],
:private => []
}
active_providers = auth_config['providers']['activated']
for p in active_providers do
provider_permissions = auth_config['providers']["#{p}"]['permissions']
provider_permissions.each do |perm|
permission_profile[:"#{perm}"] << "#{p}"
end
end
permission_profile
end
|
.public_content ⇒ Object
48
49
50
51
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 48
def self.public_content
public_content = auth_config['content']['public']
Regexp.new(public_content.join("|")) unless public_content.nil?
end
|
.site ⇒ Object
58
59
60
61
62
63
64
65
|
# File 'lib/j1_app.rb', line 58
def self.site
Rack::Builder.new do
use Rack::ShowExceptions use Rack::Deflater use J1App::AuthManager run J1App::SiteManager end
end
|
.ssl? ⇒ Boolean
39
40
41
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 39
def self.ssl?
!!auth_config['ssl']
end
|
.template_config ⇒ Object
18
19
20
21
22
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 18
def self.template_config
@template_config ||= YAML.safe_load_file(template_config_file)
rescue StandardError
{}
end
|
.template_config_file ⇒ Object
14
15
16
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 14
def self.template_config_file
File.join(Dir.pwd, '_data/template_settings.yml')
end
|
.user_settings ⇒ Object
32
33
34
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 32
def self.user_settings
template_config.fetch('user', {})
end
|
.whitelist ⇒ Object
43
44
45
46
|
# File 'lib/j1_app/j1_auth_manager/config.rb', line 43
def self.whitelist
whitelist = auth_config['whitelist']
Regexp.new(whitelist.join("|")) unless whitelist.nil?
end
|