Class: SSP::App
Defined Under Namespace
Classes: Bags, Chef, Domain, Node, OfficeNode, Pair, Remote
Instance Method Summary collapse
-
#help(meth = nil) ⇒ Object
Override Thor#help so it can give information about any class and any method.
- #list(search = "") ⇒ Object
-
#method_missing(meth, *args) ⇒ Object
If a task is not found on SSP::App, method missing is invoked and SSP::App is then responsable for finding the task in all classes.
- #version ⇒ Object
Methods included from ThorExtensions
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
If a task is not found on SSP::App, method missing is invoked and SSP::App is then responsable for finding the task in all classes.
36 37 38 39 40 41 42 |
# File 'lib/ssp/app.rb', line 36 def method_missing(meth, *args) meth = meth.to_s initialize_commands klass, task = Thor::Util.find_class_and_task_by_namespace(meth) args.unshift(task) if task klass.start(args, :shell => self.shell) end |
Instance Method Details
#help(meth = nil) ⇒ Object
Override Thor#help so it can give information about any class and any method.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ssp/app.rb', line 19 def help(meth=nil) if meth && !self.respond_to?(meth) initialize_commands klass, task = Thor::Util.find_class_and_task_by_namespace(meth) if klass klass.start(["-h", task].compact, :shell => self.shell) else super end else super end end |
#list(search = "") ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ssp/app.rb', line 52 def list(search="") initialize_commands search = ".*#{search}" if ["substring"] search = /^#{search}.*/i group = [:group] || "standard" klasses = Thor::Base.subclasses.select do |k| ([:all] || k.group == group) && k.namespace =~ search end display_klasses(klasses) end |