Sha256: a663b554202559e29fd4d34fc24c626f283bb61ed63713bd17a3d03ecdfd7efb

Contents?: true

Size: 676 Bytes

Versions: 6

Compression:

Stored size: 676 Bytes

Contents

module Wordmove
  class Doctor
    class Wpcli
      attr_reader :logger

      def initialize
        @logger = Logger.new(STDOUT).tap { |l| l.level = Logger::INFO }
      end

      def check!
        logger.task "Checking local wp-cli installation"

        if in_path? && up_to_date?
          logger.success "wp-cli is correctly installed and up to date"
        else
          logger.error "wp-cli is not installed (or not in your $PATH) or not up to date"
        end
      end

      private

      def in_path?
        system('which wp', out: File::NULL)
      end

      def up_to_date?
        `wp cli check-update --format=json`.empty?
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wordmove-2.4.4 lib/wordmove/doctor/wpcli.rb
wordmove-2.4.3 lib/wordmove/doctor/wpcli.rb
wordmove-2.4.2 lib/wordmove/doctor/wpcli.rb
wordmove-2.4.1 lib/wordmove/doctor/wpcli.rb
wordmove-2.4.0 lib/wordmove/doctor/wpcli.rb
wordmove-2.3.1 lib/wordmove/doctor/wpcli.rb