Sha256: 462f75ec5227f0fdaa8f424b39c1c27de5350bc6a3fd7df705e154fb54f3b326

Contents?: true

Size: 787 Bytes

Versions: 2

Compression:

Stored size: 787 Bytes

Contents

require 'sinatra/base'
require 'gem_on_demand'

module GemOnDemand
  class Server < Sinatra::Base
    set :port, 7154
    set :lock, true # multi threading is not supported when doing chdir foo

    get '/:username/api/v1/dependencies' do
      user = params[:username]
      if gems = params[:gems]
        dependencies = GemOnDemand.dependencies(user, gems.split(","))
        if params[:debug]
          dependencies.inspect
        else
          Marshal.dump(dependencies)
        end
      else
        "" # first request wants no response ...
      end
    end

    get '/:username/gems/:project-:version.gem' do
      user = params[:username]
      project = params[:project]
      version = params[:version]
      GemOnDemand.build_gem(user, project, version)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gem_on_demand-1.1.0 lib/gem_on_demand/server.rb
gem_on_demand-1.0.0 lib/gem_on_demand/server.rb