Class: CmdRemote

Inherits:
Cmd
  • Object
show all
Includes:
Puntfile
Defined in:
lib/punt/cmd/cmd_remote.rb

Constant Summary

Constants included from Puntfile

Puntfile::SUPPORTED_PUNTFILES

Instance Method Summary collapse

Methods included from Puntfile

#puntfile

Methods inherited from Cmd

#name, #options, #setup, #summary, tag

Instance Method Details

#run(argv) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/punt/cmd/cmd_remote.rb', line 9

def run(argv)
    env = argv.shift
    env = puntfile.first.first unless env

    environment = puntfile[env] if env

    if (!environment)
        raise "No environment #{env} was found in the puntfile"
    end

    mode = environment["mode"]

    if mode != "scp"
        raise "No mode available for the given mode '#{mode}'"
    end

    puts "Fetching Version for #{env}"
    puts ""

    # Upload Version File
    start_version = scp_fetch_versionfile("start", environment)
    success_version = scp_fetch_versionfile("success", environment)

    if (success_version == start_version)
        puts "Currently deployed version: #{success_version}"
    else
        puts "An aborted deployement was detected!"
        puts "\tLast Success: #{success_version}"
        puts "\tLast Attempt: #{start_version}"
    end
end