iruby 0.2.9 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ubuntu.yml +62 -0
  3. data/CHANGES +64 -0
  4. data/Gemfile +3 -1
  5. data/LICENSE +1 -1
  6. data/README.md +120 -92
  7. data/Rakefile +36 -10
  8. data/ci/Dockerfile.base.erb +41 -0
  9. data/ci/Dockerfile.main.erb +7 -0
  10. data/ci/requirements.txt +1 -0
  11. data/docker/setup.sh +15 -0
  12. data/docker/test.sh +7 -0
  13. data/iruby.gemspec +13 -18
  14. data/lib/iruby.rb +13 -6
  15. data/lib/iruby/backend.rb +38 -9
  16. data/lib/iruby/command.rb +68 -12
  17. data/lib/iruby/display.rb +81 -41
  18. data/lib/iruby/event_manager.rb +40 -0
  19. data/lib/iruby/formatter.rb +3 -3
  20. data/lib/iruby/input.rb +6 -6
  21. data/lib/iruby/input/README.ipynb +55 -3
  22. data/lib/iruby/input/README.md +299 -0
  23. data/lib/iruby/input/autoload.rb +3 -2
  24. data/lib/iruby/input/builder.rb +4 -4
  25. data/lib/iruby/input/button.rb +2 -2
  26. data/lib/iruby/input/cancel.rb +1 -1
  27. data/lib/iruby/input/checkbox.rb +22 -4
  28. data/lib/iruby/input/date.rb +17 -6
  29. data/lib/iruby/input/field.rb +5 -4
  30. data/lib/iruby/input/file.rb +3 -3
  31. data/lib/iruby/input/form.rb +6 -6
  32. data/lib/iruby/input/label.rb +9 -3
  33. data/lib/iruby/input/multiple.rb +76 -0
  34. data/lib/iruby/input/popup.rb +5 -2
  35. data/lib/iruby/input/radio.rb +18 -6
  36. data/lib/iruby/input/select.rb +26 -12
  37. data/lib/iruby/input/textarea.rb +2 -1
  38. data/lib/iruby/input/widget.rb +2 -2
  39. data/lib/iruby/jupyter.rb +77 -0
  40. data/lib/iruby/kernel.rb +171 -31
  41. data/lib/iruby/ostream.rb +29 -8
  42. data/lib/iruby/session.rb +116 -0
  43. data/lib/iruby/session/{rbczmq.rb → cztop.rb} +21 -19
  44. data/lib/iruby/session/ffi_rzmq.rb +1 -1
  45. data/lib/iruby/session_adapter.rb +72 -0
  46. data/lib/iruby/session_adapter/cztop_adapter.rb +45 -0
  47. data/lib/iruby/session_adapter/ffirzmq_adapter.rb +55 -0
  48. data/lib/iruby/session_adapter/pyzmq_adapter.rb +77 -0
  49. data/lib/iruby/session_adapter/test_adapter.rb +49 -0
  50. data/lib/iruby/utils.rb +13 -2
  51. data/lib/iruby/version.rb +1 -1
  52. data/run-test.sh +12 -0
  53. data/tasks/ci.rake +65 -0
  54. data/test/helper.rb +133 -0
  55. data/test/integration_test.rb +22 -11
  56. data/test/iruby/backend_test.rb +37 -0
  57. data/test/iruby/command_test.rb +207 -0
  58. data/test/iruby/event_manager_test.rb +92 -0
  59. data/test/iruby/jupyter_test.rb +27 -0
  60. data/test/iruby/kernel_test.rb +153 -0
  61. data/test/iruby/mime_test.rb +43 -0
  62. data/test/iruby/multi_logger_test.rb +1 -2
  63. data/test/iruby/session_adapter/cztop_adapter_test.rb +20 -0
  64. data/test/iruby/session_adapter/ffirzmq_adapter_test.rb +20 -0
  65. data/test/iruby/session_adapter/session_adapter_test_base.rb +27 -0
  66. data/test/iruby/session_adapter_test.rb +91 -0
  67. data/test/iruby/session_test.rb +48 -0
  68. data/test/run-test.rb +19 -0
  69. metadata +107 -50
  70. data/.travis.yml +0 -16
  71. data/CONTRIBUTORS +0 -19
  72. data/test/test_helper.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: edce35917d38e538781f2ab3827063693e6c6417
4
- data.tar.gz: 9048d037809e1c69ff223c9363a2e743a5466931
2
+ SHA256:
3
+ metadata.gz: 84f8ef4d7c7ae64831b901c85aa2e978bd07847c5707899bc82f7f3eed17a825
4
+ data.tar.gz: 2a2b12b2d7da7571a41286b3de58813c8f3173136bc47cd63516254682f76421
5
5
  SHA512:
6
- metadata.gz: 319cc7a36eadd9c88ee9aad9cf9a3ae845d32d17efc8c00ec228ae89988b1273ffb2e26e0721ff3337454cd7e7d27ca36d9885fef05b4d9198d14268c5b1785b
7
- data.tar.gz: c0ff35cf5547c57343919a427041ed4fb297f3947f26b795252522bf85d7850f7ad44a23c73807606394a9078a68503f3bbaf36074bade8ced1e4b6da22aae91
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
@@ -10,6 +10,8 @@ end
10
10
  group :plot do
11
11
  gem 'gnuplot'
12
12
  gem 'rubyvis'
13
- gem 'nyaplot', github: 'domitry/nyaplot'
14
13
  end
15
14
 
15
+ group :test do
16
+ gem 'cztop'
17
+ end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013-2015 IRuby contributors and the Ruby Science Foundation
1
+ Copyright (c) 2013 - present IRuby contributors and the Ruby Science Foundation
2
2
 
3
3
  MIT License
4
4
 
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
- This is a Ruby kernel for IPython/Jupyter and is part of [SciRuby](http://sciruby.com/). You can try it at [try.jupyter.org](http://try.jupyter.org/).
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
+
7
+ IRuby is a Ruby kernel for [Jupyter project](http://try.jupyter.org/).
6
8
 
7
- ![Screenshot](https://cloud.githubusercontent.com/assets/50754/7956845/3fa46df8-09e3-11e5-8641-f5b8669061b5.png)
9
+ ## Try IRuby
8
10
 
9
- ### Quick start
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
- #### Ubuntu/Debian
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
- apt-get install python3-dev virtualenv libzmq3-dev
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
- After that, install the Ruby gem.
17
+ https://mybinder.org/v2/gh/RubyData/binder/master?filepath=../lab
21
18
 
22
- gem install rbczmq
23
- gem install iruby
19
+ ## Installation
24
20
 
25
- Now you can run iruby with:
21
+ ### Requirements
26
22
 
27
- iruby notebook
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
- #### Windows
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
- Please update your PATH to include build tools or download the DevKit from http://rubyinstaller.org/downloads and follow [this instructions](http://github.com/oneclick/rubyinstaller/wiki/Development-Kit).
30
+ ```sh
31
+ export IRUBY_SESSION_ADAPTER="cztop"
32
+ ```
33
33
 
34
- After that install ZeroMQ Legacy Stable Release 3.2.4 [x86 build for Windows XP SP3 and newer](http://miru.hk/archive/ZeroMQ-3.2.4~miru1.0-x86.exe).
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
- Rename `libzmq-v100-mt-3_2_4.dll` to `libzmq.dll`.
41
+ ### Ubuntu
37
42
 
38
- Add the dll path to the PATH system variable.
43
+ Install Jupyter.
39
44
 
40
- Run two commands below:
45
+ #### Ubuntu 17+
41
46
 
42
- gem install ffi-rzmq
43
- gem install iruby
47
+ ```shell
48
+ sudo apt install libtool libffi-dev ruby ruby-dev make
49
+ sudo apt install libzmq3-dev libczmq-dev
44
50
 
45
- Now you can run iruby with:
51
+ gem install ffi-rzmq
52
+ gem install iruby --pre
53
+ iruby register --force
54
+ ```
46
55
 
47
- iruby notebook
56
+ #### Ubuntu 16
48
57
 
49
- #### Mac
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
- After that, run three commands shown below.
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
- brew install libtool autoconf automake autogen
55
- gem install rbczmq
56
- gem install iruby
72
+ ### Windows
57
73
 
58
- #### FreeBSD
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
- At first install IPython/Jupyter.
61
- There is a pyzmq ports (ports/net/py-pyzmq) which depends on libzmq4, however, it doesn't works with ipython.
62
- Therefore we use libzmq3 like the following:
77
+ Install ZeroMQ.
78
+ ```shell
79
+ pacman -S mingw64/mingw-w64-x86_64-zeromq
80
+ ```
63
81
 
64
- 1. make your ports tree up-to-date.
65
- 2. replace LIBDEPENDS line in ports/net/py-pyzmq/Makefile
82
+ ```shell
83
+ gem install ffi-rzmq
84
+ gem install iruby --pre
85
+ iruby register --force
86
+ ```
66
87
 
67
- ```shell
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
- ```shell
77
- $ sudo pkg install libzmq3 py27-qt4-gui py27-pexpect-3.3 py27-qt4-svg py27-pygments py27-Jinja2 py27-tornado py27-jsonschema
78
- ```
79
- 4. make install using ports
90
+ Install ruby with rbenv or rvm.
91
+ Install Jupyter.
80
92
 
81
- ```shell
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
- Since jRuby is fully compatible with Ruby version 2.2, it is possible to use iruby with jRuby.
99
- It can be helpful if you want to use java classes in your iruby notebook.
100
- This will require the following software:
101
- * jRuby version >= 9.0.4.0
102
- * ZeroMQ version >= 4.1.4 (You may have to build it from source.)
103
- * ffi-rzmq gem
104
- * this iruby gem
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
- If you have already used iruby with a different version, you need to generate a new kernel:
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
- ### After the installation
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
- ### Required dependencies
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
- See the [CONTRIBUTORS](CONTRIBUTORS) file.
161
+ To former contributors
134
162
 
135
- ### License
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
- Copyright © 2013-15, IRuby contributors and the Ruby Science Foundation.
165
+ ## License
138
166
 
139
- All rights reserved.
167
+ Copyright (c) IRuby contributors and the Ruby Science Foundation.
140
168
 
141
- IRuby, along with [SciRuby](http://sciruby.com/), is licensed under the MIT license. See the [LICENSE](LICENSE) file for details.
169
+ Licensed under the [MIT](LICENSE) license.
data/Rakefile CHANGED
@@ -1,15 +1,41 @@
1
- require 'rake/testtask'
1
+ require "bundler/gem_helper"
2
2
 
3
- begin
4
- require 'bundler/gem_tasks'
5
- rescue Exception
6
- end
3
+ base_dir = File.join(File.dirname(__FILE__))
4
+
5
+ helper = Bundler::GemHelper.new(base_dir)
6
+ helper.install
7
7
 
8
- Rake::TestTask.new('test') do |t|
9
- t.libs << 'lib'
10
- t.libs << 'test'
11
- t.test_files = FileList['test/**/*_test.rb']
12
- t.verbose = true
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