Socket
Book a DemoInstallSign in
Socket

drydock

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drydock

1.0.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Drydock - v1.0

Build seaworthy command-line apps like a Captain with a powerful Ruby DSL.

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
  • RDocs
  • Inspiration

Thanks

Credits

License

See LICENSE.txt

FAQs

Package last updated on 15 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.