Module: Locd

Includes:
NRSER::Log::Mixin
Defined in:
lib/locd.rb,
lib/locd/util.rb,
lib/locd/errors.rb,
lib/locd/version.rb,
lib/locd/config/types.rb,
lib/locd/cli/command/base.rb,
lib/locd/cli/command/main.rb,
lib/locd/cli/command/project.rb,
lib/locd/cli/command/agent/add.rb

Overview

Namespace

Defined Under Namespace

Modules: CLI, Label, Launchctl, Newsyslog, Proxy Classes: Agent, Config, HandledError, NotFoundError, Pattern, RequestError

Constant Summary collapse

HOST_RE =

Regexp to match HTTP "Host" header line.

Returns:

  • (Regexp)
/^Host\:\ /i
ROTATE_LOGS_LABEL =
'com.nrser.locd.rotate-logs'
ROOT =

Absolute, expanded path to the gem's root directory.

Returns:

  • (Pathname)
Pathname.new( __dir__ ).join( '..', '..' ).expand_path
VERSION =

String version read from //VERSION

Returns:

  • (String)
(ROOT / 'VERSION').read
GEM_NAME =

The gem name

Returns:

  • (String)
'locd'

Class Method Summary collapse

Class Method Details

.configLocd::Config

Returns The configuration.

Returns:



63
64
65
# File 'lib/locd.rb', line 63

def self.config
  @config ||= Locd::Config.new
end

.resolve(project_root, path = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/locd/util.rb', line 9

def self.resolve project_root, path = nil
  return project_root if path.nil?
  
  if path.start_with? '//'
    project_root / path[2..-1]
  elsif path.start_with? '/'
    path.to_pn
  else
    project_root / path
  end
end

.resolve_to_s(*args) ⇒ String

Just like resolve but returns a String (instead of a Pathname).

Returns:

  • (String)


27
28
29
# File 'lib/locd/util.rb', line 27

def self.resolve_to_s *args
  resolve( *args ).to_s
end