Class: Stickler::Server
- Inherits:
-
Object
- Object
- Stickler::Server
- Defined in:
- lib/stickler/server.rb
Instance Attribute Summary collapse
-
#stickler_root ⇒ Object
readonly
The directory holding all the repositories.
Instance Method Summary collapse
- #app ⇒ Object
-
#initialize(stickler_root) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(stickler_root) ⇒ Server
Returns a new instance of Server.
15 16 17 18 19 |
# File 'lib/stickler/server.rb', line 15 def initialize( stickler_root ) @stickler_root = File.( stickler_root ) raise ::Stickler::Error, "Stickler root directory '#{@stickler_root}' must already exist" unless File.directory?( @stickler_root ) raise ::Stickler::Error, "Stickler root directory '#{@stickler_root}' must be writable" unless File.writable?( @stickler_root ) end |
Instance Attribute Details
#stickler_root ⇒ Object (readonly)
The directory holding all the repositories
13 14 15 |
# File 'lib/stickler/server.rb', line 13 def stickler_root @stickler_root end |
Instance Method Details
#app ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/stickler/server.rb', line 21 def app root = self.stickler_root Rack::Builder.new do use Rack::CommonLogger use Stickler::Middleware::Compression use Stickler::Middleware::Gemcutter, :serve_indexes => false, :repo_root => File.join( root, "gemcutter" ) use Stickler::Middleware::Mirror, :serve_indexes => false, :repo_root => File.join( root, "mirror" ) use Stickler::Middleware::Index, :serve_indexes => true use Stickler::Middleware::NotFound run Sinatra::Base end end |