Module: Gluer

Defined in:
lib/gluer/api.rb,
lib/gluer/dsl.rb,
lib/gluer/file.rb,
lib/gluer/version.rb,
lib/gluer/file_pool.rb,
lib/gluer/registration.rb,
lib/gluer/configuration.rb,
lib/gluer/registration_hook.rb,
lib/gluer/registration_pool.rb,
lib/gluer/registration_collection.rb,
lib/gluer/registration_definition.rb

Defined Under Namespace

Classes: Configuration, DSL, File, FilePool, Registration, RegistrationCollection, RegistrationDefinition, RegistrationHook, RegistrationPool

Constant Summary collapse

VERSION =
"0.0.5"

Class Method Summary collapse

Class Method Details

.configObject



2
3
4
# File 'lib/gluer/configuration.rb', line 2

def self.config
  @configuration ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



6
7
8
# File 'lib/gluer/configuration.rb', line 6

def self.configure
  yield(config)
end

.define_registration(name, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/gluer/dsl.rb', line 5

def self.define_registration(name, &block)
  definition = RegistrationDefinition.new(name)
  if block.arity == 1
    block.call(definition)
  else
    definition.instance_exec(&block)
  end
  DSL.add_registration_definition(name, definition)
end

.reloadObject



14
15
16
# File 'lib/gluer/api.rb', line 14

def reload
  file_pool.update
end

.setup(context = nil, &block) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/gluer/api.rb', line 6

def setup(context=nil, &block)
  path = block.binding.eval('__FILE__')
  return unless file = file_pool.get(path)
  collect_registrations(context, block) do |registration|
    file.add_registration(registration)
  end
end