Class: Stickler::Middleware::Local

Inherits:
Index
  • Object
show all
Defined in:
lib/stickler/middleware/local.rb

Overview

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

:serve_indexes

the same as the Index middleware

:repo_root

The path that is to be the root of the Repository instance managed by this server.

The :repo_root 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

Direct Known Subclasses

Gemcutter

Constant Summary

Constants inherited from Index

Index::NAME_VERSION_PLATFORM_REGEX

Instance Attribute Summary

Attributes inherited from Index

#repo

Instance Method Summary collapse

Methods inherited from Index

#marshal, #marshalled_specs, #optimize_specs, #serve_indexes, #to_compression_flag

Methods included from Logable

#logger

Methods included from Helpers::Specs

#collect_specs_via, #latest_specs, #prerelease_specs, #released_specs, #specs, #specs_by_first_upcase_char, #specs_by_name, #specs_by_repo, #specs_grouped_by_name

Methods included from Helpers::Compression

#compression, #compression=

Constructor Details

#initialize(app = nil, opts = {}) ⇒ Local

Returns a new instance of Local.



27
28
29
30
31
# File 'lib/stickler/middleware/local.rb', line 27

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