Sha256: 1a8375fff3b14e84b2ace4a08107a19207c5af0cfe4e114774a5aa6b395558c4

Contents?: true

Size: 982 Bytes

Versions: 6

Compression:

Stored size: 982 Bytes

Contents

# frozen_string_literal: true

# TODO wrap in begin/rescue loaderror and raise a meaningful exception
require "roda"
require "roda/plugins/flow"

module Snowpack
  module Roda
    # Mostly copied from Dry::Web::Roda::Application
    class Web < ::Roda
      extend Dry::Configurable

      setting :container, reader: true
      setting :routes

      plugin :flow

      # Disable this so we can better control when it's used
      #
      # def self.configure(&block)
      #   super.tap do
      #     use(container[:rack_monitor]) if container.config.listeners
      #   end
      # end

      def self.resolve(name)
        container[name]
      end

      def self.[](name)
        container[name]
      end

      def self.load_routes!
        Dir[root.join("#{config.routes}/**/*.rb")].each { |f| require f }
      end

      def self.root
        container.config.root
      end

      # def notifications
      #   self.class[:notifications]
      # end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
snowpack-1.0.0.alpha7 lib/snowpack/roda/web.rb
snowpack-1.0.0.alpha6 lib/snowpack/roda/web.rb
snowpack-1.0.0.alpha5 lib/snowpack/roda/web.rb
snowpack-1.0.0.alpha4 lib/snowpack/roda/web.rb
snowpack-1.0.0.alpha3 lib/snowpack/roda/web.rb
snowpack-1.0.0.alpha2 lib/snowpack/roda/web.rb