Class: BrainzLab::Flux::Provisioner
- Inherits:
-
Object
- Object
- BrainzLab::Flux::Provisioner
- Defined in:
- lib/brainzlab/flux/provisioner.rb
Constant Summary collapse
- CACHE_DIR =
ENV.fetch('BRAINZLAB_CACHE_DIR') { File.join(Dir.home, '.brainzlab') }
Instance Method Summary collapse
- #ensure_project! ⇒ Object
-
#initialize(config) ⇒ Provisioner
constructor
A new instance of Provisioner.
Constructor Details
#initialize(config) ⇒ Provisioner
Returns a new instance of Provisioner.
13 14 15 |
# File 'lib/brainzlab/flux/provisioner.rb', line 13 def initialize(config) @config = config end |
Instance Method Details
#ensure_project! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/brainzlab/flux/provisioner.rb', line 17 def ensure_project! return unless should_provision? # Try cached credentials first if (cached = load_cached_credentials) apply_credentials(cached) return cached end # Provision new project project = provision_project return unless project # Cache and apply credentials cache_credentials(project) apply_credentials(project) project end |