Rubygems Servlets

a servlet which can run a hosted rubygems repo, or caching proxy to remote repo, or just a proxy. finally you can have a merged repo of three types.

License

License

AGPL
Categories

Categories

Ruby Languages
GroupId

GroupId

de.saumya.mojo
ArtifactId

ArtifactId

rubygems
Last Version

Last Version

0.2.3
Release Date

Release Date

Type

Type

war
Description

Description

Rubygems Servlets
a servlet which can run a hosted rubygems repo, or caching proxy to remote repo, or just a proxy. finally you can have a merged repo of three types.
Project URL

Project URL

http://github.com/torquebox/rubygems-servlets
Source Code Management

Source Code Management

https://github.com/torquebox/rubygems-servlets

Download rubygems

How to add to project

<!-- https://jarcasting.com/artifacts/de.saumya.mojo/rubygems/ -->
<dependency>
    <groupId>de.saumya.mojo</groupId>
    <artifactId>rubygems</artifactId>
    <version>0.2.3</version>
    <type>war</type>
</dependency>
// https://jarcasting.com/artifacts/de.saumya.mojo/rubygems/
implementation 'de.saumya.mojo:rubygems:0.2.3'
// https://jarcasting.com/artifacts/de.saumya.mojo/rubygems/
implementation ("de.saumya.mojo:rubygems:0.2.3")
'de.saumya.mojo:rubygems:war:0.2.3'
<dependency org="de.saumya.mojo" name="rubygems" rev="0.2.3">
  <artifact name="rubygems" type="war" />
</dependency>
@Grapes(
@Grab(group='de.saumya.mojo', module='rubygems', version='0.2.3')
)
libraryDependencies += "de.saumya.mojo" % "rubygems" % "0.2.3"
[de.saumya.mojo/rubygems "0.2.3"]

Dependencies

compile (1)

Group / Artifact Type Version
org.sonatype.nexus.plugins : nexus-ruby-tools jar 2.12.0-01

provided (4)

Group / Artifact Type Version
javax.servlet : servlet-api jar 2.5
org.jruby.mains : jruby-mains jar 0.4.0
org.eclipse.jetty : jetty-server jar 8.1.18.v20150929
org.eclipse.jetty : jetty-webapp jar 8.1.18.v20150929

Project Modules

There are no modules declared in this project.

rubygems-servlets

Build Status

webapp which hosts rubygems or a proxy to rubygems. delivers gem maven artifacts as well. the proxy can be configured to be caching proxy or non-caching proxy

build

the regular webapp with hosted and (caching-)proxy can be built with

 mvn package

or just run it in place with

 mvn jetty:run

where the hosted rubygems are located under http://localhost:8989/hosted and the proxy with https://rubygems.org as source is reachable under http://localhost:8989/caching or http://localhost:8989/proxy. and the http://localhost:8989/merge will combine all three to on rubygems repository.

executable standalone

you also can start the war like this (using embedded jetty):

 mvn package -Pexecutable
 java -jar target/rubygems.war

and adjust the <rubygems.properties> to your liking.

usage

add them to your gem command

  • gem sources add <http://localhost:8989/hosted>
  • gem sources add <http://localhost:8989/caching>
  • gem sources add <http://localhost:8989/proxy>
  • gem sources add <http://localhost:8989/merged>

or use the (caching-)proxy with bundler (example only for https://rubygems.org)

  • bundler config mirror.https://rubygems.org http://localhost:8989/proxy
  • bundler config mirror.https://rubygems.org http://localhost:8989/caching
  • bundler config mirror.https://rubygems.org http://localhost:8989/merged

the Gem-Artifacts are accessible via

you need a mirror declaration http://rubygems-proxy.torquebox.org/releases and http://rubygems-proxy.torquebox.org/prereleases in your settings.xml

<settings>
  <mirrors>
    <mirror>
      <id>gems</id>
      <name>Rubygems</name>
      <url>http://localhost:8989/caching/maven/releases</url>
      <mirrorOf>rubygems-releases</mirrorOf>
    </mirror>
    <mirror>
      <id>pregems</id>
      <name>Rubygems Prereleases</name>
      <url>http://localhost:8989/caching/maven/prereleases</url>
      <mirrorOf>rubygems-prereleases</mirrorOf>
    </mirror>

since some old gem-artifacts use the those repositories (old in sense they originally came from rubygems-proxy.torquebox.org)

for more details about Gem-Artifacts see https://github.com/sonatype/nexus-ruby-support/wiki/Gem-Artifacts. for a solution with access control, more advanced proxy features and merging (group) to repositories see https://github.com/sonatype/nexus-ruby-support.

hosted

the underlying library nexus-ruby-tools can handle gem push my-1.0.0.gem but somehow I have not deciphered how to use rubygems.org and a local repo without manually editing the config files.

the easiest way is to use the nexus gem which was tailor made for the nexus-ruby-tools.

gem install nexus
``

then you can upload your gem with

gem nexus my-1.0.0.gem


it will prompt for the url which is http://localhost:8989/hosted from above. empty username and password will finally push the gem. since the username and passoword was empty it will be prompted again.


non-caching proxy
---

this proxy configuration does not cache the gem-files itself but instead sends a redirect to <rubygems.org>. all other files are cached the same way as the caching proxy:

    mvn jetty:run -P proxy

with url <http://localhost:8989/proxy>

rubygems-proxy.torquebox.org (not yet installed)
--

the webapp for this rubygems-proxy is under the profile **legacy**

     mvn clean package -Plegacy

which is just a proxy (mvn jetty:run -Plegacy)

*  <http://localhost:8989/releases>
*  <http://localhost:8989/prereleases>


tests
====

some integration tests for proxy feature can be executed with

    mvn -P run-its
	
    mvn -P run-its -Plegacy

deploy to maven central
-----------------------

    mvn versions:set
    git ci -m 'prepare release' pom.xml
    mvn -Prelease,executable
    git tag ...
    mvn versions:set
    git ci -m 'next dev version' pom.xml
    git push
    git push --tags

contributing
------------

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

meta-fu
-------

enjoy :) 
de.saumya.mojo

The TorqueBox Project

Versions

Version
0.2.3
0.2.2
0.2.1
0.2
0.1