iruby 0.2.9 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/workflows/ubuntu.yml +62 -0
- data/CHANGES +64 -0
- data/Gemfile +3 -1
- data/LICENSE +1 -1
- data/README.md +120 -92
- 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 -18
- data/lib/iruby.rb +13 -6
- data/lib/iruby/backend.rb +38 -9
- data/lib/iruby/command.rb +68 -12
- data/lib/iruby/display.rb +81 -41
- data/lib/iruby/event_manager.rb +40 -0
- data/lib/iruby/formatter.rb +3 -3
- data/lib/iruby/input.rb +6 -6
- data/lib/iruby/input/README.ipynb +55 -3
- data/lib/iruby/input/README.md +299 -0
- data/lib/iruby/input/autoload.rb +3 -2
- data/lib/iruby/input/builder.rb +4 -4
- data/lib/iruby/input/button.rb +2 -2
- data/lib/iruby/input/cancel.rb +1 -1
- data/lib/iruby/input/checkbox.rb +22 -4
- data/lib/iruby/input/date.rb +17 -6
- data/lib/iruby/input/field.rb +5 -4
- data/lib/iruby/input/file.rb +3 -3
- data/lib/iruby/input/form.rb +6 -6
- data/lib/iruby/input/label.rb +9 -3
- data/lib/iruby/input/multiple.rb +76 -0
- data/lib/iruby/input/popup.rb +5 -2
- data/lib/iruby/input/radio.rb +18 -6
- data/lib/iruby/input/select.rb +26 -12
- data/lib/iruby/input/textarea.rb +2 -1
- data/lib/iruby/input/widget.rb +2 -2
- data/lib/iruby/jupyter.rb +77 -0
- data/lib/iruby/kernel.rb +171 -31
- data/lib/iruby/ostream.rb +29 -8
- data/lib/iruby/session.rb +116 -0
- data/lib/iruby/session/{rbczmq.rb → cztop.rb} +21 -19
- data/lib/iruby/session/ffi_rzmq.rb +1 -1
- 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 +13 -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 +107 -50
- 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: 84f8ef4d7c7ae64831b901c85aa2e978bd07847c5707899bc82f7f3eed17a825
|
4
|
+
data.tar.gz: 2a2b12b2d7da7571a41286b3de58813c8f3173136bc47cd63516254682f76421
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '079c7183d157d4ca8177ca0025c4a8cfa95bb7cfa1497bfc2d65c9f4b38e00d92d4597ed54557c4ea03cfe56c93ed44768fa17b20fe29957078d8f4074e3f1c3'
|
7
|
+
data.tar.gz: 23a5d31658720706a3e5b2a9db90747e135a5ef473a8eadf554e6ceaa5eab1c0f035ba17161d1c10bcbeb952908b409c4d51144b23c566a15839c3d1574e7da9
|
@@ -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,67 @@
|
|
1
|
+
0.6.1 (under development)
|
2
|
+
|
3
|
+
Bug Fixes:
|
4
|
+
* Follow the messages and hooks orders during execute_request processing (@mrkn)
|
5
|
+
|
6
|
+
0.6.0 (2021-05-25)
|
7
|
+
|
8
|
+
Bug Fixes:
|
9
|
+
* Fix the handling of application/javascript https://github.com/SciRuby/iruby/issues/292, https://github.com/SciRuby/iruby/pull/294 (@kylekyle, @mrkn)
|
10
|
+
|
11
|
+
Enhancements:
|
12
|
+
* 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)
|
13
|
+
* Add the following four events https://github.com/SciRuby/iruby/pull/295 (@mrkn):
|
14
|
+
* `pre-execute` -- occurs before every code execution
|
15
|
+
* `pre-run-cell` -- occurs before every non-silent code execution
|
16
|
+
* `post-execute` -- occurs after every code execution
|
17
|
+
* `post-run-cell` -- occurs after every non-silent code execution
|
18
|
+
* Replace Bond with IRB in PlainBackend https://github.com/SciRuby/iruby/pull/276, https://github.com/SciRuby/iruby/pull/297 (@cfis, @mrkn)
|
19
|
+
|
20
|
+
0.5.0 (2021-03-25)
|
21
|
+
|
22
|
+
Bug Fixes:
|
23
|
+
* Fix Jupyter console crashes issue https://github.com/SciRuby/iruby/pull/210 (@kojix2)
|
24
|
+
* Fix syntax highlighting issue on Jpyter Lab https://github.com/SciRuby/iruby/issues/224 (@kojix2)
|
25
|
+
* Fix interoperability issue with ruby-git https://github.com/SciRuby/iruby/pull/139 (@habemus-papadum)
|
26
|
+
* Fix the issue of `$stderr.write` that cannot handle multiple arguments https://github.com/SciRuby/iruby/issues/206 (@kojix2)
|
27
|
+
* Remove a buggy `inspect_request` implementation https://github.com/SciRuby/iruby/pull/119 (@LunarLanding)
|
28
|
+
* Fix uninitialized constant `Fiddle` caused in initialization phase https://github.com/SciRuby/iruby/issues/264 (@MatthewSteen, @kjoix2)
|
29
|
+
* Fix the issue on displaying a table https://github.com/SciRuby/iruby/pull/281 (@ankane)
|
30
|
+
|
31
|
+
Enhancements:
|
32
|
+
* Add `IRuby.clear_output` method https://github.com/SciRuby/iruby/pull/220 (@kojix2)
|
33
|
+
* Make backtrace on exception simplify and more appropriate for code in a cell https://github.com/SciRuby/iruby/pull/249 (@zheng-yongping)
|
34
|
+
* Make syntax error message more appropriate https://github.com/SciRuby/iruby/pull/251 (@zheng-yongping)
|
35
|
+
* Remove top-level `In` and `Out` constants https://github.com/SciRuby/iruby/pull/229 (@kojix2)
|
36
|
+
* Use text/plain for the default format of `Numo::NArray` objects https://github.com/SciRuby/iruby/pull/255 (@kojix2)
|
37
|
+
* Use ffi-rzmq as the default ZeroMQ adapter https://github.com/SciRuby/iruby/pull/256 (@kojix2)
|
38
|
+
* Drop rbczmq support https://github.com/SciRuby/iruby/pull/260 (@rstammer)
|
39
|
+
* Add ruby-vips image support https://github.com/SciRuby/iruby/pull/279 (@ankane)
|
40
|
+
* Replace mimemagic with mime-types https://github.com/SciRuby/iruby/pull/291 (@mrkn)
|
41
|
+
|
42
|
+
0.4.0 (2019-07-31)
|
43
|
+
|
44
|
+
0.3 (2017-03-26)
|
45
|
+
|
46
|
+
Bug Fixes:
|
47
|
+
* Disable Jupyter keyboard manager for all popups made using IRuby.popup (@kylekyle).
|
48
|
+
* Fix Iruby/Input date values bug that set date fields to whatever the last date value was (@kylekyle).
|
49
|
+
* Fix a bug where time strings put into prompter would give an 'out of range' error (@kylekyle).
|
50
|
+
|
51
|
+
Enhancements:
|
52
|
+
* Improvements to IRuby dependency detection using `Bundler::Dependencies#specs` (@kou).
|
53
|
+
* Use less memory forcing pry to store only the last 3 commands in memory (@kylekyle).
|
54
|
+
* Use bigger z-index that is used accross all browsers (@kylekyle).
|
55
|
+
* Ability to input date values as DateTime objects in IRuby/Input (@kylekyle).
|
56
|
+
* Add option to have check boxes checked by default (@kylekyle).
|
57
|
+
* Option for multi-select in drop down menus in the prompter (@kylekyle).
|
58
|
+
* Add support for multiple widgets using `IRuby::Input::Multiple` (@kylekyle).
|
59
|
+
* Calender icon for date selector icon (@kylekyle).
|
60
|
+
* Add support for Numo/NArray (@zalt50).
|
61
|
+
* Text now only completes after a space (@zalt50).
|
62
|
+
* Remove the DONTWAIT flag when receiving a message (@cloud-oak).
|
63
|
+
* Add support for CZTop (@kou).
|
64
|
+
|
1
65
|
0.2.9 (2016-05-02)
|
2
66
|
|
3
67
|
Bug Fixes:
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,141 +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
|
+
[](https://badge.fury.io/rb/iruby)
|
4
|
+
[](https://github.com/SciRuby/iruby/actions)
|
5
|
+
[](https://mybinder.org/v2/gh/RubyData/binder/master?filepath=ruby-data.ipynb)
|
6
|
+
|
7
|
+
IRuby is a Ruby kernel for [Jupyter project](http://try.jupyter.org/).
|
6
8
|
|
7
|
-
|
9
|
+
## Try IRuby
|
8
10
|
|
9
|
-
|
10
|
-
The installation instructions are divided according to environments mainly because of ZeroMQ.
|
11
|
+
You can try IRuby with a sample notebook on Binder (the same link as the banner placed above):
|
11
12
|
|
12
|
-
|
13
|
-
At first install IPython/Jupyter. I recommend an installation using virtualenv.
|
13
|
+
https://mybinder.org/v2/gh/RubyData/binder/master?filepath=ruby-data.ipynb
|
14
14
|
|
15
|
-
|
16
|
-
virtualenv -p python3 venv
|
17
|
-
source venv/bin/activate
|
18
|
-
pip install 'ipython[notebook]'
|
15
|
+
The following URL launches JupyterLab directly on Binder.
|
19
16
|
|
20
|
-
|
17
|
+
https://mybinder.org/v2/gh/RubyData/binder/master?filepath=../lab
|
21
18
|
|
22
|
-
|
23
|
-
gem install iruby
|
19
|
+
## Installation
|
24
20
|
|
25
|
-
|
21
|
+
### Requirements
|
26
22
|
|
27
|
-
|
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)
|
28
27
|
|
29
|
-
|
30
|
-
At first install IPython/Jupyter. I recommend an installation using [Enthought Canopy](https://www.enthought.com/).
|
28
|
+
If both ffi-rzmq and cztop are installed, ffi-rzmq is used. If you prefer cztop, set the following environment variable.
|
31
29
|
|
32
|
-
|
30
|
+
```sh
|
31
|
+
export IRUBY_SESSION_ADAPTER="cztop"
|
32
|
+
```
|
33
33
|
|
34
|
-
|
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).
|
36
|
+
|
37
|
+
```
|
38
|
+
gem specific_install https://github.com/SciRuby/iruby
|
39
|
+
```
|
35
40
|
|
36
|
-
|
41
|
+
### Ubuntu
|
37
42
|
|
38
|
-
|
43
|
+
Install Jupyter.
|
39
44
|
|
40
|
-
|
45
|
+
#### Ubuntu 17+
|
41
46
|
|
42
|
-
|
43
|
-
|
47
|
+
```shell
|
48
|
+
sudo apt install libtool libffi-dev ruby ruby-dev make
|
49
|
+
sudo apt install libzmq3-dev libczmq-dev
|
44
50
|
|
45
|
-
|
51
|
+
gem install ffi-rzmq
|
52
|
+
gem install iruby --pre
|
53
|
+
iruby register --force
|
54
|
+
```
|
46
55
|
|
47
|
-
|
56
|
+
#### Ubuntu 16
|
48
57
|
|
49
|
-
|
50
|
-
I recommend an installation using [Anaconda](https://store.continuum.io/cshop/anaconda/).
|
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.
|
51
59
|
|
52
|
-
|
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
|
66
|
+
|
67
|
+
gem install cztop
|
68
|
+
gem install iruby --pre
|
69
|
+
iruby register --force
|
70
|
+
```
|
53
71
|
|
54
|
-
|
55
|
-
gem install rbczmq
|
56
|
-
gem install iruby
|
72
|
+
### Windows
|
57
73
|
|
58
|
-
|
74
|
+
Install git and Jupyter.
|
75
|
+
[DevKit](https://rubyinstaller.org/add-ons/devkit.html) is necessary for building RubyGems with native C-based extensions.
|
59
76
|
|
60
|
-
|
61
|
-
|
62
|
-
|
77
|
+
Install ZeroMQ.
|
78
|
+
```shell
|
79
|
+
pacman -S mingw64/mingw-w64-x86_64-zeromq
|
80
|
+
```
|
63
81
|
|
64
|
-
|
65
|
-
|
82
|
+
```shell
|
83
|
+
gem install ffi-rzmq
|
84
|
+
gem install iruby --pre
|
85
|
+
iruby register --force
|
86
|
+
```
|
66
87
|
|
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
|
88
|
+
### macOS
|
75
89
|
|
76
|
-
|
77
|
-
|
78
|
-
```
|
79
|
-
4. make install using ports
|
90
|
+
Install ruby with rbenv or rvm.
|
91
|
+
Install Jupyter.
|
80
92
|
|
81
|
-
|
82
|
-
$ cd /usr/ports/net/py-pyzmq
|
83
|
-
$ sudo make install
|
84
|
-
$ cd /usr/ports/devel/ipython
|
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
|
-
```
|
96
|
-
### Installation for jRuby
|
93
|
+
#### Homebrew
|
97
94
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
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
|
121
|
+
|
122
|
+
Try [RubyData Docker Stacks](https://github.com/RubyData/docker-stacks).
|
123
|
+
Running jupyter notebook:
|
124
|
+
|
125
|
+
```shell
|
126
|
+
docker run -p 8888:8888 rubydata/datascience-notebook
|
127
|
+
```
|
128
|
+
|
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.
|
105
138
|
|
106
|
-
After installation, make sure that your `env` is set up to jruby.
|
107
139
|
```shell
|
108
140
|
$ env ruby -v
|
109
141
|
```
|
142
|
+
|
110
143
|
If you use RVM, it is enough to switch the current version to jruby.
|
111
|
-
|
144
|
+
|
145
|
+
If you have already used IRuby with a different version, you need to generate a new kernel:
|
146
|
+
|
112
147
|
```shell
|
113
148
|
$ iruby register --force
|
114
149
|
```
|
115
|
-
After that you can use iruby with jRuby in usual way.
|
116
150
|
|
117
|
-
|
151
|
+
## Notebooks
|
118
152
|
|
119
153
|
Take a look at the [example notebook](http://nbviewer.ipython.org/urls/raw.github.com/SciRuby/sciruby-notebooks/master/getting_started.ipynb)
|
120
154
|
and the [collection of notebooks](https://github.com/SciRuby/sciruby-notebooks/) which includes a Dockerfile to create a containerized installation of iruby
|
121
155
|
and other scientific gems. You can find the prebuild image at [dockerhub](https://registry.hub.docker.com/u/minad/sciruby-notebooks/).
|
122
156
|
|
157
|
+
## Contributing
|
123
158
|
|
124
|
-
|
125
|
-
|
126
|
-
* IPython/Jupyter >= 3.0.0
|
127
|
-
* Ruby >= 2.1.0
|
128
|
-
|
129
|
-
If you install IRuby with ffi-rzmq instead of rbczmq, libzmq >= 3.2 is added to the list above.
|
130
|
-
|
131
|
-
### Authors
|
159
|
+
Contributions to IRuby are very welcome.
|
132
160
|
|
133
|
-
|
161
|
+
To former contributors
|
134
162
|
|
135
|
-
|
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.
|
136
164
|
|
137
|
-
|
165
|
+
## License
|
138
166
|
|
139
|
-
|
167
|
+
Copyright (c) IRuby contributors and the Ruby Science Foundation.
|
140
168
|
|
141
|
-
|
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
|