iruby 0.1.13 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Damián Silvani, Min RK, Martin Sarsale, Josh Adams, Daniel Mendler
1
+ Copyright (c) 2013-2015 Damián Silvani, Min RK, Martin Sarsale, Josh Adams, Daniel Mendler
2
2
 
3
3
  MIT License
4
4
 
data/README.rdoc ADDED
@@ -0,0 +1,45 @@
1
+ <b>The current master branch and gem version >= 0.2 are compatible with IPython3. If you require IPython2 support, please install an older gem version < 0.2 or use the branch ipython2</b>
2
+
3
+ = IRuby
4
+
5
+ This is a Ruby kernel for IPython and is part of SciRuby[http://sciruby.com/].
6
+
7
+ link:screenshot.png
8
+
9
+ === Quick start
10
+
11
+ At first install IPython. I recommend an installation using virtualenv.
12
+
13
+ apt-get install python3-dev virtualenv libzmq3-dev
14
+ virtualenv -p python3 venv
15
+ source venv/bin/activate
16
+ pip install 'ipython[notebook]'
17
+
18
+ After that, install the Ruby gem.
19
+
20
+ gem install iruby
21
+
22
+ Now you can run iruby with:
23
+
24
+ iruby
25
+ iruby notebook
26
+
27
+ Take a look at the Example[http://nbviewer.ipython.org/urls/raw.github.com/SciRuby/iruby/master/IRuby-Example.ipynb].
28
+
29
+ === Required dependencies
30
+
31
+ * IPython >= 3.0.0
32
+ * libzmq >= 3.2
33
+ * Ruby >= 2.0.0
34
+
35
+ === Authors
36
+
37
+ See the link:CONTRIBUTORS file.
38
+
39
+ === License
40
+
41
+ Copyright © 2013-15, IRuby contributors and the Ruby Science Foundation.
42
+
43
+ All rights reserved.
44
+
45
+ IRuby, along with SciRuby[http://sciruby.com/], is licensed under the MIT license. See the link:LICENSE.txt file for details.
data/Rakefile CHANGED
@@ -11,3 +11,5 @@ Rake::TestTask.new('test') do |t|
11
11
  t.test_files = FileList['test/**/*_test.rb']
12
12
  t.verbose = true
13
13
  end
14
+
15
+ task default: 'test'
data/bin/iruby CHANGED
@@ -2,5 +2,4 @@
2
2
 
3
3
  $:.unshift File.dirname(__FILE__) + '/../lib'
4
4
  require 'iruby/command'
5
-
6
5
  IRuby::Command.new(ARGV).run
@@ -1,119 +1,129 @@
1
1
  {
2
- "metadata": {
3
- "language": "ruby",
4
- "name": ""
5
- },
6
- "nbformat": 3,
7
- "nbformat_minor": 0,
8
- "worksheets": [
2
+ "cells": [
9
3
  {
10
- "cells": [
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {
7
+ "collapsed": false
8
+ },
9
+ "outputs": [
11
10
  {
12
- "cell_type": "code",
13
- "collapsed": false,
14
- "input": [
15
- "IRuby.display(Complex(1,2))"
16
- ],
17
- "language": "python",
11
+ "data": {
12
+ "text/latex": [
13
+ "$1+2\\imath$"
14
+ ],
15
+ "text/plain": [
16
+ "(1+2i)"
17
+ ]
18
+ },
18
19
  "metadata": {},
19
- "outputs": [
20
- {
21
- "latex": [
22
- "$1+2\\imath$"
23
- ],
24
- "metadata": {},
25
- "output_type": "pyout",
26
- "prompt_number": 1,
27
- "text": [
28
- "(1+2i)"
29
- ]
30
- }
31
- ],
32
- "prompt_number": 1
20
+ "output_type": "display_data"
21
+ }
22
+ ],
23
+ "source": [
24
+ "IRuby.display(Complex(1,2))"
25
+ ]
26
+ },
27
+ {
28
+ "cell_type": "code",
29
+ "execution_count": 2,
30
+ "metadata": {
31
+ "collapsed": false
32
+ },
33
+ "outputs": [
34
+ {
35
+ "data": {
36
+ "text/latex": [
37
+ "$$\\left(\\begin{array}{cc}\n",
38
+ " 1&2\\\\\n",
39
+ " 3&4\\\\\n",
40
+ "\\end{array}\\right)$$"
41
+ ],
42
+ "text/plain": [
43
+ "Matrix[[1, 2], [3, 4]]"
44
+ ]
45
+ },
46
+ "metadata": {},
47
+ "output_type": "display_data"
33
48
  },
34
49
  {
35
- "cell_type": "code",
36
- "collapsed": false,
37
- "input": [
38
- "require 'matrix'\n",
39
- "IRuby.display(Matrix[[1,2],[3,4]])\n",
40
- "IRuby.display(Matrix[[1,2],[3,4]],format:'latex')\n",
41
- "IRuby.display(Matrix[[1,2],[3,4]],'text/plain')\n",
42
- "IRuby.display(Matrix[[1,2],[3,4]],mime:'text/plain')\n",
43
- "IRuby.display(Matrix[[1,2],[3,4]],'html')"
44
- ],
45
- "language": "python",
50
+ "data": {
51
+ "text/latex": [
52
+ "$$\\left(\\begin{array}{cc}\n",
53
+ " 1&2\\\\\n",
54
+ " 3&4\\\\\n",
55
+ "\\end{array}\\right)$$"
56
+ ],
57
+ "text/plain": [
58
+ "Matrix[[1, 2], [3, 4]]"
59
+ ]
60
+ },
46
61
  "metadata": {},
47
- "outputs": [
48
- {
49
- "latex": [
50
- "$$\\left(\\begin{array}{cc}\n",
51
- " 1&2\\\\\n",
52
- " 3&4\\\\\n",
53
- "\\end{array}\\right)$$"
54
- ],
55
- "metadata": {},
56
- "output_type": "pyout",
57
- "prompt_number": 2,
58
- "text": [
59
- "Matrix[[1, 2], [3, 4]]"
60
- ]
61
- },
62
- {
63
- "latex": [
64
- "$$\\left(\\begin{array}{cc}\n",
65
- " 1&2\\\\\n",
66
- " 3&4\\\\\n",
67
- "\\end{array}\\right)$$"
68
- ],
69
- "metadata": {},
70
- "output_type": "pyout",
71
- "prompt_number": 2,
72
- "text": [
73
- "Matrix[[1, 2], [3, 4]]"
74
- ]
75
- },
76
- {
77
- "metadata": {},
78
- "output_type": "pyout",
79
- "prompt_number": 2,
80
- "text": [
81
- "Matrix[[1, 2], [3, 4]]"
82
- ]
83
- },
84
- {
85
- "metadata": {},
86
- "output_type": "pyout",
87
- "prompt_number": 2,
88
- "text": [
89
- "Matrix[[1, 2], [3, 4]]"
90
- ]
91
- },
92
- {
93
- "html": [
94
- "<table><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr></table>"
95
- ],
96
- "metadata": {},
97
- "output_type": "pyout",
98
- "prompt_number": 2,
99
- "text": [
100
- "Matrix[[1, 2], [3, 4]]"
101
- ]
102
- }
103
- ],
104
- "prompt_number": 2
62
+ "output_type": "display_data"
105
63
  },
106
64
  {
107
- "cell_type": "code",
108
- "collapsed": false,
109
- "input": [],
110
- "language": "python",
65
+ "data": {
66
+ "text/plain": [
67
+ "Matrix[[1, 2], [3, 4]]"
68
+ ]
69
+ },
111
70
  "metadata": {},
112
- "outputs": [],
113
- "prompt_number": 3
71
+ "output_type": "display_data"
72
+ },
73
+ {
74
+ "data": {
75
+ "text/plain": [
76
+ "Matrix[[1, 2], [3, 4]]"
77
+ ]
78
+ },
79
+ "metadata": {},
80
+ "output_type": "display_data"
81
+ },
82
+ {
83
+ "data": {
84
+ "text/html": [
85
+ "<table><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr></table>"
86
+ ],
87
+ "text/plain": [
88
+ "Matrix[[1, 2], [3, 4]]"
89
+ ]
90
+ },
91
+ "metadata": {},
92
+ "output_type": "display_data"
114
93
  }
115
94
  ],
116
- "metadata": {}
95
+ "source": [
96
+ "require 'matrix'\n",
97
+ "IRuby.display(Matrix[[1,2],[3,4]])\n",
98
+ "IRuby.display(Matrix[[1,2],[3,4]],format:'latex')\n",
99
+ "IRuby.display(Matrix[[1,2],[3,4]],'text/plain')\n",
100
+ "IRuby.display(Matrix[[1,2],[3,4]],mime:'text/plain')\n",
101
+ "IRuby.display(Matrix[[1,2],[3,4]],'html')"
102
+ ]
103
+ },
104
+ {
105
+ "cell_type": "code",
106
+ "execution_count": null,
107
+ "metadata": {
108
+ "collapsed": false
109
+ },
110
+ "outputs": [],
111
+ "source": []
112
+ }
113
+ ],
114
+ "metadata": {
115
+ "kernelspec": {
116
+ "display_name": "Ruby",
117
+ "language": "ruby",
118
+ "name": "ruby"
119
+ },
120
+ "language_info": {
121
+ "file_extension": "rb",
122
+ "mimetype": "text/ruby",
123
+ "name": "ruby",
124
+ "version": "2.1.2"
117
125
  }
118
- ]
119
- }
126
+ },
127
+ "nbformat": 4,
128
+ "nbformat_minor": 0
129
+ }
@@ -1,104 +1,102 @@
1
1
  {
2
- "metadata": {
3
- "language": "ruby",
4
- "name": ""
5
- },
6
- "nbformat": 3,
7
- "nbformat_minor": 0,
8
- "worksheets": [
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Standard input and output"
8
+ ]
9
+ },
9
10
  {
10
- "cells": [
11
+ "cell_type": "code",
12
+ "execution_count": 1,
13
+ "metadata": {
14
+ "collapsed": false
15
+ },
16
+ "outputs": [
11
17
  {
12
- "cell_type": "heading",
13
- "level": 1,
14
- "metadata": {},
15
- "source": [
16
- "Standard input and output"
18
+ "name": "stdout",
19
+ "output_type": "stream",
20
+ "text": [
21
+ "Hello, world!\n"
17
22
  ]
18
- },
19
- {
20
- "cell_type": "code",
21
- "collapsed": false,
22
- "input": [
23
- "puts 'Hello, world!'"
24
- ],
25
- "language": "python",
26
- "metadata": {},
27
- "outputs": [
28
- {
29
- "output_type": "stream",
30
- "stream": "stdout",
31
- "text": [
32
- "Hello, world!\n"
33
- ]
34
- }
35
- ],
36
- "prompt_number": 4
37
- },
23
+ }
24
+ ],
25
+ "source": [
26
+ "puts 'Hello, world!'"
27
+ ]
28
+ },
29
+ {
30
+ "cell_type": "code",
31
+ "execution_count": 2,
32
+ "metadata": {
33
+ "collapsed": false
34
+ },
35
+ "outputs": [
38
36
  {
39
- "cell_type": "code",
40
- "collapsed": false,
41
- "input": [
42
- "$stdout.puts 'stdout'\n",
43
- "$stderr.puts 'stderr'"
44
- ],
45
- "language": "python",
46
- "metadata": {},
47
- "outputs": [
48
- {
49
- "output_type": "stream",
50
- "stream": "stdout",
51
- "text": [
52
- "stdout\n"
53
- ]
54
- },
55
- {
56
- "output_type": "stream",
57
- "stream": "stderr",
58
- "text": [
59
- "stderr\n"
60
- ]
61
- }
62
- ],
63
- "prompt_number": 5
37
+ "name": "stdout",
38
+ "output_type": "stream",
39
+ "text": [
40
+ "stdout\n"
41
+ ]
64
42
  },
65
43
  {
66
- "cell_type": "code",
67
- "collapsed": false,
68
- "input": [
69
- "print \"print\\n\"\n",
70
- "$stdout.write \"write\\n\""
71
- ],
72
- "language": "python",
73
- "metadata": {},
74
- "outputs": [
75
- {
76
- "output_type": "stream",
77
- "stream": "stdout",
78
- "text": [
79
- "print\n"
80
- ]
81
- },
82
- {
83
- "output_type": "stream",
84
- "stream": "stdout",
85
- "text": [
86
- "write\n"
87
- ]
88
- }
89
- ],
90
- "prompt_number": 10
91
- },
44
+ "name": "stderr",
45
+ "output_type": "stream",
46
+ "text": [
47
+ "stderr\n"
48
+ ]
49
+ }
50
+ ],
51
+ "source": [
52
+ "$stdout.puts 'stdout'\n",
53
+ "$stderr.puts 'stderr'"
54
+ ]
55
+ },
56
+ {
57
+ "cell_type": "code",
58
+ "execution_count": 3,
59
+ "metadata": {
60
+ "collapsed": false
61
+ },
62
+ "outputs": [
92
63
  {
93
- "cell_type": "code",
94
- "collapsed": false,
95
- "input": [],
96
- "language": "python",
97
- "metadata": {},
98
- "outputs": []
64
+ "name": "stdout",
65
+ "output_type": "stream",
66
+ "text": [
67
+ "print\n",
68
+ "write\n"
69
+ ]
99
70
  }
100
71
  ],
101
- "metadata": {}
72
+ "source": [
73
+ "print \"print\\n\"\n",
74
+ "$stdout.write \"write\\n\""
75
+ ]
76
+ },
77
+ {
78
+ "cell_type": "code",
79
+ "execution_count": null,
80
+ "metadata": {
81
+ "collapsed": false
82
+ },
83
+ "outputs": [],
84
+ "source": []
102
85
  }
103
- ]
104
- }
86
+ ],
87
+ "metadata": {
88
+ "kernelspec": {
89
+ "display_name": "Ruby",
90
+ "language": "ruby",
91
+ "name": "ruby"
92
+ },
93
+ "language_info": {
94
+ "file_extension": "rb",
95
+ "mimetype": "text/ruby",
96
+ "name": "ruby",
97
+ "version": "2.1.2"
98
+ }
99
+ },
100
+ "nbformat": 4,
101
+ "nbformat_minor": 0
102
+ }