Moderizing dev environment.
- Use rake-deveiate. - Fixes for README - Add History, break out Manifest - Remove keyword expansion constant REVISION - Use current Configurability APIs instead of the (now ancient) methods - Whitespace changes FossilOrigin-Name: a778fb275af99a238d9d2311cc601c58adf80e28bd68a37e06acdfb6efeb018d
This commit is contained in:
parent
07c927e13a
commit
2682000224
18 changed files with 210 additions and 227 deletions
|
|
@ -9,10 +9,7 @@ module Symphony::Metronome
|
|||
Configurability
|
||||
|
||||
# Library version constant
|
||||
VERSION = '0.2.3'
|
||||
|
||||
# Version-control revision constant
|
||||
REVISION = %q$Revision: e3d11b2c9e48 $
|
||||
VERSION = '0.3.0'
|
||||
|
||||
# The name of the environment variable to check for config file overrides
|
||||
CONFIG_ENV = 'METRONOME_CONFIG'
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ class Symphony::Metronome::IntervalExpression
|
|||
### an expression was generated, you can 'reconstitute' an interval
|
||||
### object this way.
|
||||
###
|
||||
def self::parse( exp, time=nil )
|
||||
def self::parse( exp, time=Time.now )
|
||||
|
||||
# Normalize the expression before parsing
|
||||
#
|
||||
|
|
@ -250,7 +250,7 @@ class Symphony::Metronome::IntervalExpression
|
|||
gsub( /([:\-])+/, '\1' ). # collapse multiple - or : chars
|
||||
gsub( /\.+$/, '' ) # trailing periods
|
||||
|
||||
event = new( exp, time || Time.now )
|
||||
event = new( exp, time )
|
||||
data = event.instance_variable_get( :@data )
|
||||
|
||||
# Ragel interface variables
|
||||
|
|
|
|||
|
|
@ -21,19 +21,17 @@ class Symphony::Metronome::ScheduledEvent
|
|||
config_key :metronome
|
||||
|
||||
|
||||
# Configure defaults.
|
||||
#
|
||||
CONFIG_DEFAULTS = {
|
||||
:db => 'sqlite:///tmp/metronome.db',
|
||||
:splay => 0
|
||||
}
|
||||
### Configurability API.
|
||||
###
|
||||
configurability do
|
||||
|
||||
class << self
|
||||
##
|
||||
# A Sequel-style DB connection URI.
|
||||
attr_reader :db
|
||||
setting :db, default: 'sqlite:///tmp/metronome.db'
|
||||
|
||||
##
|
||||
# Adjust recurring intervals by a random window.
|
||||
attr_reader :splay
|
||||
setting :splay, default: 0
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -62,7 +60,6 @@ class Symphony::Metronome::ScheduledEvent
|
|||
### Delete any rows that are invalid expressions.
|
||||
###
|
||||
def self::load
|
||||
now = Time.now
|
||||
events = SortedSet.new
|
||||
|
||||
# Force reset the DB handle.
|
||||
|
|
|
|||
|
|
@ -17,22 +17,15 @@ class Symphony::Metronome::Scheduler
|
|||
# Signals the daemon responds to.
|
||||
SIGNALS = [ :HUP, :INT, :TERM ]
|
||||
|
||||
CONFIG_DEFAULTS = {
|
||||
:listen => false
|
||||
}
|
||||
|
||||
class << self
|
||||
### Configurability API.
|
||||
###
|
||||
configurability do
|
||||
|
||||
# Should Metronome register and schedule events via AMQP?
|
||||
# If +false+, you'll need a separate way to add event actions
|
||||
# to the database, and manually HUP the daemon.
|
||||
attr_reader :listen
|
||||
end
|
||||
|
||||
### Configurability API
|
||||
###
|
||||
def self::configure( config=nil )
|
||||
config = self.defaults.merge( config || {} )
|
||||
@listen = config.delete( :listen )
|
||||
setting :listen, default: false
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue