Module: Perennial::Manifest::Mixin

Defined in:
lib/perennial/manifest.rb

Instance Method Summary collapse

Instance Method Details

#manifest(&blk) ⇒ Object

Called in your application to set the default namespace and app_name. Also, if a block is provided it yields first with Manifest and then with the Loader class, making it simpler to setup.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/perennial/manifest.rb', line 17

def manifest(&blk)
  Manifest.namespace = self
  Manifest.app_name  = self.name.to_s.underscore
  parent_folder = File.expand_path(File.dirname(__DIR__(0)))
  Settings.library_root = parent_folder
  libary_folder = parent_folder / 'lib'/ Manifest.app_name
  attempt_require((libary_folder / 'core_ext'), (libary_folder / 'exceptions'))
  unless blk.nil?
    args = []
    args << Manifest if blk.arity != 0
    args << Loader   if blk.arity > 1 || blk.arity < 0
    blk.call(*args)
  end
end