class PrivateGemServer::Scanner
Public Class Methods
new(app, sources_path, temp_path)
click to toggle source
# File lib/private_gem_server/scanner.rb, line 4 def initialize(app, sources_path, temp_path) @app = app @sources = Sources.new YAML.load_file(sources_path), temp_path end
Public Instance Methods
call(env)
click to toggle source
# File lib/private_gem_server/scanner.rb, line 9 def call(env) scan! if env['REQUEST_METHOD'] == 'GET' && env['PATH_INFO'] !~ %r{^/gems/} @app.call env end
scan!()
click to toggle source
# File lib/private_gem_server/scanner.rb, line 14 def scan! @sources.values.map do |source| Thread.new { source.refresh! }.tap { |thread| thread.abort_on_exception = true } end.each(&:join) end