Module: Locd

Includes:
NRSER::Log::Mixin
Defined in:
lib/locd.rb,
lib/locd/util.rb,
lib/locd/agent.rb,
lib/locd/proxy.rb,
lib/locd/errors.rb,
lib/locd/version.rb,
lib/locd/agent/proxy.rb,
lib/locd/config/types.rb,
lib/locd/cli/command/job.rb,
lib/locd/cli/command/base.rb,
lib/locd/cli/command/main.rb,
lib/locd/cli/command/agent.rb,
lib/locd/cli/command/proxy.rb,
lib/locd/cli/command/job/add.rb,
lib/locd/cli/command/project.rb,
lib/locd/cli/command/agent/ls.rb,
lib/locd/cli/command/agent/rm.rb,
lib/locd/cli/command/agent/add.rb,
lib/locd/cli/command/agent/open.rb,
lib/locd/cli/command/agent/stop.rb,
lib/locd/cli/command/agent/tail.rb,
lib/locd/cli/command/agent/plist.rb,
lib/locd/cli/command/agent/start.rb,
lib/locd/cli/command/rotate_logs.rb,
lib/locd/cli/command/agent/shared.rb,
lib/locd/cli/command/agent/status.rb,
lib/locd/cli/command/agent/update.rb,
lib/locd/cli/command/agent/restart.rb,
lib/locd/cli/command/rotate_logs/add.rb,
lib/locd/cli/command/agent/truncate_logs.rb

Overview

Namespace

Defined Under Namespace

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

Constant Summary collapse

HOST_RE =

Regexp to match HTTP "Host" header line.

Returns:

  • (Regexp)
/^Host\:\ /i
ROOT =

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

Returns:

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

String version read from //VERSION and used in the gemspec.

I use this approach in order to create a standard versioning system across any package, regardless or runtime, and so that tools can figure out what version a package is without even having it's runtime available.

This has turned out to be super helpful, and I'm surprised it isn't more common or standardized in some way... I think pretty much every package in very language has a root directory and is capable of reading a file to figure out it's state.

Returns:

  • (String)
(ROOT + 'VERSION').read.chomp
GEM_NAME =

The gem name, read from the //NAME file, and used in the gemspec.

See VERSION for an explanation of why bare files in the package root are used.

Returns:

  • (String)
(ROOT + 'NAME').read.chomp

Class Method Summary collapse

Class Method Details

.configLocd::Config

Returns The configuration.

Returns:



60
61
62
# File 'lib/locd.rb', line 60

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