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

Class Method Details

.configConfig

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

Returns:



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

.loggerObject



126
127
128
# File 'lib/lb/project.rb', line 126

def self.logger
  @logger ||= create_logger
end

.public_pathdir_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

Returns:

  • (dir_name)


106
107
108
# File 'lib/lb/project.rb', line 106

def self.public_path
  File.join(root, config.public_path)
end

.rootdir_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

Returns:

  • (dir_name)


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

Parameters:

  • file (File)

    The file to get the root path from

  • depth (File) (defaults to: 2)

    The depth of the given file relative from the root

Returns:

  • (dir_name)


84
85
86
87
88
# File 'lib/lb/project.rb', line 84

def self.root_for(file, depth = 2)
  path = File.expand_path(file)
  depth.times { path = File.dirname(path) }
  path
end

.settingsObject



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

Parameters:

Returns:

  • (self)


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_pathdir_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

Returns:

  • (dir_name)


96
97
98
# File 'lib/lb/project.rb', line 96

def self.template_path
  File.join(root, config.template_path)
end