class Disloku::Commands::Deploy

Public Class Methods

new(cliOptions) click to toggle source
Calls superclass method Disloku::BaseCoreCommand::new
# File lib/disloku/commands/Deploy.rb, line 12
def initialize(cliOptions)
        super(cliOptions)
end

Public Instance Methods

executeCommand(from) click to toggle source
# File lib/disloku/commands/Deploy.rb, line 16
def executeCommand(from)
        changesets = @repository.getChangeSets(from)
        dirty = changesets.any?() { |c| c.dirty?() }

        folderInput = {
                :options => @options,
                :changesets => changesets,
        }

        resolveTargets([@options.target]).each() do |t|
                begin
                        folderInput[:target] = t

                        result = Tasks::FolderTask.new(folderInput).execute()

                        sftpInput = result.merge({
                                :repository => @repository,
                                :options => @options,
                                :target => t,
                                :dirty => dirty,
                        })

                        result = Tasks::NetSftpTask.new(sftpInput).execute()
                rescue DislokuError => e
                        if (e.recoverable?)
                                Log.instance.error(e.message)
                                if (!CliAdapter.queryYesNo("Continue with next target?", true))
                                        return
                                end
                        else
                                raise
                        end
                end
        end
end