Sha256: ca8e06fee392c53453abb664eb62849683b9d99c6858296988c6811fdf928955

Contents?: true

Size: 1.89 KB

Versions: 15

Compression:

Stored size: 1.89 KB

Contents

require 'thor'
require 'wordmove/generators/movefile'
require 'wordmove/deployer/base'

module Wordmove
  class CLI < Thor

    desc "init", "Generates a brand new Movefile"
    def init
      Wordmove::Generators::Movefile.start
    end

    shared_options = {
      :wordpress   => { :aliases => "-w", :type => :boolean },
      :uploads     => { :aliases => "-u", :type => :boolean },
      :themes      => { :aliases => "-t", :type => :boolean },
      :plugins     => { :aliases => "-p", :type => :boolean },
      :languages   => { :aliases => "-l", :type => :boolean },
      :db          => { :aliases => "-d", :type => :boolean },

      :verbose     => { :aliases => "-v", :type => :boolean },
      :simulate    => { :aliases => "-s", :type => :boolean },
      :environment => { :aliases => "-e"                    },
      :config      => { :aliases => "-c"                    },

      :no_adapt    => { :type => :boolean                   },
      :all         => { :type => :boolean                   }
    }

    no_tasks do
      def handle_options(options)
        %w(wordpress uploads themes plugins languages db).map(&:to_sym).each do |task|
          if options[task] || options[:all]
            yield task
          end
        end
      end
    end

    desc "pull", "Pulls WP data from remote host to the local machine"
    shared_options.each do |option, args|
      method_option option, args
    end
    def pull
      deployer = Wordmove::Deployer::Base.deployer_for(options)
      handle_options(options) do |task|
        deployer.send("pull_#{task}")
      end
    end

    desc "push", "Pushes WP data from local machine to remote host"
    shared_options.each do |option, args|
      method_option option, args
    end
    def push
      deployer = Wordmove::Deployer::Base.deployer_for(options)
      handle_options(options) do |task|
        deployer.send("push_#{task}")
      end
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
wordmove-1.3.0.pre lib/wordmove/cli.rb
wordmove-1.2.0 lib/wordmove/cli.rb
wordmove-1.1.0 lib/wordmove/cli.rb
wordmove-1.0.19 lib/wordmove/cli.rb
wordmove-1.0.18 lib/wordmove/cli.rb
wordmove-1.0.17 lib/wordmove/cli.rb
wordmove-1.0.16 lib/wordmove/cli.rb
wordmove-1.0.15 lib/wordmove/cli.rb
wordmove-1.0.14 lib/wordmove/cli.rb
wordmove-1.0.13 lib/wordmove/cli.rb
wordmove-1.0.12 lib/wordmove/cli.rb
wordmove-1.0.11 lib/wordmove/cli.rb
wordmove-1.0.10 lib/wordmove/cli.rb
wordmove-1.0.9 lib/wordmove/cli.rb
wordmove-1.0.8 lib/wordmove/cli.rb