Module: Ablerc

Defined in:
lib/ablerc.rb,
lib/ablerc/dsl.rb,
lib/ablerc/errors.rb,
lib/ablerc/option.rb,
lib/ablerc/context.rb,
lib/ablerc/version.rb,
lib/ablerc/configuration.rb,
lib/ablerc/stub_generator.rb

Defined Under Namespace

Classes: AbleRCConfigMissing, Configuration, Context, DSL, Option, RcFileMissing, StubGenerator

Constant Summary collapse

ABLE_RC_FILE =
'able.rc'
VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.configurationObject Also known as: config

Exposes option values from parsed rc files. Aliased as #config



53
54
55
# File 'lib/ablerc.rb', line 53

def configuration
  Ablerc::Configuration.instance
end

.load!(path) ⇒ Object



75
76
77
# File 'lib/ablerc.rb', line 75

def load!(path)
  load_able_rc! File.expand_path( File.join( path, ABLE_RC_FILE))
end

.load_schemeObject

Loads the rc files in the order and locations specified by scheme

Raises:



68
69
70
71
72
73
# File 'lib/ablerc.rb', line 68

def load_scheme
  raise RcFileMissing, "You must provide a value to rc_file_name" if rc_file_name.blank?
  self.scheme.each do |scheme|
    configuration.load File.expand_path(File.join( contexts[scheme].path, rc_file_name))
  end
end

.setup(&block) ⇒ Object

Iniatializes Ablerc with values from DSL



45
46
47
48
# File 'lib/ablerc.rb', line 45

def setup(&block)
  Ablerc.dsl.instance_eval(&block)
  scheme.each { |c| dsl.context(c, Ablerc::Context::DEFAULTS[c]) unless contexts.exists? c}
end

.stubObject

Prepares a stub rcfile with defined options



62
63
64
# File 'lib/ablerc.rb', line 62

def stub
  Ablerc::StubGenerator.new({:options => options}.merge(stub_options))
end