Class: Wordmove::Deployer::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/wordmove/deployer/base.rb

Direct Known Subclasses

FTP, SSH

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



35
36
37
38
39
# File 'lib/wordmove/deployer/base.rb', line 35

def initialize(options = {})
  @options = options
  @logger = Logger.new(STDOUT)
  @logger.level = Logger::DEBUG
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



11
12
13
# File 'lib/wordmove/deployer/base.rb', line 11

def logger
  @logger
end

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/wordmove/deployer/base.rb', line 10

def options
  @options
end

Class Method Details

.deployer_for(options) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/wordmove/deployer/base.rb', line 13

def self.deployer_for(options)
  options = fetch_movefile(options[:config]).merge(options)
  recursive_symbolize_keys!(options)
  if options[:remote][:ftp]
    require 'wordmove/deployer/ftp'
    FTP.new(options)
  elsif options[:remote][:ssh]
    require 'wordmove/deployer/ssh'
    SSH.new(options)
  else
    raise Thor::Error, "No valid adapter found."
  end
end

.fetch_movefile(path) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/wordmove/deployer/base.rb', line 27

def self.fetch_movefile(path)
  path ||= "Movefile"
  unless File.exists?(path)
    raise Thor::Error, "Could not find a valid Movefile"
  end
  YAML::load(File.open(path))
end

Instance Method Details

#pull_dbObject



45
46
47
# File 'lib/wordmove/deployer/base.rb', line 45

def pull_db
  logger.task "Pulling Database"
end

#push_dbObject



41
42
43
# File 'lib/wordmove/deployer/base.rb', line 41

def push_db;
  logger.task "Pushing Database"
end

#remote_get_directory(directory) ⇒ Object



49
# File 'lib/wordmove/deployer/base.rb', line 49

def remote_get_directory(directory); end

#remote_put_directory(directory) ⇒ Object



50
# File 'lib/wordmove/deployer/base.rb', line 50

def remote_put_directory(directory); end