Sha256: 9b203107ef253964907bb8d0a351a8e89c0093080fbc2f238e59847caac63d52

Contents?: true

Size: 1.64 KB

Versions: 9

Compression:

Stored size: 1.64 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'

libdir = "#{File.expand_path(File.dirname(File.dirname(__FILE__)))}/lib"
$LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir)

load "#{libdir}/../rerun.gemspec" # defines "$spec" variable, which we read the version from

require 'rerun'

require 'optparse'

options = {}

opts = OptionParser.new("", 24, '  ') { |opts|
  opts.banner = "Usage: rerun cmd"

  opts.separator ""
  opts.separator "Launches an app, and restarts it when the filesystem changes."
  opts.separator "See http://github.com/alexch/rerun for more info."
  opts.separator ""
  opts.separator "Options:"

  opts.on("-d dir", "--dir dir", "directory to watch") do |dir|
    options[:dir] = dir
  end

  opts.on("-p pattern", "--pattern pattern", "file glob, default = \"#{Rerun::DEFAULT_PATTERN}\"") do |pattern|
    options[:pattern] = pattern
  end

  opts.on("-c", "--clear", "clear screen before each run") do
    options[:clear] = true
  end

  opts.on("-x", "--exit", "expect the program to exit. With this option, rerun checks the return value; without it, rerun checks that the process is running.") do |dir|
    options[:exit] = true
  end

  opts.on_tail("-h", "--help", "--usage", "show this message") do
    puts opts
    exit
  end

  opts.on_tail("--version", "show version") do
    puts $spec.version
    exit
  end

  opts.parse! ARGV
}

#config = ARGV[0] || "config.ru"
#abort "configuration #{config} not found"  unless File.exist? config
#
#if config =~ /\.ru$/ && File.read(config)[/^#\\(.*)/]
#  opts.parse! $1.split(/\s+/)
#end

if ARGV.empty?
  puts opts
  exit
end

cmd = ARGV.join(" ")
runner = Rerun::Runner.keep_running(cmd, options)

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rerun-0.7.0.pre5 bin/rerun
rerun-0.7.0.pre4 bin/rerun
rerun-0.7.0.pre3 bin/rerun
rerun-0.7.0.pre2 bin/rerun
rerun-0.7.0.pre1 bin/rerun
rerun-0.6.6 bin/rerun
rerun-0.6.5 bin/rerun
rerun-0.6.4 bin/rerun
rerun-0.6.3 bin/rerun