Module: App

Defined in:
lib/app-ctx.rb

Defined Under Namespace

Classes: Config, Container

Class Method Summary collapse

Class Method Details

.config_path(app_path) ⇒ Object



222
223
224
225
226
# File 'lib/app-ctx.rb', line 222

def config_path app_path
    defaults_path = File.expand_path(app_path)
    ext = File.extname(defaults_path)
    defaults_path.sub((ext == "" && /$/ || /#{ext}$/), ".yml")
end

.run(params = {}, &block) ⇒ Object



212
213
214
215
216
217
218
219
220
# File 'lib/app-ctx.rb', line 212

def run params = {}, &block
    # create application container from command line context
    container = Container.new(Config.new(params))
    if block_given? 
        container.execute {|context| block.call(context) }
    else
        container.execute params[:class]
    end
end