Giter VIP home page Giter VIP logo

Comments (12)

v0dro avatar v0dro commented on June 1, 2024

To provide more details, this happens only if I run iruby notebook in a directory apart from where my iruby has been cloned. (/home/sameer/gitrepos/iruby/ in my case).

from iruby.

v0dro avatar v0dro commented on June 1, 2024

Any ideas on this? I'm unable to run iruby notebook anywhere but in the directory of cloned iruby code.

from iruby.

minad avatar minad commented on June 1, 2024

Some problem with the $LOAD_PATH

It seems you are running from the gem and not the cloned iruby repository. Also bundler could be an issue since the kernel tries to load the current Gemfile by requiring bundler/setup

from iruby.

minad avatar minad commented on June 1, 2024

ruby load path management, gems, bundler - this is really a mess

from iruby.

minad avatar minad commented on June 1, 2024

Remember to always do a iruby register --force if you change the location of the iruby command.

I tested the following cases:

  • WORKS - Running cloned iruby from a cloned iruby directory
  • WORKS - Running cloned iruby from a different repository
  • WORKS - Running iruby gem from a directory without a Gemfile
  • WORKS - Running iruby gem from a directory with a Gemfile requiring iruby
  • FAILS - Running cloned iruby from a directory with a Gemfile NOT requiring iruby or at least the iruby dependencies, e.g. rbczmq
  • FAILS - Running iruby gem from a directory with a Gemfile NOT requiring iruby

_NOTE: The FAILS are by design of bundler, add iruby to the Gemfile to fix it_

from iruby.

v0dro avatar v0dro commented on June 1, 2024

My problem is covered in the last two cases that you report as failed.

Also try to require 'statsample', or any gem that is not listed in the gem file. it should fail.

Currently to make a few notebooks I'm adopting a hack where I run ./iruby notebook from iruby/bin after having added the following to my Gemfile:

gem 'statsample'
gem 'daru'

from iruby.

minad avatar minad commented on June 1, 2024

The two last failures are known "issues", but they are by design. If you want to use iruby from a project with a Gemfile, you have to require iruby in it.

I recommend the following Gemfile:

source 'https://rubygems.org/'

# Your project gems
gem 'statsample'
gem 'daru'
...

# Gems only needed if we want to use iruby
group :iruby do
  gem 'iruby'
  gem 'pry'
  ...
end

from iruby.

v0dro avatar v0dro commented on June 1, 2024

But why should it be this way?

If the browser based notebook is meant to be a more enhanced and interactive version of the pry or irb shells, should I not be able to do the same things that I do in the shell; in iruby?

So for instance we don't need to bother about the directory location when running pry or irb. Why not keep it like that here?

And if you're planning to keep this design I think it should be well documented. I spent quite a while trying to figure this out.

from iruby.

minad avatar minad commented on June 1, 2024

Well, this is by design of bundler. If we use it, this is what we get. iruby just loads a Gemfile if available by require 'bundler/setup'.

I see it this way - there are three cases:

  1. You don't use bundler - then there is no Gemfile. This is done for example in those docker images, all gems are just installed as root. There won't be any problems.
  2. You use bundler in your project. There is a Gemfile, it should be loaded. The Gemfile should mention iruby since you want to use it.
  3. You want to use bundler PARTIALLY, there is a Gemfile which you probably expect to be loaded. But the Gemfile doesn't mention iruby. So this fails.

I think the 3. case is what you are currently in and complaining about. I don't know if there is a way around it.

I also wasn't happy with bundler in the beginning, because I also wanted to use gems that were not part of the Gemfile. This is not allowed by the design of bundler, because bundler ensures that no wrong gems and versions are loaded. Therefore use it right and mention ALL gems that are used including iruby.

Those things also apply to pry. For irb not so much since it is always there as part of the stdlib.

from iruby.

v0dro avatar v0dro commented on June 1, 2024

Would you consider using hen instead of bundler?

rb-gsl currently uses it.

from iruby.

minad avatar minad commented on June 1, 2024

Hen is a helper providing rake tasks and not really a replacement for bundler.

Am 4. Juni 2015 07:55:47 MESZ, schrieb Sameer Deshmukh [email protected]:

Would you consider using hen instead of bundler?

rb-gsl currently uses it.


Reply to this email directly or view it on GitHub:
#31 (comment)

from iruby.

AbhimanyuAryan avatar AbhimanyuAryan commented on June 1, 2024

@minad @v0dro can you help me with my error: http://stackoverflow.com/questions/35999925/kernel-dies-when-creating-iruby-notebook/ ?

from iruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.