rsim / mondrian-olap

JRuby gem for performing multidimensional queries of relational database data using Mondrian OLAP Java library
MIT License
232 stars 33 forks source link

jruby newbie help #5

Closed mattharrison closed 10 years ago

mattharrison commented 13 years ago

I'm pretty much a newbie to (j)ruby. I figured I'd try to get cube_spec.rb to run, and use that as a model during development.

When I try to run it I get the following:

$ jruby cube_spec.rb 
/usr/lib/jruby//lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require': no such file to load -- bundler (LoadError)
    from /usr/lib/jruby//lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from ./spec_helper.rb:2
    from ./spec_helper.rb:1:in `require'
    from cube_spec.rb:1

From my grokking, it looks like bundler is missing, yet gems claims it isn't :

$ jruby -S gem list --local

*** LOCAL GEMS ***

bundler (1.0.21)
diff-lcs (1.1.3)
json (1.6.1)
mondrian-olap (0.3.0)
nokogiri (1.5.0)
rdoc (3.11)
rspec (2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
rspec-mocks (2.7.0)

I know this is slightly OT, but I just need help getting the environment figured out (ie do I need to use rvm)?

rsim commented 13 years ago

If you want to run tests then at first install bundler and all necessary gems from Gemfile

gem install bundler
bundle install

and then use rake spec to tun all tests or rspec spec/cube_spec.rb to run individual test file. Also see https://github.com/rsim/mondrian-olap/blob/master/RUNNING_TESTS.rdoc for all preconditions for running tests.

If you want to try to use mondrian-olap then it is better to use mondrian-olap demo Rails app https://github.com/rsim/mondrian_demo

mattharrison commented 13 years ago

So don't run jruby -S gem install bundler? I should be using (c)ruby gem?

mattharrison commented 13 years ago

Hmm, I seemed to have progressed a little When I try to run the rake task it claims it can't find mondrian/olap

$ jruby -S rake
/home/mharrison/work/jruby/jruby-1.6.5/bin/jruby -S rspec ./spec/cube_spec.rb
LoadError: no such file to load -- mondrian/olap

Yet

$ jruby -S gem list

*** LOCAL GEMS ***

activemodel (3.0.10)
activerecord (3.0.10)
activerecord-jdbc-adapter (1.1.1)
activerecord-oracle_enhanced-adapter (1.4.0)
activesupport (3.0.10)
arel (2.0.10)
autotest (4.4.6)
bouncy-castle-java (1.5.0146.1)
builder (2.1.2)
bundler (1.0.21)
diff-lcs (1.1.3)
git (1.2.5)
i18n (0.5.0)
jdbc-jtds (1.2.5 java)
jdbc-luciddb (0.9.3)
jdbc-mysql (5.1.13)
jdbc-postgres (9.0.801)
jeweler (1.6.4, 1.5.2)
jruby-openssl (0.7.4)
json (1.6.1 java)
mondrian-olap (0.3.0)
nokogiri (1.5.0 java)
rake (0.9.2.2, 0.8.7)
rdoc (3.11)
rspec (2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
rspec-mocks (2.7.0)
sources (0.0.1)
tzinfo (0.3.31)
ZenTest (4.6.2)

I'm quite confused

Update

Ok, sorry for the noise, apparently since I'm making my own cube, I need to have mondrian-olap.gemspec and the lib file from mondrian-olap.

rsim commented 13 years ago

I use rvm to install jruby and therefore my gem and rake commands will actually use jruby.

In your case you probably need to run

jruby -S bundle install
jruby -S bundle exec rake spec

to run tests.

If you want to use mondrian-olap gem in your application then include it in your app's Gemfile, see example - https://github.com/rsim/mondrian_demo/blob/master/Gemfile (there I use latest version from github but you can specify also released version 0.3.0 which will use rubygems version).

And then see example https://github.com/rsim/mondrian_demo/blob/master/app/models/Dwh.rb how to define cube schema and https://github.com/rsim/mondrian_demo/blob/master/app/controllers/mdx_controller.rb how to execute queries that are entered from user interface (see sample queries at https://github.com/rsim/mondrian_demo/blob/master/README.md)

rsim commented 10 years ago

Closing old issue.