Class: DanarchyDeploy::Applicator::WordPress::WPCLI

Inherits:
Object
  • Object
show all
Defined in:
lib/danarchy_deploy/applicator/wordpress/wpcli.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options) ⇒ WPCLI

Returns a new instance of WPCLI.



5
6
7
8
9
10
11
12
13
# File 'lib/danarchy_deploy/applicator/wordpress/wpcli.rb', line 5

def initialize(app, options)
  puts "\n > Initializing WordPress CLI"
  @database = app[:database]
  @prefix   = app[:prefix]
  @path     = app[:path]
  @user     = app[:user]
  @options  = options
  wpcli_install
end

Instance Method Details

#check_updateObject



30
31
32
33
# File 'lib/danarchy_deploy/applicator/wordpress/wpcli.rb', line 30

def check_update
  cmd = @prefix + "'wp core check-update --path=#{@path}'"
  DanarchyDeploy::Helpers.run_command(cmd, @options)
end

#importObject



46
47
48
49
# File 'lib/danarchy_deploy/applicator/wordpress/wpcli.rb', line 46

def import
  cmd = @prefix + "'wp db import #{@database[:backup]} --path=#{@path}'"
  DanarchyDeploy::Helpers.run_command(cmd, @options)
end

#installObject



15
16
17
18
# File 'lib/danarchy_deploy/applicator/wordpress/wpcli.rb', line 15

def install
  cmd = @prefix + "'wp core download --path=#{@path}'"
  DanarchyDeploy::Helpers.run_command(cmd, @options)
end

#siteurlObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/danarchy_deploy/applicator/wordpress/wpcli.rb', line 35

def siteurl
  cmd = @prefix + "'wp option get siteurl --path=#{@path}'"
  siteurl = DanarchyDeploy::Helpers.run_command(cmd, @options)

  if siteurl[:stdout]
    return siteurl[:stdout].chomp
  else
    return siteurl[:stderr]
  end
end

#updateObject



20
21
22
23
# File 'lib/danarchy_deploy/applicator/wordpress/wpcli.rb', line 20

def update
  cmd = @prefix + "'wp core update --path=#{@path}'"
  DanarchyDeploy::Helpers.run_command(cmd, @options)
end

#versionObject



25
26
27
28
# File 'lib/danarchy_deploy/applicator/wordpress/wpcli.rb', line 25

def version
  cmd = @prefix + "'wp core version --path=#{@path}'"
  DanarchyDeploy::Helpers.run_command(cmd, @options)
end