Class: Pipely::Deploy::BootstrapRegistry

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/pipely/deploy/bootstrap_registry.rb

Overview

Registry of Mixins to be applied to the bootstrap context

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBootstrapRegistry

Returns a new instance of BootstrapRegistry.



13
14
15
# File 'lib/pipely/deploy/bootstrap_registry.rb', line 13

def initialize
  @mixins = []
end

Class Method Details

.mixinsObject



22
23
24
# File 'lib/pipely/deploy/bootstrap_registry.rb', line 22

def mixins
  instance.mixins
end

.register_mixins(*mixins) ⇒ Object



18
19
20
# File 'lib/pipely/deploy/bootstrap_registry.rb', line 18

def register_mixins(*mixins)
  instance.register_mixins(*mixins)
end

Instance Method Details

#mixinsObject



40
41
42
# File 'lib/pipely/deploy/bootstrap_registry.rb', line 40

def mixins
  @mixins
end

#register_mixins(*mixins) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/pipely/deploy/bootstrap_registry.rb', line 27

def register_mixins(*mixins)
  new_mixins = [mixins].flatten.compact

  new_mixins.each do |mixin|
    begin
      require mixin.underscore
    rescue LoadError => e
      raise "Failed to require #{mixin} for bootstrap_contexts: #{e}"
    end
  end
  @mixins = (@mixins + new_mixins).uniq
end