Sha256: b566b46dbe3aba4914d738475d21a42a84caf6c88882e421054aa6abdb0bbd2e

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

#!/usr/bin/env ruby
require 'slop'

argv = ARGV.dup
slop = Slop.new(:strict => true, :help => true)
slop.banner "Usage: earthquake [options] [directory]"
slop.on :d, :debug, 'Enable debug mode'
slop.on :n, :'no-logo', 'No Logo'
slop.on :c, :command, "Invoke a command and exit", true
slop.on :'--no-stream', "No stream mode"
begin
  slop.parse!(argv)
rescue => e
  puts e
  exit!
end
options = slop.to_hash

# XXX: work around slop's feature (bug?)
options.each do |key, val|
  val = val.nil? ? nil : true if key.to_s =~ /^no-/
  options[key] = val
end

options.delete(:help)
options[:dir] = argv.shift unless argv.empty?

require 'pathname'
$:.unshift Pathname.new(__FILE__).realpath.join('../../lib') if $0 == __FILE__
require "earthquake/version"

command = options.delete(:command)
no_logo = options.delete(:'no-logo')

if !no_logo && !command
  print "\e[31m"
  puts %q{
                 _   _                       _
  ___  __ _ _ __| |_| |__   __ _ _   _  __ _| | _____
 / _ \/ _` | '__| __| '_ \ / _` | | | |/ _` | |/ / _ \
|  __/ (_| | |  | |_| | | | (_| | |_| | (_| |   <  __/
 \___|\__,_|_|   \__|_| |_|\__, |\__,_|\__,_|_|\_\___|
                              |_|           }.
  gsub(/^\n/, '') + "v#{Earthquake::VERSION}".rjust(10) + "\n\n"
  print "\e[0m"
end

require 'earthquake'
if command
  Earthquake.invoke(command, options)
else
  Earthquake.start(options)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
earthquake-0.9.4 bin/earthquake