Sha256: 4b5b8702e9fa9ac7748a3ded322b5381220a1302d0a36eec5250c78ee323b9a4

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

module Shuttle
  module WordpressCore
    # Get wordpress shared core path
    # @return [String]
    def core_path
      @core_path ||= shared_path('wordpress/core')
    end

    # Check if wordpress core is installed
    # @return [Boolean]
    def core_installed?
      ssh.directory_exists?(core_path) &&
      !ssh.capture("ls #{core_path}").empty?
    end

    # Install wordpress shared core
    # @param [Boolean] overwrite existing code
    # @return [Boolean]
    def core_install(overwrite=true)
      if core_installed? && overwrite == true
        core_remove
      end

      log "Installing wordpress core"

      unless ssh.directory_exists?(core_path)
        ssh.run("mkdir -p #{core_path}")
      end

      result = ssh.run("cd #{core_path} && wp core download")

      if result.success?
        log "Wordpress core installed"
      else
        error "Unable to install wordpress core: #{result.output}"
      end
    end

    # Remove wordpress shared core
    # @return [Boolean]
    def core_remove
      if ssh.directory_exists?(core_path)
        log "Removing wordpress shared core"
        ssh.run("rm -rf #{core_path}")
      end

      ssh.directory_exists?(core_path)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shuttle-deploy-0.2.0.beta3 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0.beta2 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0.beta1 lib/shuttle/deployment/wordpress/core.rb