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.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/perennial/manifest.rb', line 35

def manifest(&blk)
  namespace = self
  app_name  = self.name.to_s.underscore
  manifest = Perennial::Manifest.add_manifest(app_name, namespace)
  parent_folder = File.expand_path(File.dirname(__DIR__(0)))
  Settings.library_root = parent_folder
  libary_folder = parent_folder / 'lib'/ 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