Class: Rubble::Command::Upload

Inherits:
Base
  • Object
show all
Defined in:
lib/rubble/command/upload.rb

Instance Attribute Summary

Attributes inherited from Base

#context, #local, #plan, #remote

Instance Method Summary collapse

Methods inherited from Base

#deploy_dir, #env, #initialize, #resolve, #resource, #server, #target

Constructor Details

This class inherits a constructor from Rubble::Command::Base

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rubble/command/upload.rb', line 7

def execute
    snapshot = resource.snapshot
    target_dir = File.join(deploy_dir, snapshot.version)

    @log.debug("Uploading snapshot #{snapshot}")

    remote.mkdir(target_dir)
    remote.cd(deploy_dir, true)

    if not snapshot.empty? then
        if remote.file_exists?('current') then
            # remote.rsync('current/', "#{snapshot.version}/")
        end

        remote.sync_up(snapshot.filesets, target_dir)
    end

    remote.symlink(snapshot.version, 'current')
end