Cannot use path parameter Gemfile path

Is there a recommended workaround for warbler that doesn't support path parameters in the Gemfile? Is there a fundamental reason why the path is not supported (and I couldn't just implement it)?


source to share

2 answers

The path parameter is not carried over. The Bundler expects to be able to find code along the way, which spoils the purpose of the offline war file.

A workaround would be to run "git init; git commit -a" on the route based gem directory and treat it as a git gem instead. Bundler can then check a copy of the code, and Warbler can store a copy in a war file.



I (unfortunately) cannot post the code for this (yet ...), but I have successfully done the following:

  • Hack the warbler (basically replace the whole gem packing code) to copy the gems indicated with :path

    in vendor/gems

    (normal gems arrangement - gems/gems

    ). This copying was done almost identical to how warbler copies gems from the spec :git


  • The compiler is Monkeypatch, so when it loads specs Gemfile

    from :path

    , they are rewritten to point to vendor/gems


It's not pretty, but I was very happy with this solution.

Another option I have seen is to create a directory vendor/gems

that contains symbolic links to all the gems used :path

in the Gemfile. Warbler will complain about not supporting :path

gems, but they will be copied to the WAR file via symlinks. I don't like this solution because you need to maintain :path

in Gemfile and symlink, but it's easier to implement than above.

Also, I agree with Nick Seeger that :path

as-is support (without any of the above hacks) deprives the target of a standalone WAR file, but a standalone WAR file is not always desirable. There are tradeoffs with a non-standalone WAR file of course, but one advantage is smaller, faster copying, unpacking, etc. Of course, supporting this would require changes to JRuby-Rack as well as Warbler.



All Articles