Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ability to bind to a ruby kernel #2643

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions IPython/frontend/html/notebook/kernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

from IPython.config.configurable import LoggingConfigurable
from IPython.utils.importstring import import_item
from IPython.zmq.rubykernel import RubyKernelManager
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really need to be imported here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you're right.

from IPython.utils.traitlets import (
Instance, Dict, List, Unicode, Float, Integer, Any, DottedObjectName,
)
Expand Down
16 changes: 16 additions & 0 deletions IPython/zmq/rubykernel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from subprocess import Popen

from IPython.zmq.kernelmanager import KernelManager

def launch_ruby_kernel(fname='cf.json', **kw):
cmd = ['iruby_ruby', '~/iruby/lib/kernel.rb', fname]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously, we will need to make these cmd lines general before we can merge this. But I think it will be helped if we can create the ruby package and use ruby to find the location of kernel.rb. I guess we need to learn more about ruby packaging and command line installation...

cmd = ['/usr/local/Cellar/ruby/1.9.3-p286/bin/ruby',
'/Users/matthiasbussonnier/iruby/lib/kernel.rb',
fname]
#~/.ipython/profile_default/security/kernel-10234.json
return Popen(cmd)

class RubyKernelManager(KernelManager):
def start_kernel(self, **kw):
kw['launcher'] = launch_ruby_kernel
return KernelManager.start_kernel(self, **kw)