Class: Eggshell::Bundles::Loader::LoaderMacro
- Inherits:
-
Object
- Object
- Eggshell::Bundles::Loader::LoaderMacro
show all
- Includes:
- MacroHandler
- Defined in:
- lib/eggshell/bundles/loader.rb
Constant Summary
MacroHandler::CHAIN_CONTINUE, MacroHandler::CHAIN_END, MacroHandler::CHAIN_NONE, MacroHandler::CHAIN_START, MacroHandler::COLLECT_NORMAL, MacroHandler::COLLECT_RAW, MacroHandler::COLLECT_RAW_MACRO
Instance Method Summary
collapse
#chain_type, #collection_type
Instance Method Details
#process(type, args, lines, out, call_depth = 0) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/eggshell/bundles/loader.rb', line 22
def process(type, args, lines, out, call_depth = 0)
if type == 'gems'
args.each do |gemname|
begin
require gemname
@proc._debug("_loaded gem: #{gemname}")
rescue LoadError
@proc._warn("could not load gem: #{gemname}")
end
end
elsif type == 'files'
args.each do |file|
begin
if file[0] == '/'
require file
else
@proc.vars[:target].vars[:include_paths].each do |root|
if File.exists?("#{root}/#{file}")
require "#{root}/#{file}"
@proc._debug("loaded file: #{root}/#{file}")
end
end
end
rescue LoadError
@proc._warn("could not load file: #{file}")
end
end
elsif type == 'bundles'
args.each do |bundle|
Eggshell::Bundles::Registry.attach_bundle(bundle, @proc.vars[:target])
end
end
end
|
#set_processor(proc) ⇒ Object
17
18
19
20
|
# File 'lib/eggshell/bundles/loader.rb', line 17
def set_processor(proc)
@proc = proc
proc.add_macro_handler(self, *%w(gems files bundles vars))
end
|