Module: Wake

Defined in:
lib/wake.rb,
lib/wake/script.rb,
lib/wake/controller.rb,
lib/wake/event_handlers/em.rb,
lib/wake/event_handlers/rev.rb,
lib/wake/event_handlers/base.rb,
lib/wake/event_handlers/unix.rb,
lib/wake/event_handlers/portable.rb

Overview

Agile development tool that monitors a directory recursively, and triggers a user defined action whenever an observed file is modified. Its most typical use is continuous testing.

Usage:

# on command line, from project's root dir
$ wake path/to/script
# default script if none is given is Wakefile.

See README for more details

Defined Under Namespace

Modules: EventHandler Classes: Controller, Refresh, Script

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.batchesObject



4
5
6
# File 'lib/wake/script.rb', line 4

def batches
  @batches ||= {}
end

.debug(str) ⇒ Object

Outputs formatted debug statement to stdout, only if ::options.debug is true

Examples
Wake.options.debug = true
Wake.debug('im in ur codes, notifayinin u')

outputs: ā€œ[wake debug] im in ur codes, notifayinin uā€



69
70
71
# File 'lib/wake.rb', line 69

def debug(str)
  puts "[wake debug] #{str}" if options.debug
end

.handlerObject

Detect current OS and return appropriate handler.

Examples
Config::CONFIG['host_os'] #=> 'linux-gnu'
Wake.handler #=> Wake::EventHandler::Unix

Config::CONFIG['host_os'] #=> 'cygwin'
Wake.handler #=> Wake::EventHandler::Portable

ENV['HANDLER'] #=> 'unix'
Wake.handler #=> Wake::EventHandler::Unix

ENV['HANDLER'] #=> 'portable'
Wake.handler #=> Wake::EventHandler::Portable
Returns
handler<Class>

handler class for current architecture



92
93
94
95
96
97
98
99
100
101
102
# File 'lib/wake.rb', line 92

def handler
  @handler ||=
    case ENV['HANDLER'] || Config::CONFIG['host_os']
      when /mswin|windows|cygwin/i
        Wake::EventHandler::Portable
      when /sunos|solaris|darwin|mach|osx|bsd|linux/i, 'unix'
        Wake::EventHandler::Unix.default
      else
        Wake::EventHandler::Portable
    end
end

.handler=(arg) ⇒ Object



104
105
106
# File 'lib/wake.rb', line 104

def handler= arg
  @handler = arg
end

.optionsObject

Options proxy.

Currently supported options:

  • debug<Boolean> Debugging state. More verbose.

Examples
Wake.options.debug #=> false
Wake.options.debug = true
Returns
options<Struct>

options proxy.

ā€“ On first use, initialize the options struct and default option values.



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

def options
  @options ||= Struct.new(:debug,:once, :wakefile).new
  @options.debug ||= false
  @options.once.nil? and @options.once = false
  @options
end

.options=(arg) ⇒ Object



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

def options= arg
  @options = arg
end

.versionObject

backwards compatibility



30
31
32
# File 'lib/wake.rb', line 30

def version #:nodoc:
  Wake::VERSION
end