Class: Wordmove::Deployer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Deployer

Returns a new instance of Deployer.



14
15
16
17
18
# File 'lib/wordmove/deployer.rb', line 14

def initialize(options = {})
  @options = Hashie::Mash.new(options)
  @logger = Logger.new
  @logger.level = options.verbose ? Logger::VERBOSE : Logger::INFO
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



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

def logger
  @logger
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#pullObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/wordmove/deployer.rb', line 38

def pull
  informative_errors do
    unless options.skip_db
      logger.info "Pulling the DB..."
      pull_db
    end

    remotely do |host|
      %w(uploads themes plugins).each do |step|
        unless options.send("skip_#{step}")
          logger.info "Pulling wp-content/#{step}..."
          host.upload_dir remote_wpcontent_path(step), local_wpcontent_path(step)
        end
      end
    end
  end
end

#pushObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/wordmove/deployer.rb', line 20

def push
  informative_errors do
    unless options.skip_db
      logger.info "Pushing the DB..."
      push_db
    end

    remotely do |host|
      %w(uploads themes plugins).each do |step|
        unless options.send("skip_#{step}")
          logger.info "Pushing wp-content/#{step}..."
          host.download_dir local_wpcontent_path(step), remote_wpcontent_path(step)
        end
      end
    end
  end
end