Class: Hodor::Cli::Runner
- Inherits:
-
Thor::Runner
- Object
- Thor::Runner
- Hodor::Cli::Runner
- Defined in:
- lib/hodor/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/hodor/cli.rb', line 93 def method_missing(meth, *args) if args[0].eql?('nocorrect') fail %Q[You are using a shell alias with an improper trailing space. For example: alias dj='bundle exec hodor oozie:display_job' (works) alias dj='bundle exec hodor oozie:display_job ' (fails)] end super meth, *args rescue raise end |
Class Method Details
.handle_no_command_error(command, bv) ⇒ Object
104 105 106 |
# File 'lib/hodor/cli.rb', line 104 def self.handle_no_command_error(command, bv) raise CommandNotFound.new("No Such Command: #{command.inspect}") end |
Instance Method Details
#help(meth = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/hodor/cli.rb', line 23 def help(meth = nil) if meth && !self.respond_to?(meth) super else overview = %Q[Hodor is an object-oriented scripting toolkit and Ruby-based API that automates and simplifies the way you specify, deploy, test, inspect and administer your hadoop cluster and Oozie workflows. Hodor commands follow the convention of: $ hodor [namespace]:[command] [arguments] [options] To get more information about the namespaces and commands available in Hodor, run: $ hodor -T WARNING! Hodor must be run via 'bundle exec'. For example: $ bundle exec hodor -T Note: examples shown in help pages don't show the 'bundle exec' prefix because they assume you have the following alias in place: $ alias hodor='bundle exec hodor' ].unindent(10) say overview end end |
#list(search = "") ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/hodor/cli.rb', line 51 def list(search = "") overview = %Q[ Hodor's Namespaces & Commands ====================================================================================================== Hodor divides its command set into the namespaces shown below (e.g. 'oozie', 'hdfs', 'master' etc.) Each namespace contains a set of commands that support the overall purpose of its parent namespace. For example, the hdfs namespace includes commands to list, put and get files to/from a remote HDFS volume. The following table shows all the namespaces Hodor supports, along with a short description of the commands that fall within each namespace. ].unindent(8) say overview super more_help = %Q[Getting More Help: ------------------ Each Hodor namespace offers full help, including an overview of the namespace itself, references to "topic pages" that explain core concepts implemented by the namespace and detailed help for each command that falls within the namespace. To access help for a Hodor namespace, run hodor passing <namespace> as the sole argument. For example, to see help for Hodor's Oozie namespace, run: $ hodor oozie $ hodor help oozie # alternate, works the same Furthermore, to see detailed help for the oozie:display_job command, run: $ hodor help oozie:display_job $ hodor oozie:help display_job # alternate, works the same Lastly, to see the topic page that explains the "corresponding paths" concept, that is central to the Hdfs namespace, run: $ hodor hdfs:topic corresponding_paths And to obtain a list of all topics available within the oozie namespace, for example, run: $ hodor oozie:topics ].unindent(8) say more_help end |