Sha256: bd3c2a7b68e3509e360d35960a9cd9e4f21477fc8a57bf59fb1171afbd3acce3

Contents?: true

Size: 1.3 KB

Versions: 22

Compression:

Stored size: 1.3 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

      cmd = "cd #{core_path} && wp core download"

      if config.wordpress.core
        cmd << " --version=#{config.wordpress.core}"
      end

      result = ssh.run(cmd)

      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

22 entries across 22 versions & 1 rubygems

Version Path
shuttle-deploy-0.4.0 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.3.3 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.3.2 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.3.1 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.3.0 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.3.0.beta1 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.3 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.2 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.1 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0.beta16 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0.beta15 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0.beta14 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0.beta13 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0.beta12 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0.beta11 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0.beta10 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0.beta9 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0.beta7 lib/shuttle/deployment/wordpress/core.rb
shuttle-deploy-0.2.0.beta6 lib/shuttle/deployment/wordpress/core.rb