Sha256: 8a21f6c48b1b8e96a6ddc46a8582c059682ff14bc81cc552fcd9538c80cfedcf

Contents?: true

Size: 549 Bytes

Versions: 3

Compression:

Stored size: 549 Bytes

Contents

module Rib; end
module Rib::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('config.ru')
    self.app = app
    Rib.shell.config[:binding].eval('def app; Rib::Rack.app; end')
    Rib.say("Access your app via :app method")
  end

  def rack?
    File.exist?('config.ru')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rib-1.1.6 lib/rib/app/rack.rb
rib-1.1.5 lib/rib/app/rack.rb
rib-1.1.4 lib/rib/app/rack.rb