Brandan
Brandan

Reputation: 14983

Can't push gems to private gem server

We're developing some gems in-house and want to host them on a local gem server to then use with bundler. When I try to push a gem to the server, I get a 404 for /api/v1/gems. This happens on our actual server and when I try to run it locally on my laptop (both are on gem v1.8.24).

Here's the Terminal session that's running the gem server:

$ gem --version
1.8.24
$ gem server
Server started at http://0.0.0.0:8808
Server started at http://[::ffff:0.0.0.0]:8808

Here's me trying to push an arbitrary gem:

$ gem --version
1.8.24
$ gem push --host http://127.0.0.1:8808 awesome_print-1.0.2.gem
Pushing gem to http://127.0.0.1:8808...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
  <HEAD><TITLE>Not Found</TITLE></HEAD>
  <BODY>
    <H1>Not Found</H1>
    `/api/v1/gems' not found.
    <HR>
    <ADDRESS>
     WEBrick/1.3.1 (Ruby/1.9.3/2012-04-20) at
     127.0.0.1:8808
    </ADDRESS>
  </BODY>
</HTML>

Is there a command-line option I need to specify to tell gem server to accept pushes? Or am I missing something else?

Upvotes: 3

Views: 1574

Answers (2)

Michael
Michael

Reputation: 1139

gem server does not support the new Bundler API requests. However, when Bundler accesses this server, it will fallback and fetch the old index format (specs.4.8.gz). The Bundler API was introduced because the global (RubyGems.org) index was getting too large/slow - this won't be a problem on a private server with a few gems. If you are running into problems, GemInABox on a local server or Gemfury in the cloud are the recommended solutions.

Upvotes: 0

Brandan
Brandan

Reputation: 14983

It looks like gem server is only meant to serve gems that exist on the system already. If you want to push gems to the server (from the command line or otherwise), you should look into something like Gem in a Box, or just manually install them to the directory you're serving:

gem install -i <directory> --ignore-dependencies <path/to/gem>

Upvotes: 3

Related Questions