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
-
.configuration ⇒ Object
(also: config)
Exposes option values from parsed rc files.
- .load!(path) ⇒ Object
-
.load_scheme ⇒ Object
Loads the rc files in the order and locations specified by scheme.
-
.setup(&block) ⇒ Object
Iniatializes Ablerc with values from DSL.
-
.stub ⇒ Object
Prepares a stub rcfile with defined options.
Class Method Details
.configuration ⇒ Object 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.( File.join( path, ABLE_RC_FILE)) end |
.load_scheme ⇒ Object
Loads the rc files in the order and locations specified by scheme
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.(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 |
.stub ⇒ Object
Prepares a stub rcfile with defined options
63 64 65 |
# File 'lib/ablerc.rb', line 63 def stub Ablerc::StubGenerator.new({:options => }.merge()) end |