Sha256: d4f6c8ccf3136ce5f19936c38b1e9d72ab17cf861fc1a72ec0ef04682aff8a5b

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 KB

Contents

require 'sinatra'
require 'stickler/middleware'
require 'stickler/middleware/index'
require 'stickler/repository/local'

module Stickler::Middleware
  #
  # A Sinatra middleware that implements the HTTP portions of a Modern gem server.  
  # It sits on top of a Repository::Local and serves up the gems in it.
  #
  # It utilizies a Stickler::Repository::Local, and the :repo_root option
  # is passed directly to it.
  #
  # == Options
  #
  # <b>:serve_indexes</b>::   the same as the Index middleware
  #
  # <b>:repo_root</b>::       The path that is to be the root of the
  #                           Repository instance managed by this server.
  #
  # The <b>:repo_root</b> option is required.
  #
  # == Usage
  #
  #   use Stickler::Middleware::Local, :repo_root => '/path/to/repository'
  #
  #   use Stickler::Middleware::Local, :repo_root => '/path/to/repository',
  #                                    :serve_indexes => true
  #
  class Local < Index
    def initialize( app = nil, opts = {} )
      super( app, opts )
      # overwrite the repo that is set in the parent
      @repo      = ::Stickler::Repository::Local.new( opts[:repo_root] )
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
stickler-2.2.4 lib/stickler/middleware/local.rb
stickler-2.2.3 lib/stickler/middleware/local.rb
stickler-2.2.2 lib/stickler/middleware/local.rb
stickler-2.1.4 lib/stickler/middleware/local.rb
stickler-2.1.3 lib/stickler/middleware/local.rb
stickler-2.1.2 lib/stickler/middleware/local.rb
stickler-2.1.1 lib/stickler/middleware/local.rb
stickler-2.1.0 lib/stickler/middleware/local.rb
stickler-2.0.2 lib/stickler/middleware/local.rb
stickler-2.0.1 lib/stickler/middleware/local.rb
stickler-2.0.0a lib/stickler/middleware/local.rb