forked from raggi/thin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make -d and -v options behave like command equivalents. git-svn-id: http://code.macournoyer.com/svn/thin/trunk@347 ab7993de-5426-0410-a80b-baa00616f331
- Loading branch information
macournoyer
committed
Nov 28, 2007
1 parent
353cdc6
commit c12955e
Showing
7 changed files
with
57 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require 'transat/parser' | ||
|
||
module Thin | ||
def self.define_commands(&block) | ||
begin | ||
Transat::Parser.parse_and_execute(ARGV, &block) | ||
rescue CommandError => e | ||
puts "Error: #{e}" | ||
end | ||
end | ||
|
||
class CommandError < StandardError; end | ||
|
||
class Command | ||
attr_reader :args | ||
|
||
def initialize(non_options, options) | ||
@args = non_options | ||
|
||
options.each do |option, value| | ||
self.send("#{option}=", value) | ||
end | ||
end | ||
|
||
def self.command_name | ||
self.name.match(/::(\w+)$/)[1].downcase | ||
end | ||
|
||
def self.detailed_help | ||
<<-EOF | ||
usage: #{File.basename($PROGRAM_NAME)} #{command_name} | ||
#{help} | ||
EOF | ||
end | ||
|
||
protected | ||
def error(message) | ||
raise CommandError, message | ||
end | ||
end | ||
|
||
module Commands; end | ||
Dir[File.dirname(__FILE__) + '/commands/**/*.rb'].each { |l| require l } | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters