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.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
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.( File.join( path, ABLE_RC_FILE)) end |
.load_scheme ⇒ Object
Loads the rc files in the order and locations specified by scheme
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.(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 |
.stub ⇒ Object
Prepares a stub rcfile with defined options
62 63 64 |
# File 'lib/ablerc.rb', line 62 def stub Ablerc::StubGenerator.new({:options => }.merge()) end |