Sha256: f4a99369505e40657724eeb8a7782d641749deead646f488f0a7d58472c724c8

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

require 'catfish'
require 'thor'

module Catfish
  class CLI < Thor
    include Thor::Actions

    #		def self.start(*)
    #			super
    #		rescue Exception => e
    #			Bundler.ui = UI::Shell.new
    #			raise e
    #		ensure
    #			Bundler.cleanup
    #		end

    def initialize(*args)
      super
    rescue UnknownArgumentError => e
      raise InvalidOption, e.message
    ensure
      self.options ||= {}
    end

    def self.source_root
      File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
    end

    desc 'init [OPTIONS]', 'Generates a templated catfish repo in the current working directory'
    long_desc <<-D
    TODO: Long description
    D
    method_option 'provisioners', type: :array, banner: 'A list of vagrant provisiners to use'
    method_option 'shell-paths', type: :array, banner: 'A list of paths to use if shell provisioning is selected'
    method_option 'ssh-username', type: :string, banner: 'SSH username'
    method_option 'ssh-private-key-path', type: :string, banner: 'Path to SSH private key'
    def init
      require 'catfish/cli/init'
      Init.new(options.dup, self).run
    end

    desc 'resolve [OPTIONS]', 'Resolves the servers listed in Catfishfile to .lock'
    def resolve
      require 'catfish/cli/resolve'
      Resolve.new(options.dup, self).run
    end

    desc 'provision [OPTIONS]', 'Provision to the servers specified in Catfishfile.lock'
    method_option 'provider', type: :string, default: 'managed', banner: 'Vagrant provider to use.'
    method_option 'parallel', type: :boolean, default: 'false', banner: 'Run provisioning in parallel'
    def provision
      invoke :resolve
      require 'catfish/cli/provision'
      Provision.new(options.dup).run
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
catfish-0.0.2 lib/catfish/cli.rb