Module: Watchr
- Defined in:
- lib/watchr.rb,
lib/watchr/script.rb,
lib/watchr/controller.rb,
lib/watchr/event_handlers/em.rb,
lib/watchr/event_handlers/rev.rb,
lib/watchr/event_handlers/base.rb,
lib/watchr/event_handlers/unix.rb,
lib/watchr/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
$ watchr path/to/script
See README for more details
Defined Under Namespace
Modules: EventHandler Classes: Controller, Refresh, Script
Constant Summary collapse
- VERSION =
'0.5.7'
Class Method Summary collapse
- .batches ⇒ Object
-
.debug(str) ⇒ Object
Outputs formatted debug statement to stdout, only if ::options.debug is true.
-
.handler ⇒ Object
Detect current OS and return appropriate handler.
-
.options ⇒ Object
Options proxy.
-
.version ⇒ Object
backwards compatibility.
Class Method Details
.batches ⇒ Object
4 5 6 |
# File 'lib/watchr/script.rb', line 4 def batches @batches ||= {} end |
.debug(str) ⇒ Object
Outputs formatted debug statement to stdout, only if ::options.debug is true
Examples
Watchr..debug = true
Watchr.debug('im in ur codes, notifayinin u')
outputs: "[watchr debug] im in ur codes, notifayinin u"
64 65 66 |
# File 'lib/watchr.rb', line 64 def debug(str) puts "[watchr debug] #{str}" if .debug end |
.handler ⇒ Object
Detect current OS and return appropriate handler.
Examples
Config::CONFIG['host_os'] #=> 'linux-gnu'
Watchr.handler #=> Watchr::EventHandler::Unix
Config::CONFIG['host_os'] #=> 'cygwin'
Watchr.handler #=> Watchr::EventHandler::Portable
ENV['HANDLER'] #=> 'unix'
Watchr.handler #=> Watchr::EventHandler::Unix
ENV['HANDLER'] #=> 'portable'
Watchr.handler #=> Watchr::EventHandler::Portable
Returns
- handler
handler class for current architecture
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/watchr.rb', line 87 def handler @handler ||= case ENV['HANDLER'] || Config::CONFIG['host_os'] when /mswin|windows|cygwin/i Watchr::EventHandler::Portable when /sunos|solaris|darwin|mach|osx|bsd|linux/i, 'unix' Watchr::EventHandler::Unix.default else Watchr::EventHandler::Portable end end |
.options ⇒ Object
Options proxy.
Currently supported options:
- debug
Debugging state. More verbose.
Examples
Watchr..debug #=> false
Watchr..debug = true
Returns
- options
options proxy.
-- On first use, initialize the options struct and default option values.
48 49 50 51 52 53 |
# File 'lib/watchr.rb', line 48 def ||= Struct.new(:debug,:once).new .debug ||= false .once.nil? and .once = false end |
.version ⇒ Object
backwards compatibility
29 30 31 |
# File 'lib/watchr.rb', line 29 def version #:nodoc: Watchr::VERSION end |