Class: BeamUp::Core
- Inherits:
-
Object
- Object
- BeamUp::Core
- Defined in:
- lib/beam_up/core.rb
Class Attribute Summary collapse
-
.config_file ⇒ Object
writeonly
Sets the attribute config_file.
Class Method Summary collapse
- .configuration(config_file: nil) ⇒ Object
- .configure {|configuration| ... } ⇒ Object
- .deploy!(path = nil, provider: nil, config_file: nil) ⇒ Object
Class Attribute Details
.config_file=(value) ⇒ Object (writeonly)
Sets the attribute config_file
12 13 14 |
# File 'lib/beam_up/core.rb', line 12 def config_file=(value) @config_file = value end |
Class Method Details
.configuration(config_file: nil) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/beam_up/core.rb', line 14 def configuration(config_file: nil) @configuration ||= begin custom_path = config_file || @config_file || ((@configuration&.config_file && File.exist?(@configuration.config_file)) ? @configuration.config_file : nil) config = custom_path ? configuration_file(custom_path) : configuration_file config || raise(ConfigurationError, "No .beam_up.yml found. Run `beam_up init PROVIDER` to create one.") end end |
.configure {|configuration| ... } ⇒ Object
8 9 10 |
# File 'lib/beam_up/core.rb', line 8 def configure(&block) yield(configuration) end |
.deploy!(path = nil, provider: nil, config_file: nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/beam_up/core.rb', line 23 def deploy!(path = nil, provider: nil, config_file: nil) config = configuration(config_file: config_file) config.provider = provider if provider deploy_path = path || config.path || raise(ConfigurationError, "No path specified") config.validate! execute! config.before_actions provider_class = PROVIDERS[config.provider.to_s] || raise(ConfigurationError, "Unknown provider: #{config.provider}") result = provider_class.new(config.provider_config).deploy! deploy_path execute! config.after_actions result end |