iconara / rubydoop

Write Hadoop jobs in JRuby
220 stars 33 forks source link

Package gem files in addition to require_paths; place files into classes/ subdirectory, where they are in hadoop's classpath #3

Closed imkirnos closed 11 years ago

imkirnos commented 11 years ago

This allowed me to package up a large rails app to be used in mappers/reducers.

iconara commented 11 years ago

Would be nice with tests. The current tests fail spectaculary, and the test project (spec/integration/test_project) can't be packaged.

The issue with the test project seems to be that sometimes the things in bundled_gems and bundled_gem_files are arrays (pairs) and sometimes strings, so path[0] becomes either the first item in the pair, or the first character in the path.

imkirnos commented 11 years ago

of course. i'm trying to build the tests, but running bundle in the test_project directory gives the following error under jruby 1.7.1:

Ilyas-MacBook-Pro:test_project ilya$ bundle
Fetching gem metadata from http://rubygems.org/..........
Using rake (0.9.2.2) 
Using bouncy-castle-java (1.5.0146.1) 
Using coderay (1.0.8) 
Using jruby-openssl (0.7.6.1) 
Installing json (1.7.5) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
creating Makefile

make
xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -DJSON_GENERATOR  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -arch i386 -arch x86_64 -g -O3 -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   -c generator.c
sh: /Developer/usr/bin/xcodebuild: No such file or directory
/Developer/usr/bin/xcodebuild fails with 32512 - Unknown error: 32512
make: *** [generator.o] Error 69

Gem files will remain installed in /usr/local/rvm/gems/jruby-1.7.1/gems/json-1.7.5 for inspection.
Results logged to /usr/local/rvm/gems/jruby-1.7.1/gems/json-1.7.5/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.5), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.5'` succeeds before bundling.
iconara commented 11 years ago

You can remove the JSON gem as a dependency in 1.7.1, but it's required in 1.6.x. You can also try to put it in a platform block to force Bundler to install the Java version:

platform :jruby do
  gem 'json'
end