Sha256: cf2542aa5d88f704876b4c0b531428df14905ffe53e0d35400f1a4905c7ccf3a

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'thor'

module Cloudspin
  module Artefact

    class CLI < Thor

      class_option :terraform_source,
        :aliases => '-t',
        :banner => 'PATH',
        :default => './src',
        :desc => 'Terraform project source files will be copied from this folder'

      class_option :dist_folder,
        :aliases => '-d',
        :banner => 'PATH',
        :default => './dist',
        :desc => 'The artefact will be created in this folder'

      desc 'build', 'Prepare files to be packaged'
      def build
        builder.build
      end

      desc 'package', 'Package the files'
      def package
        builder.package
      end

      desc 'publish', 'Upload the package'
      def publish
        puts 'publish'
      end

      desc 'get', 'Download a package'
      def get
        put 'get'
      end


      no_commands do
        def builder
          Cloudspin::Stack::Artefact::Builder.new(stack_definition: stack_definition,
                                                  dist_folder: options[:dist_folder])
        end

        def stack_definition
          Cloudspin::Stack::Definition.from_file(options[:terraform_source] + '/stack.yaml')
        end
      end

      def self.exit_on_failure?
        true
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cloudspin-stack-artefact-0.1.1 lib/cloudspin/stack/artefact/cli.rb