Sha256: a2714641d407d27ba21106da500f1752339b6d6219ae137a63f11d928749183b

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 KB

Contents

require 'yaml'
# Why Bolt? Cause it's a cool name, that's why :)
module Bolt
  
  # static location for settings
  @@config = {}
  
  # set a config setting
  def self.set(key, value)
    @@config[key] = value
  end
  
  # retrieve a value for a config setting
  def self.get(key)
    @@config[key]
  end
  
  # convienience accessor
  def self.[](key)
    @@config[key]
  end
  
  # read the .bolt file for configuration
  def self.read_dotfile
    if File.exists?('.bolt')
      $stdout.puts "** Found .bolt file"
      @@config.merge!(YAML.load_file('.bolt'))
    end
  end
  
  def self.start
    $stdout.puts "** Starting Bolt..."
    
    # read the dotfile
    Bolt.read_dotfile
    
    Bolt::Listener.new
  end
  
  autoload :Mapper, 'bolt/mapper'
  autoload :Runner, 'bolt/runner'
  autoload :Notifier, 'bolt/notifier'
  autoload :Listener, 'bolt/listener'
  
  #
  # Bolt::Listeners
  #
  # Wrapper for specific listeners
  #
  module Listeners
    autoload :Generic, 'bolt/listeners/generic'
    autoload :Kqueue, 'bolt/listeners/kqueue'
    autoload :Osx, 'bolt/listeners/osx'
  end
  
  #
  # Bolt::Runners
  #
  # Wrapper for specific runners
  #
  module Runners
    @@noticed_files = []
    
    def self.files=(arr)
      @@noticed_files = arr
    end
    
    def self.files
      @@noticed_files
    end
    
    autoload :TestUnit, 'bolt/runners/test_unit'
    autoload :RSpec, 'bolt/runners/rspec'
  end
    
  #
  # Bolt::Notifiers
  #
  # Wrapper for specific notifier
  #
  module Notifiers
    autoload :Generic, 'bolt/notifiers/generic'
    autoload :Growl, 'bolt/notifiers/growl'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
marcinbunsch-bolt-0.2.0 lib/bolt.rb
marcinbunsch-bolt-0.2.1 lib/bolt.rb
marcinbunsch-bolt-0.2.2 lib/bolt.rb