Class: Disloku::Commands::Deploy

Inherits:
BaseCoreCommand show all
Defined in:
lib/disloku/commands/Deploy.rb

Instance Attribute Summary

Attributes inherited from BaseCoreCommand

#config, #options, #repository

Attributes inherited from BaseCommand

#config, #options, #repository

Instance Method Summary collapse

Methods inherited from BaseCoreCommand

#execute, #loadConfiguration, #resolveTargets

Methods inherited from BaseCommand

#processGlobalOptions

Constructor Details

#initialize(cliOptions) ⇒ Deploy

Returns a new instance of Deploy.



12
13
14
# File 'lib/disloku/commands/Deploy.rb', line 12

def initialize(cliOptions)
	super(cliOptions)
end

Instance Method Details

#executeCommand(from) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 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