Class: Mundler::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/mundler/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ DSL

Returns a new instance of DSL.



3
4
5
6
7
8
9
# File 'lib/mundler/dsl.rb', line 3

def initialize(path)
  @config = Config.new
  @path = path

  load_libraries
  load_platforms
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



19
20
21
# File 'lib/mundler/dsl.rb', line 19

def config
  @config
end

Instance Method Details

#evaluate!Object



11
12
13
14
15
16
17
# File 'lib/mundler/dsl.rb', line 11

def evaluate!
  begin
    instance_eval(File.read(@path), @path)
  rescue Errno::ENOENT
    raise MundlefileNotFound
  end
end

#load_librariesObject



21
22
23
24
25
26
# File 'lib/mundler/dsl.rb', line 21

def load_libraries
  libraries = Dir.glob(File.join(__dir__, "libraries", "*.rb"))
  libraries.each do |library|
    instance_eval(File.read(library))
  end
end

#load_platformsObject



28
29
30
31
32
33
# File 'lib/mundler/dsl.rb', line 28

def load_platforms
  platforms = Dir.glob(File.join(__dir__, "platforms", "*.rb"))
  platforms.each do |platform|
    instance_eval(File.read(platform))
  end
end