Class: ThemeJuice::Commands::Deploy

Inherits:
ThemeJuice::Command show all
Defined in:
lib/theme-juice/commands/deploy.rb

Instance Attribute Summary

Attributes inherited from Task

#tasks

Instance Method Summary collapse

Methods inherited from ThemeJuice::Command

#execute, #unexecute

Methods inherited from Task

#execute, #runner, #unexecute

Constructor Details

#initialize(opts = {}) ⇒ Deploy

Returns a new instance of Deploy.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/theme-juice/commands/deploy.rb', line 7

def initialize(opts = {})
  super

  @config.deployment.stages.keys.each do |stage|
    self.class.send :define_method, stage do |*args|
      @env.cap     = Capistrano::Application.new
      @env.stage   = stage.to_sym

      runner do |tasks|
        tasks << Tasks::Settings.new
        tasks << Tasks::Stage.new
        tasks << Tasks::VMStage.new
        tasks << Tasks::Load.new
        tasks << Tasks::Invoke.new(args)
      end

      self
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



28
29
30
# File 'lib/theme-juice/commands/deploy.rb', line 28

def method_missing(method, *args, &block)
  @io.error "It looks like the stage '#{method}' doesn't exist"
end