jruby / warbler

Warbler chirpily constructs .war files of your Ruby applications.
Other
882 stars 205 forks source link

Non-web application with Bundler #226

Open arkan opened 10 years ago

arkan commented 10 years ago

Hi,

I'm trying to package a non-web application using Bundler.

And I get the following message

in my bin/application.rb

require 'rubygems'
require 'bundler'
LoadError: no such file to load -- bundler/index

I compile and start the application as the following:

bundle exec warble executable jar && java -jar test.jar

I also tried to replace Bundler.require with

require 'bundler/index'
require 'bundler/remote_specification'
require 'bundler/endpoint_specification'
require 'bundler/dep_proxy'
require 'bundler/source/git/git_proxy'

And this time it fails with git based gems with the following message: Bundler::GitError: https://token:x-oauth-basic@github.com/user/mygem.git (at master) is not checked out. Please run bundle install

Am i doing something wrong ? How can I fix that ?

Thanks

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/1446598-non-web-application-with-bundler?utm_campaign=plugin&utm_content=tracker%2F136961&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F136961&utm_medium=issues&utm_source=github).
arkan commented 10 years ago

Here is an example which reproduces the issue: https://github.com/Arkan/warbler_issue

Thanks for you help

michaelgpearce commented 10 years ago

Same problem here creating a non-web application. Since the warbler created jar file had all of the correct dependencies already, i just don't call Bundle.require when i am running the app from a jar and everything gets loaded automatically.

Something like this:

Bundler.require(:default, ENV['MY_APP_ENV']) unless running_from_jar?

I determine if i am running from a jar file based on the existence of a specific file that is not in the jar.