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.2.1"

Class Method Summary collapse

Class Method Details

.configurationObject Also known as: config

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



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

def configuration
  Ablerc::Configuration.instance
end

.load!(path) ⇒ Object



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

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:



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

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



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

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



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

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