Method: Wordmove::Deployer::Base.deployer_for

Defined in:
lib/wordmove/deployer/base.rb

.deployer_for(cli_options) ⇒ Object

Raises:



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

def deployer_for(cli_options)
  movefile = Wordmove::Movefile.new(cli_options[:config])
  movefile.load_dotenv(cli_options)

  options = movefile.fetch.merge! cli_options
  environment = movefile.environment(cli_options)

  return FTP.new(environment, options) if options[environment][:ftp]

  if options[environment][:ssh] && options[:global][:sql_adapter] == 'wpcli'
    return Ssh::WpcliSqlAdapter.new(environment, options)
  end

  if options[environment][:ssh] && options[:global][:sql_adapter] == 'default'
    return Ssh::DefaultSqlAdapter.new(environment, options)
  end

  raise NoAdapterFound, "No valid adapter found."
end