Class: Bauble::Application
- Inherits:
-
Object
- Object
- Bauble::Application
- Defined in:
- lib/bauble/application.rb
Overview
A Bauble application
Instance Attribute Summary collapse
-
#bundle_hash ⇒ Object
Returns the value of attribute bundle_hash.
-
#code_dir ⇒ Object
Returns the value of attribute code_dir.
-
#config ⇒ Object
Returns the value of attribute config.
-
#current_stack ⇒ Object
Returns the value of attribute current_stack.
-
#gem_layer_hash ⇒ Object
Returns the value of attribute gem_layer_hash.
-
#name ⇒ Object
Returns the value of attribute name.
-
#resources ⇒ Object
Returns the value of attribute resources.
-
#s3_backend ⇒ Object
Returns the value of attribute s3_backend.
-
#shared_code_dir ⇒ Object
Returns the value of attribute shared_code_dir.
-
#shared_code_hash ⇒ Object
Returns the value of attribute shared_code_hash.
-
#skip_gem_layer ⇒ Object
Returns the value of attribute skip_gem_layer.
-
#stacks ⇒ Object
Returns the value of attribute stacks.
Instance Method Summary collapse
- #add_resource(resource) ⇒ Object
- #add_stack(stack) ⇒ Object
- #bundle ⇒ Object
- #change_current_stack(stack_name) ⇒ Object
-
#initialize(name:, code_dir:, stacks: [], skip_gem_layer: false, s3_backend: nil) ⇒ Application
constructor
A new instance of Application.
- #template ⇒ Object
Constructor Details
#initialize(name:, code_dir:, stacks: [], skip_gem_layer: false, s3_backend: nil) ⇒ Application
Returns a new instance of Application.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/bauble/application.rb', line 28 def initialize(name:, code_dir:, stacks: [], skip_gem_layer: false, s3_backend: nil) # passed arguments @name = name @shared_code_dir = code_dir @stacks = [] @skip_gem_layer = skip_gem_layer @s3_backend = s3_backend # init others @resources = [] # add gem layer by defalt add_gem_layer unless skip_gem_layer # create a default stack if none passed stacks = ['dev'] if stacks.empty? stacks.each do |stack| Stack.new(self, stack) end @current_stack = @stacks[0] end |
Instance Attribute Details
#bundle_hash ⇒ Object
Returns the value of attribute bundle_hash.
13 14 15 |
# File 'lib/bauble/application.rb', line 13 def bundle_hash @bundle_hash end |
#code_dir ⇒ Object
Returns the value of attribute code_dir.
13 14 15 |
# File 'lib/bauble/application.rb', line 13 def code_dir @code_dir end |
#config ⇒ Object
Returns the value of attribute config.
13 14 15 |
# File 'lib/bauble/application.rb', line 13 def config @config end |
#current_stack ⇒ Object
Returns the value of attribute current_stack.
13 14 15 |
# File 'lib/bauble/application.rb', line 13 def current_stack @current_stack end |
#gem_layer_hash ⇒ Object
Returns the value of attribute gem_layer_hash.
13 14 15 |
# File 'lib/bauble/application.rb', line 13 def gem_layer_hash @gem_layer_hash end |
#name ⇒ Object
Returns the value of attribute name.
13 14 15 |
# File 'lib/bauble/application.rb', line 13 def name @name end |
#resources ⇒ Object
Returns the value of attribute resources.
13 14 15 |
# File 'lib/bauble/application.rb', line 13 def resources @resources end |
#s3_backend ⇒ Object
Returns the value of attribute s3_backend.
13 14 15 |
# File 'lib/bauble/application.rb', line 13 def s3_backend @s3_backend end |
#shared_code_dir ⇒ Object
Returns the value of attribute shared_code_dir.
13 14 15 |
# File 'lib/bauble/application.rb', line 13 def shared_code_dir @shared_code_dir end |
#shared_code_hash ⇒ Object
Returns the value of attribute shared_code_hash.
13 14 15 |
# File 'lib/bauble/application.rb', line 13 def shared_code_hash @shared_code_hash end |
#skip_gem_layer ⇒ Object
Returns the value of attribute skip_gem_layer.
13 14 15 |
# File 'lib/bauble/application.rb', line 13 def skip_gem_layer @skip_gem_layer end |
#stacks ⇒ Object
Returns the value of attribute stacks.
13 14 15 |
# File 'lib/bauble/application.rb', line 13 def stacks @stacks end |
Instance Method Details
#add_resource(resource) ⇒ Object
70 71 72 |
# File 'lib/bauble/application.rb', line 70 def add_resource(resource) @resources << resource end |
#add_stack(stack) ⇒ Object
74 75 76 |
# File 'lib/bauble/application.rb', line 74 def add_stack(stack) @stacks << stack end |
#bundle ⇒ Object
64 65 66 67 68 |
# File 'lib/bauble/application.rb', line 64 def bundle create_bundle_hashes create_shared_code @resources.each(&:bundle) end |
#change_current_stack(stack_name) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/bauble/application.rb', line 54 def change_current_stack(stack_name) stack = @stacks.find { |st| st.name == stack_name } unless stack Bauble::Cli::Logger.error "Unknown stack #{stack_name}" exit(1) end @current_stack = stack end |
#template ⇒ Object
50 51 52 |
# File 'lib/bauble/application.rb', line 50 def template @template ||= synthesize_template end |