Class: Cloudshaper::Remote

Inherits:
Command
  • Object
show all
Includes:
Aws::RemoteS3
Defined in:
lib/cloudshaper/remote.rb

Overview

Wrap ‘remote’ commands, such as config, pull, and push This allows us to store state remotely using different providers

Defined Under Namespace

Classes: RemoteNotSupported

Instance Attribute Summary

Attributes inherited from Command

#command

Instance Method Summary collapse

Methods inherited from Command

#env

Constructor Details

#initialize(stack, command) ⇒ Remote

Returns a new instance of Remote.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cloudshaper/remote.rb', line 9

def initialize(stack, command)
  super
  unless @stack.remote.first
    puts "\tWARNING: #{@stack.name} is not configured with a remote backend"
    return
  end

  backend = @stack.remote.keys.first
  sym = "options_for_#{backend}"

  if self.respond_to?(sym, include_private: true)
    @command = send(sym, command)
  else
    fail RemoteNotSupported, "Remote backend #{backend} is not supported yet"
  end
end

Instance Method Details

#executeObject



26
27
28
29
# File 'lib/cloudshaper/remote.rb', line 26

def execute
  return unless @stack.remote.first
  super
end