Sha256: b32c1ea65f9a4b13fabb7a7818503e77104ae9ee310f4e73c40f3404ebbdc38f

Contents?: true

Size: 848 Bytes

Versions: 6

Compression:

Stored size: 848 Bytes

Contents

def set_common_options c
  c.option '-i', '--interval SECONDS', Integer, 'Interval in seconds in which to listen for an event.'
  c.option '-t', '--timeout SECONDS', Integer, 'Timeout after n seconds.'
  c.option '-r', '--require LIBS', Array, 'Require ruby libraries.'
  c.option '-e', '--eval STRING', String, 'Evaluate a string of Ruby in context of Bind, so the file local variable is available.'
  c.option '-V', '--verbose', 'Log information to STDOUT.'
end

def listener options
  Bind::Listener.new options.__hash__
end

def common_options options
  options.actions ||= []
  options.actions << lambda { |file| eval options.eval } if options.eval
  options.require.each { |lib| require lib } if options.require
  options.debug = $stdout if options.verbose
end

def expand_path path
  path.include?('://') ? path : File.expand_path(path)
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
visionmedia-bind-0.2.4 lib/bind/command_helpers.rb
visionmedia-bind-0.2.5 lib/bind/command_helpers.rb
visionmedia-bind-0.2.6 lib/bind/command_helpers.rb
bind-0.2.8 lib/bind/command_helpers.rb
bind-0.2.7 lib/bind/command_helpers.rb
bind-0.2.6 lib/bind/command_helpers.rb