Sha256: c73cdfc0cc1e7cfe4429ae612184e69eab25a22e6384c4928b33699d2be69ae9

Contents?: true

Size: 1.37 KB

Versions: 23

Compression:

Stored size: 1.37 KB

Contents

#!/usr/bin/env ruby
require 'thor'
require_relative '../lib/convection/control/cloud'

module Convection
  ##
  # Convection CLI
  ##
  class CLI < Thor
    class_option :cloudfile, :type => :string, :default => 'Cloudfile'
    def initialize(*args)
      super
      @cloud = Control::Cloud.new
      @cwd = Dir.getwd
    end

    desc 'converge STACK', 'Converge your cloud'
    def converge(stack = nil)
      @cloud.configure(File.absolute_path(options['cloudfile'], @cwd))
      @cloud.converge(stack) do |event, errors|
        say_status(*event.to_thor)
        errors.each do |error|
          say "* #{ error.message }"
          error.backtrace.each { |b| say "    #{ b }" }
        end unless errors.nil?
      end
    end

    desc 'diff', 'Show changes that will be applied by converge'
    def diff
      @cloud.configure(File.absolute_path(options['cloudfile'], @cwd))
      @cloud.diff { |d| say_status(*d.to_thor) }
    end

    desc 'print STACK', 'Print the rendered template for STACK'
    def print(stack)
      @cloud.configure(File.absolute_path(options['cloudfile'], @cwd))
      puts @cloud.stacks[stack].to_json(true)
    end

    desc 'validate STACK', 'Validate the rendered template for STACK'
    def validate(stack)
      @cloud.configure(File.absolute_path(options['cloudfile'], @cwd))
      @cloud.stacks[stack].validate
    end
  end
end

Convection::CLI.start(ARGV)

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
convection-0.2.23 bin/convection
convection-0.2.22 bin/convection
convection-0.2.21 bin/convection
convection-0.2.20 bin/convection
convection-0.2.19 bin/convection
convection-0.2.18 bin/convection
convection-0.2.17 bin/convection
convection-0.2.16 bin/convection
convection-0.2.15 bin/convection
convection-0.2.14 bin/convection
convection-0.2.13 bin/convection
convection-0.2.12 bin/convection
convection-0.2.11 bin/convection
convection-0.2.10 bin/convection
convection-0.2.9 bin/convection
convection-0.2.8 bin/convection
convection-0.2.7 bin/convection
convection-0.2.6 bin/convection
convection-0.2.5 bin/convection
convection-0.2.4 bin/convection