Module: D13n

Defined in:
lib/d13n.rb,
lib/d13n/logger.rb,
lib/d13n/service.rb,
lib/d13n/version.rb,
lib/d13n/cli/command.rb,
lib/d13n/configuration.rb,
lib/d13n/service/start.rb,
lib/d13n/logger/log_once.rb,
lib/d13n/logger/null_logger.rb,
lib/d13n/logger/memory_logger.rb,
lib/d13n/rack/d13n_middleware.rb,
lib/d13n/rack/metric_middleware.rb,
lib/d13n/configuration/mask_defaults.rb

Defined Under Namespace

Modules: Application, Cli, Configuration, Metric, Rack, VERSION Classes: Error, Logger, Service

Constant Summary collapse

NAME =
'd13n'.freeze
RELEASE =
"#{NAME} #{VERSION::STRING} codename #{VERSION::CODENAME}".freeze

Class Method Summary collapse

Class Method Details

.app_nameObject



67
68
69
# File 'lib/d13n.rb', line 67

def app_name
  application.name.underscore
end

.app_prefixObject



71
72
73
# File 'lib/d13n.rb', line 71

def app_prefix
  app_name.upcase
end

.applicationObject



57
58
59
# File 'lib/d13n.rb', line 57

def application
  @application ||= self
end

.application=(app) ⇒ Object



61
62
63
64
65
# File 'lib/d13n.rb', line 61

def application=(app)
  @application = app
  @app_name = nil
  @app_prefix = nil
end

.configObject



16
17
18
# File 'lib/d13n.rb', line 16

def config
  @config ||= D13n::Configuration::Manager.new
end

.config=(cfg) ⇒ Object



20
21
22
# File 'lib/d13n.rb', line 20

def config=(cfg)
  @config = cfg
end

.dry_run?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/d13n.rb', line 8

def dry_run?
  @dry_run ||= false
end

.enable_dry_runObject



12
13
14
# File 'lib/d13n.rb', line 12

def enable_dry_run
  @dry_run = true
end

.idc_envObject



79
80
81
# File 'lib/d13n.rb', line 79

def idc_env
  config[:'idc.env'] || 'dev'
end

.idc_nameObject



75
76
77
# File 'lib/d13n.rb', line 75

def idc_name
  config[:'idc.name'] || 'hqidc'
end

.loggerObject



24
25
26
27
28
29
30
# File 'lib/d13n.rb', line 24

def logger
  @logger ||= if dry_run?
    D13n::Logger::NullLogger.instance
  else
    D13n::Logger::StartupLogger.instance
  end
end

.logger=(log) ⇒ Object



32
33
34
# File 'lib/d13n.rb', line 32

def logger=(log)
 @logger = log
end

.resetObject



45
46
47
# File 'lib/d13n.rb', line 45

def reset
  Thread.current[:d13n] = {}
end

.serviceObject



49
50
51
# File 'lib/d13n.rb', line 49

def service
  @service ||= D13n::Service
end

.service=(srv) ⇒ Object



53
54
55
# File 'lib/d13n.rb', line 53

def service=(srv)
  @service = srv
end

.threadedObject

def opt_state

D13n::Operation::State

end



40
41
42
43
# File 'lib/d13n.rb', line 40

def threaded
  #@threaded ||= {}
  Thread.current[:d13n] ||= {}
end