Sha256: 9050d74d62c8401c8b599cd0b98b708f0514f2a6c76c1006e06fc015deb5f22a

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

module Catfish
  class CLI
    class Init
      attr_reader :options, :thor

      def initialize(options, thor)
        @options = options
        @thor = thor
      end

      def run
        p 'Initializing Catfish repository'

        templates = {
          'Catfishfile.tt' => 'Catfishfile',
          'Vagrantfile.tt' => 'Vagrantfile'
        }

        opts = {
          provisioners: options[:provisioners]      || [],
          shell_paths: options['shell-paths']       || ['{{PATH_TO_YOUR_SCRIPT}}'],
          communicator: options[:communicator]      || 'ssh',
          winrm_username: options['winrm-username'] || '{{YOUR_WINRM_USERNAME}}',
          winrm_password: options['winrm-password'] || '{{YOUR_WINRM_PASSWORD}}',
          ssh_username: options['ssh-username']     || '{{YOUR_SSH_USERNAME}}',
          ssh_private_key_path: options['ssh-private-key-path'] || '{{PATH_TO_YOUR_SSH_PRIVATE_KEY}}',
          servers: options['servers']               || [],
          plugins: options['plugins']               || []
        }

        templates.each do |src, dst|
          thor.template(src, dst, opts)
        end
        p 'Repository initialized. Remember to:'
        p ' - Check your Vagrantfile and replace any placeholders'
        p ' - Edit your Catfish file and list target servers'
        p ' - Run catfish resolve'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
catfish-0.0.4 lib/catfish/cli/init.rb