iruby 0.2.8 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ubuntu.yml +62 -0
- data/CHANGES +76 -0
- data/Gemfile +3 -1
- data/LICENSE +1 -1
- data/README.md +130 -82
- data/Rakefile +36 -10
- data/ci/Dockerfile.base.erb +41 -0
- data/ci/Dockerfile.main.erb +7 -0
- data/ci/requirements.txt +1 -0
- data/docker/setup.sh +15 -0
- data/docker/test.sh +7 -0
- data/iruby.gemspec +13 -17
- data/lib/iruby.rb +14 -6
- data/lib/iruby/backend.rb +41 -7
- data/lib/iruby/command.rb +68 -12
- data/lib/iruby/display.rb +80 -39
- data/lib/iruby/event_manager.rb +40 -0
- data/lib/iruby/formatter.rb +5 -4
- data/lib/iruby/input.rb +41 -0
- data/lib/iruby/input/README.ipynb +502 -0
- data/lib/iruby/input/README.md +299 -0
- data/lib/iruby/input/autoload.rb +25 -0
- data/lib/iruby/input/builder.rb +67 -0
- data/lib/iruby/input/button.rb +47 -0
- data/lib/iruby/input/cancel.rb +32 -0
- data/lib/iruby/input/checkbox.rb +74 -0
- data/lib/iruby/input/date.rb +37 -0
- data/lib/iruby/input/field.rb +31 -0
- data/lib/iruby/input/file.rb +57 -0
- data/lib/iruby/input/form.rb +77 -0
- data/lib/iruby/input/label.rb +27 -0
- data/lib/iruby/input/multiple.rb +76 -0
- data/lib/iruby/input/popup.rb +41 -0
- data/lib/iruby/input/radio.rb +59 -0
- data/lib/iruby/input/select.rb +59 -0
- data/lib/iruby/input/textarea.rb +23 -0
- data/lib/iruby/input/widget.rb +34 -0
- data/lib/iruby/jupyter.rb +77 -0
- data/lib/iruby/kernel.rb +106 -27
- data/lib/iruby/ostream.rb +29 -8
- data/lib/iruby/session.rb +116 -0
- data/lib/iruby/session/{rbczmq.rb → cztop.rb} +25 -13
- data/lib/iruby/session/ffi_rzmq.rb +15 -2
- data/lib/iruby/session_adapter.rb +72 -0
- data/lib/iruby/session_adapter/cztop_adapter.rb +45 -0
- data/lib/iruby/session_adapter/ffirzmq_adapter.rb +55 -0
- data/lib/iruby/session_adapter/pyzmq_adapter.rb +77 -0
- data/lib/iruby/session_adapter/test_adapter.rb +49 -0
- data/lib/iruby/utils.rb +5 -2
- data/lib/iruby/version.rb +1 -1
- data/run-test.sh +12 -0
- data/tasks/ci.rake +65 -0
- data/test/helper.rb +133 -0
- data/test/integration_test.rb +22 -11
- data/test/iruby/backend_test.rb +37 -0
- data/test/iruby/command_test.rb +207 -0
- data/test/iruby/event_manager_test.rb +92 -0
- data/test/iruby/jupyter_test.rb +27 -0
- data/test/iruby/kernel_test.rb +153 -0
- data/test/iruby/mime_test.rb +43 -0
- data/test/iruby/multi_logger_test.rb +1 -2
- data/test/iruby/session_adapter/cztop_adapter_test.rb +20 -0
- data/test/iruby/session_adapter/ffirzmq_adapter_test.rb +20 -0
- data/test/iruby/session_adapter/session_adapter_test_base.rb +27 -0
- data/test/iruby/session_adapter_test.rb +91 -0
- data/test/iruby/session_test.rb +48 -0
- data/test/run-test.rb +19 -0
- metadata +132 -43
- data/.travis.yml +0 -16
- data/CONTRIBUTORS +0 -19
- data/test/test_helper.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bc4c6b99aa811b7b1e6bf3e845c7dfa023dc26ce929dbc284836081d422c4b5f
|
4
|
+
data.tar.gz: f68c0f62665ec6bb302e460885ca6e54e93f7102b3cdf699cb67143155a6181a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2de933258f837300d49209e51140276d9373ab6497c716cfe590d8e9e989d89a7e8e12410e4275c20d065e0fdfe1221c88074eb172bcadbab07c58077009d118
|
7
|
+
data.tar.gz: 3dfa8d4abbe218873e42626056d68bc24e2372f153f18316eb152ce08aa1f95c68b301cb41f7cf154ae8b5bb94324e9071296ff67f90325aed5b08dfa123cecd
|
@@ -0,0 +1,62 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
- push
|
5
|
+
- pull_request
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
name: Test
|
10
|
+
runs-on: ${{ matrix.os }}
|
11
|
+
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
os:
|
16
|
+
- ubuntu-20.04
|
17
|
+
- ubuntu-latest
|
18
|
+
ruby:
|
19
|
+
- 3.0
|
20
|
+
- 2.7
|
21
|
+
- 2.6
|
22
|
+
- 2.5
|
23
|
+
- 2.4
|
24
|
+
- 2.3
|
25
|
+
- debug
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v2
|
29
|
+
with:
|
30
|
+
fetch-depth: 1
|
31
|
+
|
32
|
+
- uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: ${{ matrix.ruby }}
|
35
|
+
|
36
|
+
- name: Install requirements on ubuntu
|
37
|
+
run: |
|
38
|
+
sudo apt install -y --no-install-recommends \
|
39
|
+
libczmq-dev \
|
40
|
+
python3 \
|
41
|
+
python3-pip \
|
42
|
+
python3-setuptools
|
43
|
+
sudo pip3 install wheel
|
44
|
+
sudo pip3 install -r ci/requirements.txt
|
45
|
+
|
46
|
+
- run: gem install bundler
|
47
|
+
|
48
|
+
- run: bundle install --jobs 4 --retry 3
|
49
|
+
|
50
|
+
- name: Run tests
|
51
|
+
env:
|
52
|
+
PYTHON: python3
|
53
|
+
ADAPTERS: cztop ffi-rzmq pyzmq
|
54
|
+
run: |
|
55
|
+
for adapter in $ADAPTERS; do
|
56
|
+
export IRUBY_TEST_SESSION_ADAPTER_NAME=$adapter
|
57
|
+
bundle exec rake test TESTOPTS=-v
|
58
|
+
done
|
59
|
+
|
60
|
+
- run: rake build
|
61
|
+
|
62
|
+
- run: gem install pkg/*.gem
|
data/CHANGES
CHANGED
@@ -1,3 +1,79 @@
|
|
1
|
+
0.6.0 (2021-05-25)
|
2
|
+
|
3
|
+
Bug Fixes:
|
4
|
+
* Fix the handling of application/javascript https://github.com/SciRuby/iruby/issues/292, https://github.com/SciRuby/iruby/pull/294 (@kylekyle, @mrkn)
|
5
|
+
|
6
|
+
Enhancements:
|
7
|
+
* Add the `initialized` event in `IRuby::Kernel` class https://github.com/SciRuby/iruby/pull/168, https://github.com/SciRuby/iruby/pull/296 (@Yuki-Inoue, @mrkn)
|
8
|
+
* Add the following four events https://github.com/SciRuby/iruby/pull/295 (@mrkn):
|
9
|
+
* `pre-execute` -- occurs before every code execution
|
10
|
+
* `pre-run-cell` -- occurs before every non-silent code execution
|
11
|
+
* `post-execute` -- occurs after every code execution
|
12
|
+
* `post-run-cell` -- occurs after every non-silent code execution
|
13
|
+
* Replace Bond with IRB in PlainBackend https://github.com/SciRuby/iruby/pull/276, https://github.com/SciRuby/iruby/pull/297 (@cfis, @mrkn)
|
14
|
+
|
15
|
+
0.5.0 (2021-03-25)
|
16
|
+
|
17
|
+
Bug Fixes:
|
18
|
+
* Fix Jupyter console crashes issue https://github.com/SciRuby/iruby/pull/210 (@kojix2)
|
19
|
+
* Fix syntax highlighting issue on Jpyter Lab https://github.com/SciRuby/iruby/issues/224 (@kojix2)
|
20
|
+
* Fix interoperability issue with ruby-git https://github.com/SciRuby/iruby/pull/139 (@habemus-papadum)
|
21
|
+
* Fix the issue of `$stderr.write` that cannot handle multiple arguments https://github.com/SciRuby/iruby/issues/206 (@kojix2)
|
22
|
+
* Remove a buggy `inspect_request` implementation https://github.com/SciRuby/iruby/pull/119 (@LunarLanding)
|
23
|
+
* Fix uninitialized constant `Fiddle` caused in initialization phase https://github.com/SciRuby/iruby/issues/264 (@MatthewSteen, @kjoix2)
|
24
|
+
* Fix the issue on displaying a table https://github.com/SciRuby/iruby/pull/281 (@ankane)
|
25
|
+
|
26
|
+
Enhancements:
|
27
|
+
* Add `IRuby.clear_output` method https://github.com/SciRuby/iruby/pull/220 (@kojix2)
|
28
|
+
* Make backtrace on exception simplify and more appropriate for code in a cell https://github.com/SciRuby/iruby/pull/249 (@zheng-yongping)
|
29
|
+
* Make syntax error message more appropriate https://github.com/SciRuby/iruby/pull/251 (@zheng-yongping)
|
30
|
+
* Remove top-level `In` and `Out` constants https://github.com/SciRuby/iruby/pull/229 (@kojix2)
|
31
|
+
* Use text/plain for the default format of `Numo::NArray` objects https://github.com/SciRuby/iruby/pull/255 (@kojix2)
|
32
|
+
* Use ffi-rzmq as the default ZeroMQ adapter https://github.com/SciRuby/iruby/pull/256 (@kojix2)
|
33
|
+
* Drop rbczmq support https://github.com/SciRuby/iruby/pull/260 (@rstammer)
|
34
|
+
* Add ruby-vips image support https://github.com/SciRuby/iruby/pull/279 (@ankane)
|
35
|
+
* Replace mimemagic with mime-types https://github.com/SciRuby/iruby/pull/291 (@mrkn)
|
36
|
+
|
37
|
+
0.4.0 (2019-07-31)
|
38
|
+
|
39
|
+
0.3 (2017-03-26)
|
40
|
+
|
41
|
+
Bug Fixes:
|
42
|
+
* Disable Jupyter keyboard manager for all popups made using IRuby.popup (@kylekyle).
|
43
|
+
* Fix Iruby/Input date values bug that set date fields to whatever the last date value was (@kylekyle).
|
44
|
+
* Fix a bug where time strings put into prompter would give an 'out of range' error (@kylekyle).
|
45
|
+
|
46
|
+
Enhancements:
|
47
|
+
* Improvements to IRuby dependency detection using `Bundler::Dependencies#specs` (@kou).
|
48
|
+
* Use less memory forcing pry to store only the last 3 commands in memory (@kylekyle).
|
49
|
+
* Use bigger z-index that is used accross all browsers (@kylekyle).
|
50
|
+
* Ability to input date values as DateTime objects in IRuby/Input (@kylekyle).
|
51
|
+
* Add option to have check boxes checked by default (@kylekyle).
|
52
|
+
* Option for multi-select in drop down menus in the prompter (@kylekyle).
|
53
|
+
* Add support for multiple widgets using `IRuby::Input::Multiple` (@kylekyle).
|
54
|
+
* Calender icon for date selector icon (@kylekyle).
|
55
|
+
* Add support for Numo/NArray (@zalt50).
|
56
|
+
* Text now only completes after a space (@zalt50).
|
57
|
+
* Remove the DONTWAIT flag when receiving a message (@cloud-oak).
|
58
|
+
* Add support for CZTop (@kou).
|
59
|
+
|
60
|
+
0.2.9 (2016-05-02)
|
61
|
+
|
62
|
+
Bug Fixes:
|
63
|
+
* Fix an error where a NoMethodError was being raised where a table rendered using an Array of Hashes has more than `maxcols` columns. (@CGamesPlay)
|
64
|
+
* Patch PryBackend to throw unterminated string and unexpected end-of-file syntax errors (@kylekyle)
|
65
|
+
|
66
|
+
Enhnacements:
|
67
|
+
* Add an IRuby::Input class which provides widgets for getting inputs from users. (@kylekyle)
|
68
|
+
* Add data_uri dependency (@kylekyle)
|
69
|
+
* Added a clear_output display function (@mrkn)
|
70
|
+
* Doc fixes for installation (@kozo2, @generall)
|
71
|
+
|
72
|
+
0.2.8 (2015-12-06)
|
73
|
+
|
74
|
+
* Add compatibility with ffi-rzmq
|
75
|
+
* Windows support
|
76
|
+
|
1
77
|
0.2.7 (2015-07-02)
|
2
78
|
|
3
79
|
* Fix problem with autoloaded constants in Display, problem with sciruby gem
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,121 +1,169 @@
|
|
1
|
-
***The current master branch and gem version >= 0.2 are compatible with IPython3/Jupyter. If you require IPython2 support, please install an older gem version < 0.2 or use the branch ipython2***
|
2
|
-
|
3
1
|
# IRuby
|
4
2
|
|
5
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/iruby.svg)](https://badge.fury.io/rb/iruby)
|
4
|
+
[![Build Status](https://github.com/SciRuby/iruby/workflows/CI/badge.svg)](https://github.com/SciRuby/iruby/actions)
|
5
|
+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/RubyData/binder/master?filepath=ruby-data.ipynb)
|
6
6
|
|
7
|
-
|
7
|
+
IRuby is a Ruby kernel for [Jupyter project](http://try.jupyter.org/).
|
8
8
|
|
9
|
-
|
10
|
-
The installation instructions are divided according to environments mainly because of ZeroMQ.
|
9
|
+
## Try IRuby
|
11
10
|
|
12
|
-
|
13
|
-
At first install IPython/Jupyter. I recommend an installation using virtualenv.
|
11
|
+
You can try IRuby with a sample notebook on Binder (the same link as the banner placed above):
|
14
12
|
|
15
|
-
|
16
|
-
virtualenv -p python3 venv
|
17
|
-
source venv/bin/activate
|
18
|
-
pip install 'ipython[notebook]'
|
13
|
+
https://mybinder.org/v2/gh/RubyData/binder/master?filepath=ruby-data.ipynb
|
19
14
|
|
20
|
-
|
15
|
+
The following URL launches JupyterLab directly on Binder.
|
21
16
|
|
22
|
-
|
23
|
-
gem install iruby
|
17
|
+
https://mybinder.org/v2/gh/RubyData/binder/master?filepath=../lab
|
24
18
|
|
25
|
-
|
19
|
+
## Installation
|
26
20
|
|
27
|
-
|
21
|
+
### Requirements
|
28
22
|
|
29
|
-
|
30
|
-
|
23
|
+
* [Jupyter](https://jupyter.org)
|
24
|
+
* One of the following is required
|
25
|
+
* [ffi-rzmq](https://github.com/chuckremes/ffi-rzmq) and [libzmq](https://github.com/zeromq/libzmq)
|
26
|
+
* [CZTop](https://gitlab.com/paddor/cztop) and [CZMQ](https://github.com/zeromq/czmq)
|
31
27
|
|
32
|
-
|
28
|
+
If both ffi-rzmq and cztop are installed, ffi-rzmq is used. If you prefer cztop, set the following environment variable.
|
33
29
|
|
34
|
-
|
30
|
+
```sh
|
31
|
+
export IRUBY_SESSION_ADAPTER="cztop"
|
32
|
+
```
|
35
33
|
|
36
|
-
|
34
|
+
* We recommend the [Pry](https://github.com/pry/pry) backend for full functionality.
|
35
|
+
* If you want to install the latest version of IRuby from the source code, try [specific_install](https://github.com/rdp/specific_install).
|
37
36
|
|
38
|
-
|
37
|
+
```
|
38
|
+
gem specific_install https://github.com/SciRuby/iruby
|
39
|
+
```
|
39
40
|
|
40
|
-
|
41
|
-
gem install iruby
|
41
|
+
### Ubuntu
|
42
42
|
|
43
|
-
|
43
|
+
Install Jupyter.
|
44
44
|
|
45
|
-
|
45
|
+
#### Ubuntu 17+
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
```shell
|
48
|
+
sudo apt install libtool libffi-dev ruby ruby-dev make
|
49
|
+
sudo apt install libzmq3-dev libczmq-dev
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
gem install ffi-rzmq
|
52
|
+
gem install iruby --pre
|
53
|
+
iruby register --force
|
54
|
+
```
|
55
55
|
|
56
|
-
|
56
|
+
#### Ubuntu 16
|
57
57
|
|
58
|
-
|
58
|
+
CZTop requires CZMQ >= 4.0.0 and ZMQ >= 4.2.0. The official packages for Ubuntu 16.04 don't satisfy these version requrements, so you need to install from source.
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
```shell
|
61
|
+
sudo apt install libtool libffi-dev ruby ruby-dev make
|
62
|
+
sudo apt install git libzmq-dev autoconf pkg-config
|
63
|
+
git clone https://github.com/zeromq/czmq
|
64
|
+
cd czmq
|
65
|
+
./autogen.sh && ./configure && sudo make && sudo make install
|
63
66
|
|
64
|
-
|
65
|
-
|
67
|
+
gem install cztop
|
68
|
+
gem install iruby --pre
|
69
|
+
iruby register --force
|
70
|
+
```
|
66
71
|
|
67
|
-
|
68
|
-
LIB_DEPENDS= libzmq.so:${PORTSDIR}/net/libzmq4
|
69
|
-
```
|
70
|
-
with
|
71
|
-
```shell
|
72
|
-
LIB_DEPENDS= libzmq.so:${PORTSDIR}/net/libzmq3
|
73
|
-
```
|
74
|
-
3. install related packages
|
72
|
+
### Windows
|
75
73
|
|
76
|
-
|
77
|
-
|
78
|
-
```
|
79
|
-
4. make install using ports
|
74
|
+
Install git and Jupyter.
|
75
|
+
[DevKit](https://rubyinstaller.org/add-ons/devkit.html) is necessary for building RubyGems with native C-based extensions.
|
80
76
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
$ sudo make install
|
86
|
-
```
|
87
|
-
Then, install iruby and related ports and gems.
|
88
|
-
```shell
|
89
|
-
$ sudo pkg install rubygem-mimemagic
|
90
|
-
$ sudo gem install ffi-rzmq # install ffi, ffi-rzmq-core and ffi-rzmq
|
91
|
-
$ git clone https://github.com/SciRuby/iruby.git
|
92
|
-
$ cd iruby
|
93
|
-
$ gem build iruby.gemspec
|
94
|
-
$ sudo gem install iruby-0.2.7.gem
|
95
|
-
```
|
77
|
+
Install ZeroMQ.
|
78
|
+
```shell
|
79
|
+
pacman -S mingw64/mingw-w64-x86_64-zeromq
|
80
|
+
```
|
96
81
|
|
97
|
-
|
82
|
+
```shell
|
83
|
+
gem install ffi-rzmq
|
84
|
+
gem install iruby --pre
|
85
|
+
iruby register --force
|
86
|
+
```
|
98
87
|
|
99
|
-
|
100
|
-
|
101
|
-
|
88
|
+
### macOS
|
89
|
+
|
90
|
+
Install ruby with rbenv or rvm.
|
91
|
+
Install Jupyter.
|
92
|
+
|
93
|
+
#### Homebrew
|
94
|
+
|
95
|
+
```shell
|
96
|
+
brew install automake gmp libtool wget
|
97
|
+
brew install zeromq --HEAD
|
98
|
+
brew install czmq --HEAD
|
99
|
+
```
|
100
|
+
|
101
|
+
```shell
|
102
|
+
# export LIBZMQ_PATH=$(brew --prefix zeromq)/lib
|
103
|
+
# export LIBCZMQ_PATH=$(brew --prefix czmq)/lib
|
104
|
+
# gem install cztop
|
105
|
+
gem install ffi-rzmq
|
106
|
+
gem install iruby --pre
|
107
|
+
iruby register --force
|
108
|
+
```
|
109
|
+
|
110
|
+
#### MacPorts
|
111
|
+
|
112
|
+
If you are using macports, run the following commands.
|
113
|
+
|
114
|
+
```shell
|
115
|
+
port install libtool autoconf automake autogen
|
116
|
+
gem install ffi-rzmq
|
117
|
+
gem install iruby
|
118
|
+
```
|
119
|
+
|
120
|
+
### Docker
|
102
121
|
|
122
|
+
Try [RubyData Docker Stacks](https://github.com/RubyData/docker-stacks).
|
123
|
+
Running jupyter notebook:
|
103
124
|
|
104
|
-
|
125
|
+
```shell
|
126
|
+
docker run -p 8888:8888 rubydata/datascience-notebook
|
127
|
+
```
|
105
128
|
|
106
|
-
|
107
|
-
|
129
|
+
### Installation for JRuby
|
130
|
+
|
131
|
+
You can use Java classes in your IRuby notebook.
|
132
|
+
|
133
|
+
* JRuby version >= 9.0.4.0
|
134
|
+
* cztop gem
|
135
|
+
* iruby gem
|
136
|
+
|
137
|
+
After installation, make sure that your `env` is set up to use jruby.
|
138
|
+
|
139
|
+
```shell
|
140
|
+
$ env ruby -v
|
141
|
+
```
|
142
|
+
|
143
|
+
If you use RVM, it is enough to switch the current version to jruby.
|
144
|
+
|
145
|
+
If you have already used IRuby with a different version, you need to generate a new kernel:
|
146
|
+
|
147
|
+
```shell
|
148
|
+
$ iruby register --force
|
149
|
+
```
|
150
|
+
|
151
|
+
## Notebooks
|
152
|
+
|
153
|
+
Take a look at the [example notebook](http://nbviewer.ipython.org/urls/raw.github.com/SciRuby/sciruby-notebooks/master/getting_started.ipynb)
|
154
|
+
and the [collection of notebooks](https://github.com/SciRuby/sciruby-notebooks/) which includes a Dockerfile to create a containerized installation of iruby
|
155
|
+
and other scientific gems. You can find the prebuild image at [dockerhub](https://registry.hub.docker.com/u/minad/sciruby-notebooks/).
|
108
156
|
|
109
|
-
|
157
|
+
## Contributing
|
110
158
|
|
111
|
-
|
159
|
+
Contributions to IRuby are very welcome.
|
112
160
|
|
113
|
-
|
161
|
+
To former contributors
|
114
162
|
|
115
|
-
|
163
|
+
In February 2021, [IRuby became the canonical repository](https://github.com/SciRuby/iruby/issues/285) and is no longer a fork from [minrk/iruby](https://github.com/minrk/iruby). Please fork from this repository again before making pull requests.
|
116
164
|
|
117
|
-
|
165
|
+
## License
|
118
166
|
|
119
|
-
|
167
|
+
Copyright (c) IRuby contributors and the Ruby Science Foundation.
|
120
168
|
|
121
|
-
|
169
|
+
Licensed under the [MIT](LICENSE) license.
|
data/Rakefile
CHANGED
@@ -1,15 +1,41 @@
|
|
1
|
-
require
|
1
|
+
require "bundler/gem_helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
base_dir = File.join(File.dirname(__FILE__))
|
4
|
+
|
5
|
+
helper = Bundler::GemHelper.new(base_dir)
|
6
|
+
helper.install
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
FileList['tasks/**.rake'].each {|f| load f }
|
9
|
+
|
10
|
+
desc "Run tests"
|
11
|
+
task :test do
|
12
|
+
cd(base_dir) do
|
13
|
+
ruby("test/run-test.rb")
|
14
|
+
end
|
13
15
|
end
|
14
16
|
|
15
17
|
task default: 'test'
|
18
|
+
|
19
|
+
namespace :docker do
|
20
|
+
def root_dir
|
21
|
+
@root_dir ||= File.expand_path("..", __FILE__)
|
22
|
+
end
|
23
|
+
|
24
|
+
task :build do
|
25
|
+
container_name = "iruby_build"
|
26
|
+
image_name = "mrkn/iruby"
|
27
|
+
sh "docker", "run",
|
28
|
+
"--name", container_name,
|
29
|
+
"-v", "#{root_dir}:/tmp/iruby",
|
30
|
+
"rubylang/ruby", "/bin/bash", "/tmp/iruby/docker/setup.sh"
|
31
|
+
sh "docker", "commit", container_name, image_name
|
32
|
+
sh "docker", "rm", container_name
|
33
|
+
end
|
34
|
+
|
35
|
+
task :test do
|
36
|
+
root_dir = File.expand_path("..", __FILE__)
|
37
|
+
sh "docker", "run", "-it", "--rm",
|
38
|
+
"-v", "#{root_dir}:/tmp/iruby",
|
39
|
+
"mrkn/iruby", "/bin/bash", "/tmp/iruby/docker/test.sh"
|
40
|
+
end
|
41
|
+
end
|