Module: LB::Project
- Defined in:
- lib/lb/project.rb,
lib/lb/project/api.rb,
lib/lb/project/app.rb,
lib/lb/project/page.rb,
lib/lb/project/site.rb,
lib/lb/project/view.rb,
lib/lb/project/route.rb,
lib/lb/project/types.rb,
lib/lb/project/config.rb,
lib/lb/project/render.rb,
lib/lb/project/version.rb,
lib/lb/project/registry.rb,
lib/lb/project/settings.rb,
lib/lb/project/registry/registration.rb
Overview
Project
Defined Under Namespace
Modules: API, Types Classes: App, Config, Page, Registry, Render, Route, Settings, Site, View
Constant Summary collapse
- ERROR_MSG =
'Setup failed: settings is not a LB::Project::Settings'- VERSION =
Version
'0.2.3'
Class Method Summary collapse
-
.config ⇒ Config
private
Get main configuration.
- .logger ⇒ Object
-
.public_path ⇒ dir_name
private
Get public path.
-
.root ⇒ dir_name
private
Get root path.
-
.root_for(file, depth = 2) ⇒ dir_name
private
Get root path for file.
- .settings ⇒ Object
-
.setup(settings) ⇒ self
private
Setup.
- .t(*params) ⇒ Object
-
.template_path ⇒ dir_name
private
Get template path.
Class Method Details
.config ⇒ Config
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get main configuration
116 117 118 119 120 |
# File 'lib/lb/project.rb', line 116 def self.config @settings.config rescue NoMethodError raise ArgumentError, 'Call LB::Project.setup(...) first!' end |
.logger ⇒ Object
126 127 128 |
# File 'lib/lb/project.rb', line 126 def self.logger @logger ||= create_logger end |
.public_path ⇒ dir_name
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get public path
106 107 108 |
# File 'lib/lb/project.rb', line 106 def self.public_path File.join(root, config.public_path) end |
.root ⇒ dir_name
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get root path
68 69 70 71 72 |
# File 'lib/lb/project.rb', line 68 def self.root @settings.root rescue NoMethodError raise ArgumentError, 'Call LB::Project.setup(...) first!' end |
.root_for(file, depth = 2) ⇒ dir_name
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get root path for file
directory
84 85 86 87 88 |
# File 'lib/lb/project.rb', line 84 def self.root_for(file, depth = 2) path = File.(file) depth.times { path = File.dirname(path) } path end |
.settings ⇒ Object
58 59 60 |
# File 'lib/lb/project.rb', line 58 def self.settings @settings end |
.setup(settings) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Setup
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/lb/project.rb', line 47 def self.setup(settings) unless settings.is_a?(LB::Project::Settings) raise ArgumentError, ERROR_MSG end @settings = settings self end |
.t(*params) ⇒ Object
122 123 124 |
# File 'lib/lb/project.rb', line 122 def self.t(*params) R18n.t(*params) end |
.template_path ⇒ dir_name
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get template path
96 97 98 |
# File 'lib/lb/project.rb', line 96 def self.template_path File.join(root, config.template_path) end |