Sha256: f237c0e7bbdabc0e0765526e9aed0c91fb4534ec50e3e9e64076b3d54ca2f25a

Contents?: true

Size: 611 Bytes

Versions: 4

Compression:

Stored size: 611 Bytes

Contents

module Rib; module Rack
  singleton_class.module_eval{ attr_accessor :app }

  module_function
  def load
    load_rack
  rescue LoadError => e
    Rib.abort("Error: #{e}", "Is this a Rack app?")
  end

  def load_rack
    require 'rack'
    Rib.abort("Error: Cannot find config.ru") unless rack?
    app, _ = Rack::Builder.parse_file(configru_path)
    self.app = app
    Rib.shell.eval_binding.eval('def app; Rib::Rack.app; end')
    Rib.say("Access your app via :app method")
  end

  def rack?
    File.exist?(configru_path)
  end

  def configru_path
    "#{Rib.config[:prefix]}/config.ru"
  end
end; end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rib-1.6.0 lib/rib/app/rack.rb
rib-1.5.4 lib/rib/app/rack.rb
rib-1.5.3 lib/rib/app/rack.rb
rib-1.5.2 lib/rib/app/rack.rb