Class: Wukong::Deploy::DeployRunner

Inherits:
Runner
  • Object
show all
Includes:
Logging
Defined in:
lib/wukong-deploy/deploy_runner.rb

Overview

A Runner class that implements wu-deploy.

Instance Method Summary collapse

Instance Method Details

#actionString

The action, or first argument given.

Returns:

  • (String)


31
32
33
# File 'lib/wukong-deploy/deploy_runner.rb', line 31

def action
  args.first
end

#directoryString

The directory, or second argument given.

Returns:

  • (String)


38
39
40
# File 'lib/wukong-deploy/deploy_runner.rb', line 38

def directory
  args[1]
end

#runObject

Run the requested action.



59
60
61
62
63
64
65
66
67
68
# File 'lib/wukong-deploy/deploy_runner.rb', line 59

def run
  case action
  when 'new'
    require_relative('templater')
    Templater.new(File.expand_path(directory, Dir.pwd), settings).run!
  when 'console'
    require_relative('console')
    Wukong::Deploy::Console.new.run!
  end
end

#validatetrue

Validate that the requested action is known and that its arguments are valid.

Returns:

  • (true)

Raises:

  • (Wukong::Error)

    if the action or its arguments are invalid



47
48
49
50
51
52
53
54
55
56
# File 'lib/wukong-deploy/deploy_runner.rb', line 47

def validate
  case action
  when 'new'
    raise Error.new("Must provide a path to the root of the deploy pack you want to create") if directory.nil? || directory.blank?
  when 'console'
  else
    raise Error.new("Invalid action: <#{action}>.")
  end
  true
end