Module: Bauble::Cli::Commands::Preview
- Included in:
- BaubleCli
- Defined in:
- lib/bauble/cli/commands/preview.rb
Overview
Preview command
Class Method Summary collapse
Class Method Details
.included(thor) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/bauble/cli/commands/preview.rb', line 13 def included(thor) thor.class_eval do desc 'preview', 'Preview the application' method_option :stack, type: :string, desc: 'The stack to preview', aliases: '-s' def preview Logger.logo setup_app # check for any stacks raise 'No stacks found' if @app.stacks.empty? # check for multiple stacks if @app.stacks.length > 1 && [:stack].nil? Logger.error 'Must provide a stack when multiple are defined' exit(1) end # set up stack stack_name = [:stack] || @app.stacks.first.name @app.change_current_stack(stack_name) # bundle assets Logger.block_log 'Bundling assets...' Logger.nl @app.bundle # write template file pulumi.create_pulumi_yml(@app.template) # initialize pulumi pulumi.init! # create or select stack Logger.block_log('Running Pulumi preview...') pulumi.create_or_select_stack(stack_name) # run preview pulumi.preview Logger.log "Preview complete\n" end end end |