== Description A command/task framework similar to rake and thor that opens your ruby universe to the commandline and irb. For my libraries that use this, see {irbfiles}[http://github.com/cldwalker/irbfiles]. == Features * Commands are just methods that are extended by the toplevel object, main. * Commands are accessible from the commandline or irb. * Command libraries can be written as plain ruby which allows for easy testing and use outside of boson. * Commands can be full-blown commandline apps thanks to automatic views from hirb and powerful options similar to thor's. * Command libraries are social as a user can install them from a url and then customize command names and options without changing the original library. * Namespaces are optional and when used are methods which allows for method_missing magic. == Irb Example To use in irb, drop this in your irbrc: require 'boson' Boson.start :verbose=>true Let's start up irb: bash> irb Loaded library core Loaded library web_core # List default libraries >> libraries +----------+----------+------+--------------+ | name | commands | gems | library_type | +----------+----------+------+--------------+ | core | 6 | | module | | web_core | 3 | | module | +----------+----------+------+--------------+ 2 rows in set # List default commands >> commands +--------------+----------+-------+--------------------------------------------+-----------------------------------------------------------------------------+ | full_name | lib | alias | usage | description | +--------------+----------+-------+--------------------------------------------+-----------------------------------------------------------------------------+ | usage | core | | [name][--verbose] | Print a command's usage | | libraries | core | | [query=''][--index] [--query_fields=A,B,C] | List or search libraries | | render | core | | [object] [options={}] | Render any object using Hirb | | load_library | core | | [library][--verbose] [--reload] | Load/reload a library | | commands | core | | [query=''][--index] [--query_fields=A,B,C] | List or search commands | | menu | core | | [output] [options={}] [&block] | Provide a menu to multi-select elements from a given array | | get | web_core | | [url] | Gets the body of a url | | install | web_core | | [url][--force] [--name=NAME] | Installs a library by url. Library should then be loaded with load_library. | | browser | web_core | | [*urls] | Opens urls in a browser | +--------------+----------+-------+--------------------------------------------+-----------------------------------------------------------------------------+ 9 rows in set # Boson commands can behave like shell commands: # Basic help >> commands '-h' commands [query=''][--index] [--query_fields=A,B,C] # Search the lib column for web >> commands 'web -q=lib' # or 'web --query_fields=lib' +-----------+----------+-------+------------------------------+-----------------------------------------------------------------------------+ | full_name | lib | alias | usage | description | +-----------+----------+-------+------------------------------+-----------------------------------------------------------------------------+ | get | web_core | | [url] | Gets the body of a url | | install | web_core | | [url][--force] [--name=NAME] | Installs a library by url. Library should then be loaded with load_library. | | browser | web_core | | [*urls] | Opens urls in a browser | +-----------+----------+-------+------------------------------+-----------------------------------------------------------------------------+ 3 rows in set == Commandline Example # Just like in irb bash> boson libraries +----------+----------+------+--------------+ | name | commands | gems | library_type | +----------+----------+------+--------------+ | core | 6 | | module | | web_core | 3 | | module | +----------+----------+------+--------------+ 2 rows in set # Let's install another library bash> boson install http://github.com/cldwalker/irbfiles/raw/master/boson/commands/irb_core.rb Saved to /Users/bozo/.boson/commands/irb_core.rb # Let's start irb ... bash> irb >> commands +-------------------------------+----------+------------+--------------------------------------------+-----------------------------------------------------------------------------+ | full_name | lib | alias | usage | description | +-------------------------------+----------+------------+--------------------------------------------+-----------------------------------------------------------------------------+ | usage | core | | [name][--verbose] | Print a command's usage | | libraries | core | | [query=''][--index] [--query_fields=name] | List or search libraries | | render | core | | [object] [options={}] | Render any object using Hirb | | load_library | core | | [library][--verbose] [--reload] | Load/reload a library | | commands | core | | [query=''][--index] [--query_fields=A,B,C] | List or search commands | | menu | core | | [output] [options={}] [&block] | Provide a menu to multi-select elements from a given array | | get | web_core | | [url] | Gets the body of a url | | install | web_core | | [url][--force] [--name=NAME] | Installs a library by url. Library should then be loaded with load_library. | | browser | web_core | | [*urls] | Opens urls in a browser | | irb_pop_workspace | irb_core | popws | | Pops current workspace and changes to next workspace in context | | irb_require | irb_core | | | Evals file like require line by line | | public | irb_core | | | Works same as module#public | | private | irb_core | | | Works same as module#private | | irb | irb_core | | | Starts a new workspace/subsession | | irb_push_workspace | irb_core | pushws | | Creates a workspace for given object and pushes it into the current context | | irb_load | irb_core | | | Evals file like load line by line | | irb_change_workspace | irb_core | cws | | Changes current workspace to given object | | irb_source | irb_core | source | | Evals full path file line by line | | irb_jobs | irb_core | jobs | | List workspaces/subsessions | | irb_fg | irb_core | fg | | Switch to a workspace/subsession | | irb_help | irb_core | help | | Ri based help | | irb_kill | irb_core | kill | | Kills a given workspace/subsession | | include | irb_core | | | Works same as module#include | | irb_exit | irb_core | exit | | Kills the current workspace/subsession | | irb_workspaces | irb_core | workspaces | | Array of workspaces for current context | | irb_context | irb_core | conf | | Displays configuration for current workspace/subsession | | install_alias_method | irb_core | | | Aliases given method, allows lazy loading of dependent file | | irb_current_working_workspace | irb_core | cwws | | Prints current workspace | +-------------------------------+----------+------------+--------------------------------------------+-----------------------------------------------------------------------------+ 28 rows in set # Sweet! Now we have a list and description of commands that come with irb. == Creating commands TODO: Explain library format == Todo * More docs * More tests * Add tags to libraries + commands