Class: Capricorn::CLI

Inherits:
Thor show all
Defined in:
lib/capricorn-client.rb

Defined Under Namespace

Classes: Applications, ApplicationsDomains, ApplicationsGems, Builder, Deployer, Gems, Machines, Releaser

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



48
49
50
51
52
53
54
55
56
57
# File 'lib/capricorn-client.rb', line 48

def method_missing(meth, *args)
  if self.class == Capricorn::CLI
    meth = meth.to_s
    klass, task = Thor::Util.find_class_and_task_by_namespace(meth)
    args.unshift(task) if task
    klass.start(args, :shell => self.shell)
  else
    super
  end
end

Class Method Details



35
36
37
# File 'lib/capricorn-client.rb', line 35

def self.banner(task)
  "#{banner_base} #{task.formatted_usage(self, true)}"
end

.start(given_args = ARGV, config = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/capricorn-client.rb', line 23

def self.start(given_args = ARGV, config = {})
  if self == Capricorn::CLI
    case given_args[0]
    when 'deploy'
      given_args[0] = 'deploy:version'
    when 'build'
      given_args[0] = 'build:current'
    end
  end
  super(given_args, config)
end

Instance Method Details

#help(meth = nil) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/capricorn-client.rb', line 39

def help(meth=nil)
  if meth && !self.respond_to?(meth)
    klass, task = Thor::Util.find_class_and_task_by_namespace(meth)
    klass.start(["-h", task].compact, :shell => self.shell)
  else
    super
  end
end