Module: DaemonKit

Defined in:
lib/daemon_kit.rb,
lib/daemon_kit/em.rb,
lib/daemon_kit/cron.rb,
lib/daemon_kit/xmpp.rb,
lib/daemon_kit/config.rb,
lib/daemon_kit/jabber.rb,
lib/daemon_kit/nanite.rb,
lib/daemon_kit/safety.rb,
lib/daemon_kit/dk_amqp.rb,
lib/daemon_kit/pid_file.rb,
lib/daemon_kit/arguments.rb,
lib/daemon_kit/exceptions.rb,
lib/daemon_kit/generators.rb,
lib/daemon_kit/application.rb,
lib/daemon_kit/initializer.rb,
lib/daemon_kit/nanite/agent.rb,
lib/daemon_kit/cucumber/world.rb,
lib/daemon_kit/ruote_workitem.rb,
lib/daemon_kit/abstract_logger.rb,
lib/daemon_kit/generators/base.rb,
lib/daemon_kit/ruote_participants.rb,
lib/daemon_kit/error_handlers/base.rb,
lib/daemon_kit/core_ext/configurable.rb,
lib/daemon_kit/error_handlers/hoptoad.rb,
lib/daemon_kit/ruote_pseudo_participant.rb,
lib/generators/daemon_kit/app/app_generator.rb,
lib/generators/daemon_kit/amqp/amqp_generator.rb,
lib/generators/daemon_kit/cron/cron_generator.rb,
lib/generators/daemon_kit/xmpp/xmpp_generator.rb,
lib/generators/daemon_kit/rspec/rspec_generator.rb,
lib/generators/daemon_kit/ruote/ruote_generator.rb,
lib/generators/daemon_kit/app/templates/config/boot.rb,
lib/generators/daemon_kit/cucumber/cucumber_generator.rb,
lib/generators/daemon_kit/test_unit/test_unit_generator.rb,
lib/generators/daemon_kit/capistrano/capistrano_generator.rb,
lib/generators/daemon_kit/nanite_agent/nanite_agent_generator.rb

Defined Under Namespace

Modules: Configurable, Cucumber, ErrorHandlers, Generators, Nanite Classes: AMQP, AbstractLogger, Application, Arguments, Boot, Config, Configuration, Cron, DaemonNotFound, EM, Exception, GemBoot, Initializer, Jabber, MissingParticipant, PidFile, RuoteParticipants, RuotePseudoParticipant, RuoteWorkitem, Safety, VendorBoot, XMPP

Constant Summary collapse

VERSION =
'0.1.8.1'

Class Method Summary collapse

Class Method Details

.argumentsObject



24
25
26
# File 'lib/daemon_kit/initializer.rb', line 24

def arguments
  @arguments
end

.arguments=(args) ⇒ Object



28
29
30
# File 'lib/daemon_kit/initializer.rb', line 28

def arguments=( args )
  @arguments = args
end

.at_shutdown(&block) ⇒ Object



36
37
38
# File 'lib/daemon_kit/initializer.rb', line 36

def at_shutdown( &block )
  self.configuration.at_shutdown( &block )
end

.boot!Object



17
18
19
20
21
# File 'lib/generators/daemon_kit/app/templates/config/boot.rb', line 17

def boot!
  unless booted?
    pick_boot.run
  end
end

.booted?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/generators/daemon_kit/app/templates/config/boot.rb', line 23

def booted?
  defined? DaemonKit::Initializer
end

.configurationObject



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

def configuration
  @configuration
end

.configuration=(configuration) ⇒ Object



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

def configuration=( configuration )
  @configuration = configuration
end

.envObject



52
53
54
# File 'lib/daemon_kit.rb', line 52

def env
  DAEMON_ENV
end

.framework_rootObject



56
57
58
# File 'lib/daemon_kit.rb', line 56

def framework_root
  @framework_root ||= File.join( File.dirname(__FILE__), '..' ).to_absolute_path
end

.loggerObject



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

def logger
  @logger
end

.logger=(logger) ⇒ Object



44
45
46
# File 'lib/daemon_kit.rb', line 44

def logger=( logger )
  @logger = logger
end

.pick_bootObject



27
28
29
# File 'lib/generators/daemon_kit/app/templates/config/boot.rb', line 27

def pick_boot
  (vendor_kit? ? VendorBoot : GemBoot).new
end

.rootObject



48
49
50
# File 'lib/daemon_kit.rb', line 48

def root
  DAEMON_ROOT
end

.trap(*args, &block) ⇒ Object



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

def trap( *args, &block )
  self.configuration.trap( *args, &block )
end

.vendor_kit?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/generators/daemon_kit/app/templates/config/boot.rb', line 31

def vendor_kit?
  File.exists?( "#{DAEMON_ROOT}/vendor/daemon-kit" )
end