Class: Rsm::Runner
- Inherits:
-
Thor
- Object
- Thor
- Rsm::Runner
- Includes:
- Thor::Actions
- Defined in:
- lib/rsm/runner.rb
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 Thor::Runner, method missing is invoked and Thor::Runner is then responsable for finding the task in all classes.
- #version ⇒ Object
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 Thor::Runner, method missing is invoked and Thor::Runner is then responsable for finding the task in all classes.
22 23 24 25 26 27 28 |
# File 'lib/rsm/runner.rb', line 22 def method_missing(meth, *args) meth = meth.to_s initialize_thorfiles(meth) 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.
48 49 50 51 52 53 54 55 56 |
# File 'lib/rsm/runner.rb', line 48 def help(meth = nil) if meth && !self.respond_to?(meth) initialize_thorfiles(meth) klass, task = Thor::Util.find_class_and_task_by_namespace(meth) klass.start(["-h", task].compact, :shell => self.shell) else super end end |
#list(search = "") ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rsm/runner.rb', line 32 def list(search="") initialize_thorfiles 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(false, false, klasses) end |