Skip to content

Commit

Permalink
Added drydock to vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
delano committed Dec 12, 2009
1 parent 7399b94 commit 25ee854
Show file tree
Hide file tree
Showing 14 changed files with 2,023 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bin/bone
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ BASE_PATH = File.expand_path File.join(File.dirname(__FILE__), '..')
lib_dir = File.join(BASE_PATH, 'lib')
$:.unshift lib_dir

require 'drydock'
require 'bone'

Bone.require_vendor 'drydock', '0.6.8'

require 'bone/cli'

# Command-line interface for bin/stella
Expand All @@ -19,8 +22,12 @@ class Bone::CLI::Definition
Bone.enable_debug
end

usage "bone get keyname"
usage "bone keyname"
command :get => Bone::CLI

usage "bone set keyname keyvalue"
usage "bone set keyname path/2/file"
option :s, :string, "Assume value is a string even if file name exists"
command :set => Bone::CLI
end
Expand Down
20 changes: 20 additions & 0 deletions lib/bone.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
unless defined?(BONE_HOME)
BONE_HOME = File.expand_path(File.join(File.dirname(__FILE__), '..') )
end

module Bone
extend self
Expand Down Expand Up @@ -59,6 +62,23 @@ def request(action, cid, key, params={})
exit 1
end

# <tt>require</tt> a library from the vendor directory.
# The vendor directory should be organized such
# that +name+ and +version+ can be used to create
# the path to the library.
#
# e.g.
#
# vendor/httpclient-2.1.5.2/httpclient
#
def self.require_vendor(name, version)
path = File.join(BONE_HOME, 'vendor', "#{name}-#{version}", 'lib')
$:.unshift path
Bone.ld "REQUIRE VENDOR: ", path
require name
end


module Aware
def bone(key)
end
Expand Down
159 changes: 159 additions & 0 deletions vendor/drydock-0.6.8/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
DRYDOCK, CHANGES

#### 0.6.9 (2009-10-??) #############################

* CHANGE: Using autoload where appropriate.

#### 0.6.8 (2009-09-15) #############################

* FIXED: require 'thread' added to Drydock::Screen
* FIXED: require 'drydock/console'


#### 0.6.7 (2009-09-15) #############################

* ADDED: Drydock::Screen

#### 0.6.6 (2009-06-24) #############################

NOTE: Because at_exit has been removed, Drydock scripts will no longer
run automatically. You can explicitly call the following at the bottom
of your scripts:

Drydock.run!(ARGV, STDIN) if Drydock.run?

* CHANGE: Removed at_exit
* CHANGE: Drydock.run? will now return false if Drydock hasl already run


#### 0.6.5 (2009-05-21) #############################

* ADDED: "with_args" support for default command. When specified,
arguments can be passed to the default command with run in the
short form. e.g. "script arg1 arg2" == "script cmdname arg1 arg2"

#### 0.6.3 (2009-05-10) #############################

* ADDED: show-commands now displays a note about which command is the default
* CHANGE: Moved mixins to lib/drydock/mixins (so other projects can require 'drydock/mixins')
* FIXED: Support for inline command aliases when specifying a class:
command [:name, :alias1, :alias2] => SomeClass


#### 0.6.2 (2009-05-07) #############################

* ADDED: drydock/console.rb to start a new wing in the drydock
* ADDED: mixins for String and Object (for Console)


#### 0.6.1 (2009-05-03) #############################

* FIXED: @@trawler raises an error in Ruby 1.8 if it's a Symbol


#### 0.6.0 (2009-04-30) #############################

* CHANGE: Cleaner default error message for UnknownCommand exceptions
* CHANGE: 'desc' is now 'about' (desc works, but it prints a notice)
* CHANGE: I now recommend implementing the Drydock DSL in a module.
bin/example was updated to reflect the change. This prevents Drydock
keywords from being included in the global namespace.
* ADDED: Inline commands aliases. command :cmd1, :cmd2 do; ...; end
* ADDED: Unknown commands can be directed to a trawler.


#### 0.5.6 (2009-04-22) #############################

* CHANGED: Interrupts now handled in rescue rather than a trap.
* ADDED: Drydock::ArgError and Drydock::OptError are rescued at runtime by default

#### 0.5.5 (2009-04-19) #############################

* CHANGED: Improved help screen formatting.

#### 0.5.4 (2009-04-15) #############################

* ADDED: Better error handling with new Drydock::ArgError and Drydock::OptError

#### 0.5.3 (2009-04-05) #############################

* FIXED: Command actions were not being handled correctly. Added rdocs to
clarify the code.

#### 0.5.2 (2009-04-04) #############################

* ADDED: before and after blocks now receive a primed reference to the
command object (which gives them access to the globals and options)
* CHANGE: The prep stuff in Drydock::Command#call is now split into a
separate method: prepare so call no longer takes arguments.
* FIXED: Drydock#capture_io was using yield. It now accepts a block instead.


#### 0.5.1 (2009-03-15) #############################

* FIXED: Prevent calling default command in at_exit when there's a LoadError.
* FIXED: Exit gracefully when the application exits.
* FIXED: Print command names with dashes rather than underscores


#### 0.5 (2009-03-11) ###############################

* ADDED: Checks that the command class is a subclass of Drydock::Command
* CHANGE: Cleaned up show-commands screen
* FIXED: Help didn't work when using command alias
* ADDED: Named argv values.
* CHANGE: argv are now part of the Command class (not passed to command blocks)
* CHANGE: "project" now automatically requires the lowercase name of the project
and gracefully continues if the require failed.
* CHANGE: Drydock will look for different validation method, based on the method
being executed. If a validation method is found it's executed and
must return a true valid (it can also raise its own exceptions).
* ADDED: command actions. These are boolean switches with a twist. Drydock looks
for command_action or action_command methods. Saves checking the switches
and sending to other methods manually.


#### 0.4 (2009-02-28) ###############################

* FIXED: "interning empty string" error when bare "option" is used
* ADDED: Calls valid? method (if present) before calling command block.
* ADDED: "capture" method. Auto capture STDOUT to obj.stdout etc...
* ADDED: Automatically calls init and print_header methods before the command
and print_footer after the command (if available)
* ADDED: Tries to call obj.command if available when no block is supplied
* ADDED: "show_commands" command built-in. Displays commands with descriptions
* ADDED: A default usage help msg for every command: "#{$0} command-name"
* ADDED: "usage" work multiple times for the same command.
* ADDED: "desc" method for per command descriptions
* CHANGE: options are now stored as obj.option.name instead of obj.name
* CHANGE: global options are now stored as obj.globals.name
* CHANGE: removed auto importing methods
OLD: require 'drydock'
ADDED: require 'drydock'
extend Drydock


#### 0.3.3 (2009-02-14) ###############################

* ADDED: init method hook for subclasses of Drydock::Command
* UPDATED: Rdocs
* CHANGE: added method command_aliaz to mirror aliaz_command


#### 0.3 (2009-02-05) ###############################

* Added support for custom Drydock::Commands objects
* Global and command-specific options are now available as
attributes of the Drydock::Commands class instance.
* Automatic execution
* Now in a single file (lib/drydock.rb)
* Started adding tests
* Improved documentation


#### 0.2 (2008-12-27) ###############################

* Initial release
* Forked from bmizerany/frylock


22 changes: 22 additions & 0 deletions vendor/drydock-0.6.8/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2008-2009 Delano Mandelbaum, Solutious Inc.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
92 changes: 92 additions & 0 deletions vendor/drydock-0.6.8/README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
= Drydock - v0.6

<b>Build seaworthy command-line apps like a Captain with a powerful Ruby DSL.</b>

== Overview

Drydock is a seaworthy DSL for building really powerful command line applications. The core class is contained in a single .rb file so it's easy to copy directly into your project. See below for examples.

== Install

One of:

* gem install drydock
* copy lib/drydock.rb into your lib directory.

Or for GitHub fans:

* git clone git://github.com/delano/drydock.git
* gem install delano-drydock

== Examples

See bin/example for more.

require 'drydock'
extend Drydock

default :welcome

before do
# You can execute a block before the requests command is executed. Instance
# variables defined here will be available to all commands.
end

about "A friendly welcome to the Drydock"
command :welcome do
puts "Welcome to Drydock."
puts "For available commands:"
puts "#{$0} show-commands"
end

usage "USAGE: #{$0} laugh [-f]"
about "The captain commands his crew to laugh"
option :f, :faster, "A boolean value. Go even faster!"
command :laugh do |obj|
# +obj+ is an instance of Drydock::Command. The options you define are available
# via obj.option.name

answer = !obj.option.faster ? "Sort of" : "Yes! I'm literally laughing as fast as possible."

puts "Captain Stubing: Are you laughing?"
puts "Dr. Bricker: " << answer
end


class JohnWestSmokedOysters < Drydock::Command
# You can write your own command classes by inheriting from Drydock::Command
# and referencing it in the command definition.
def ahoy!; p "matey"; end
end

about "Do something with John West's Smoked Oysters"
command :oysters => JohnWestSmokedOysters do |obj|
p obj # => #<JohnWestSmokedOysters:0x42179c ... >
end

about "My way of saying hello!"
command :ahoy! => JohnWestSmokedOysters
# If you don't provide a block, Drydock will call JohnWestSmokedOysters#ahoy!

Drydock.run!


== More Information

* GitHub[http://github.com/delano/drydock]
* RDocs[http://drydock.rubyforge.org/]
* Inspiration[http://www.youtube.com/watch?v=m_wFEB4Oxlo]

== Thanks

* Solutious Inc for putting up with my endless references to the sea! (http://solutious.com)
* Blake Mizerany for the inspiration via bmizerany-frylock[http://github.com/bmizerany/frylock]

== Credits

* Delano Mandelbaum (delano@solutious.com)
* Bernie Kopell (bernie@solutious.com)

== License

See LICENSE.txt
Loading

0 comments on commit 25ee854

Please sign in to comment.