Module: Symphony::Metronome

Extended by:
Configurability, Loggability
Defined in:
lib/symphony/metronome/mixins.rb,
lib/symphony/metronome.rb

Defined Under Namespace

Modules: TimeFunctions, TimeRefinements Classes: TimeParseError

Constant Summary collapse

VERSION =

Library version constant

'0.2.1'
REVISION =

Version-control revision constant

%q$Revision: 87e45dca63b3 $
CONFIG_ENV =

The name of the environment variable to check for config file overrides

'METRONOME_CONFIG'
DEFAULT_CONFIG_FILE =

The path to the default config file

'etc/config.yml'
DATADIR =

The data directory that contains migration files.

if ENV['METRONOME_DATADIR']
 Pathname.new( ENV['METRONOME_DATADIR'] )
elsif Gem.datadir( 'symphony-metronome' )
 Pathname.new( Gem.datadir('symphony-metronome') )
else
 Pathname.new( __FILE__ ).dirname.parent.parent + 'data/symphony-metronome'
end

Class Method Summary collapse

Class Method Details

.configObject

Get the loaded config (a Configurability::Config object)



42
43
44
# File 'lib/symphony/metronome.rb', line 42

def self::config
  Configurability.loaded_config
end

.load_config(config_file = nil, defaults = nil) ⇒ Object

Load the specified config_file, install the config in all objects with Configurability, and call any callbacks registered via #after_configure.



49
50
51
52
53
54
# File 'lib/symphony/metronome.rb', line 49

def self::load_config( config_file=nil, defaults=nil )
  config_file ||= ENV[ CONFIG_ENV ] || DEFAULT_CONFIG_FILE
  defaults    ||= Configurability.gather_defaults
  config = Configurability::Config.load( config_file, defaults )
  config.install
end

.run(&block) ⇒ Object

Convenience method for running the scheduler.

Raises:

  • (LocalJumpError)


72
73
74
75
# File 'lib/symphony/metronome.rb', line 72

def run( &block )
  raise LocalJumpError, "No block provided." unless block_given?
  return Symphony::Metronome::Scheduler.run( &block )
end