concurrently 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.rspec +4 -0
  4. data/.travis.yml +16 -0
  5. data/.yardopts +7 -0
  6. data/Gemfile +17 -0
  7. data/LICENSE +176 -0
  8. data/README.md +129 -0
  9. data/RELEASE_NOTES.md +49 -0
  10. data/Rakefile +28 -0
  11. data/concurrently.gemspec +33 -0
  12. data/ext/Ruby/thread.rb +28 -0
  13. data/ext/all/array.rb +24 -0
  14. data/ext/mruby/array.rb +19 -0
  15. data/ext/mruby/fiber.rb +5 -0
  16. data/ext/mruby/io.rb +54 -0
  17. data/guides/Installation.md +46 -0
  18. data/guides/Overview.md +335 -0
  19. data/guides/Performance.md +140 -0
  20. data/guides/Troubleshooting.md +262 -0
  21. data/lib/Ruby/concurrently.rb +12 -0
  22. data/lib/Ruby/concurrently/error.rb +4 -0
  23. data/lib/Ruby/concurrently/event_loop.rb +24 -0
  24. data/lib/Ruby/concurrently/event_loop/io_selector.rb +38 -0
  25. data/lib/all/concurrently/error.rb +10 -0
  26. data/lib/all/concurrently/evaluation.rb +109 -0
  27. data/lib/all/concurrently/evaluation/error.rb +18 -0
  28. data/lib/all/concurrently/event_loop.rb +101 -0
  29. data/lib/all/concurrently/event_loop/fiber.rb +37 -0
  30. data/lib/all/concurrently/event_loop/io_selector.rb +42 -0
  31. data/lib/all/concurrently/event_loop/proc_fiber_pool.rb +18 -0
  32. data/lib/all/concurrently/event_loop/run_queue.rb +111 -0
  33. data/lib/all/concurrently/proc.rb +233 -0
  34. data/lib/all/concurrently/proc/evaluation.rb +246 -0
  35. data/lib/all/concurrently/proc/fiber.rb +67 -0
  36. data/lib/all/concurrently/version.rb +8 -0
  37. data/lib/all/io.rb +248 -0
  38. data/lib/all/kernel.rb +201 -0
  39. data/lib/mruby/concurrently/proc.rb +21 -0
  40. data/lib/mruby/kernel.rb +15 -0
  41. data/mrbgem.rake +42 -0
  42. data/perf/_shared/stage.rb +33 -0
  43. data/perf/concurrent_proc_call.rb +13 -0
  44. data/perf/concurrent_proc_call_and_forget.rb +15 -0
  45. data/perf/concurrent_proc_call_detached.rb +15 -0
  46. data/perf/concurrent_proc_call_nonblock.rb +13 -0
  47. data/perf/concurrent_proc_calls.rb +49 -0
  48. data/perf/concurrent_proc_calls_awaiting.rb +48 -0
  49. metadata +144 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4c58b0ef45ef3aa5d6e404f75b1592cbb415814e
4
+ data.tar.gz: bfb763b405d52aa08b52c0a8d423dbf6af9b2186
5
+ SHA512:
6
+ metadata.gz: 8315e508fca33b19a367f37b38a29e39ace0eab55ad22eb4d0f3ce075b8878ad2066e8487f0cb0f0eec18ab9c93cfaf38dd2e61d9ab812127581535a6ca4ce0d
7
+ data.tar.gz: 1e3812a1f85bfcedae574ca758fe724af1e67a4377edf685066d9a800b53b8b12225244d0abcb34f00c9b8b1adb2036561dca36567eddb94656274d198072c21
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ /.bundle
2
+ /.yardoc
3
+ /doc
4
+ /test/mruby/testenv/mruby
5
+ /Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper.rb
4
+ --default-path test/Ruby
data/.travis.yml ADDED
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+
3
+ script: rake $TEST_RUBY:test
4
+ sudo: false
5
+
6
+ rvm:
7
+ - 2.4.1
8
+ - 2.3.4
9
+ - 2.2.7
10
+
11
+ env:
12
+ - TEST_RUBY=ruby
13
+
14
+ matrix:
15
+ include:
16
+ - env: TEST_RUBY=mruby
data/.yardopts ADDED
@@ -0,0 +1,7 @@
1
+ lib/all/**/*.rb
2
+ --private
3
+ --no-private
4
+ --markup markdown
5
+ -
6
+ RELEASE_NOTES.md
7
+ guides/*
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
8
+ gem "rspec-is_expected_block", "~> 3.0"
9
+ end
10
+
11
+ group :doc do
12
+ gem "yard", "~> 0.9"
13
+ end
14
+
15
+ group :perf do
16
+ gem "ruby-prof", "~> 0.16.2"
17
+ end
data/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
data/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # Concurrently
2
+
3
+ [![Build Status](https://secure.travis-ci.org/christopheraue/m-ruby-concurrently.svg?branch=master)](http://travis-ci.org/christopheraue/m-ruby-concurrently)
4
+
5
+ Concurrently is a concurrency framework for Ruby and mruby. With it, concurrent
6
+ code can be written sequentially similar to async/await.
7
+
8
+ The concurrency primitive of Concurrently is the concurrent proc. It is very
9
+ similar to a regular proc. Calling a concurrent proc creates a concurrent
10
+ evaluation which is kind of a lightweight thread: It can wait for stuff without
11
+ blocking other concurrent evaluations.
12
+
13
+ Under the hood, concurrent procs are evaluated inside fibers. They can wait for
14
+ readiness of I/O or a period of time (or the result of other concurrent
15
+ evaluations). The interface is comparable to plain Ruby:
16
+
17
+ <table>
18
+ <tr>
19
+ <th>Plain Ruby</th>
20
+ <th>Concurrently</th>
21
+ </tr>
22
+ <tr>
23
+ <td><code>Fiber.new(&block).resume</code></td>
24
+ <td><code>concurrent_proc(&block).call</code></td>
25
+ </tr>
26
+ <tr>
27
+ <td><code>IO.select([io])</code></td>
28
+ <td><code>io.await_readable</code></td>
29
+ </tr>
30
+ <tr>
31
+ <td><code>IO.select(nil, [io])</code></td>
32
+ <td><code>io.await_writable</code></td>
33
+ </tr>
34
+ <tr>
35
+ <td><code>IO.select(nil, nil, nil, seconds)</code></td>
36
+ <td><code>wait(seconds)</code></td>
37
+ </tr>
38
+ </table>
39
+
40
+ Beyond the mere beautification of the interface, Concurrently also takes care
41
+ of the management of the event loop and the coordination between all concurrent
42
+ evaluations.
43
+
44
+
45
+ ## A Basic Example
46
+
47
+ This is a little server reading from an IO and printing the received messages:
48
+
49
+ ```ruby
50
+ server = concurrent_proc do |io|
51
+ while true
52
+ begin
53
+ puts io.read_nonblock 32
54
+ rescue IO::WaitReadable
55
+ io.await_readable
56
+ retry
57
+ end
58
+ end
59
+ end
60
+ ```
61
+
62
+ Now, we create a pipe and start the server with the read end of it:
63
+
64
+ ```ruby
65
+ r,w = IO.pipe
66
+ server.call_detached r
67
+ ```
68
+
69
+ Finally, we write messages to the write end of the pipe every 0.5 seconds:
70
+
71
+ ```ruby
72
+ puts "#{Time.now.strftime('%H:%M:%S.%L')} (Start time)"
73
+
74
+ while true
75
+ wait 0.5
76
+ w.write Time.now.strftime('%H:%M:%S.%L')
77
+ end
78
+ ```
79
+
80
+ The evaluation of the root fiber is effectively blocked by waiting or writing
81
+ messages. But since the server runs concurrently it is not affected by this and
82
+ happily prints its received messages.
83
+
84
+ This is the output:
85
+
86
+ ```
87
+ 23:20:42.357 (Start time)
88
+ 23:20:42.858
89
+ 23:20:43.359
90
+ 23:20:43.860
91
+ 23:20:44.360
92
+ ...
93
+ ```
94
+
95
+
96
+ ## Documentation
97
+
98
+ * [Installation][installation]
99
+ * [An Overview of Concurrently][overview]
100
+ * [API documentation][documentation]
101
+ * [Troubleshooting][troubleshooting]
102
+ * [Performance][performance]
103
+
104
+
105
+ ## Supported Ruby Versions
106
+
107
+ * Ruby 2.2.7+
108
+ * mruby 1.3+ (or mruby-head until mruby 1.3 is released)
109
+
110
+
111
+ ## Development
112
+
113
+ [Release Notes][release_notes]
114
+
115
+
116
+ ## License
117
+
118
+ Copyright 2016-present Christopher Aue
119
+
120
+ Concurrently is licensed under the Apache License, Version 2.0. Please see the
121
+ file called LICENSE.
122
+
123
+
124
+ [installation]: http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/file/guides/Installation.md
125
+ [overview]: http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/file/guides/Overview.md
126
+ [documentation]: http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/index
127
+ [troubleshooting]: http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/file/guides/Troubleshooting.md
128
+ [performance]: http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/file/guides/Performance.md
129
+ [release_notes]: http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/file/RELEASE_NOTES.md
data/RELEASE_NOTES.md ADDED
@@ -0,0 +1,49 @@
1
+ # Release Notes
2
+
3
+ ## 1.0.0 (2017-06-26)
4
+
5
+ ### Added Support for
6
+ * Ruby 2.2.7+
7
+ * mruby 1.3
8
+
9
+ ### Extended [IO](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/IO) interface
10
+ * [#await_readable](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/IO#await_readable-instance_method)
11
+ * [#await_writable](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/IO#await_writable-instance_method)
12
+ * [#concurrently_read](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/IO#concurrently_read-instance_method)
13
+ * [#concurrently_write](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/IO#concurrently_write-instance_method)
14
+
15
+ ### Extended [Kernel](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Kernel) interface
16
+ * [#concurrently](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Kernel#concurrently-instance_method)
17
+ * [#concurrent_proc](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Kernel#concurrent_proc-instance_method)
18
+ * [#wait](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Kernel#wait-instance_method)
19
+ * [#await_resume!](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Kernel#await_resume!-instance_method)
20
+
21
+ ### Added (Root) Evaluation ([Concurrently::Evaluation](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Evaluation))
22
+ * [.current](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Evaluation#current-class_method)
23
+ * [#waiting?](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Evaluation#waiting%3F-instance_method)
24
+ * [#resume!](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Evaluation#resume!-instance_method)
25
+
26
+ ### Added Concurrent Proc ([Concurrently::Proc](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Proc))
27
+ * [#call, #[]](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Proc#call-instance_method)
28
+ * [#call_nonblock](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Proc#call_nonblock-instance_method)
29
+ * [#call_detached](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Proc#call_detached-instance_method)
30
+ * [#call_and_forget](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Proc#call_and_forget-instance_method)
31
+
32
+ ### Added Proc Evaluation ([Concurrently::Proc::Evaluation](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Proc/Evaluation))
33
+ * [#await_result](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Proc/Evaluation#await_result-instance_method)
34
+ * [#conclude_to](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Proc/Evaluation#conclude_to-instance_method)
35
+ * [#concluded?](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Proc/Evaluation#concluded%3F-instance_method)
36
+ * [#data](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Proc/Evaluation#data-instance_method)
37
+
38
+ ### Added Event Loop ([Concurrently::EventLoop](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/EventLoop))
39
+ * [.current](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/EventLoop#current-class_method)
40
+ * [#lifetime](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/EventLoop#lifetime-instance_method)
41
+ * [#reinitialize!](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/EventLoop#reinitialize!-instance_method)
42
+
43
+ ### Added Errors
44
+ * [Concurrently::Error](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Error)
45
+ * [Concurrently::Evaluation::Error](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Evaluation/Error)
46
+ * [Concurrently::Evaluation::TimeoutError](http://www.rubydoc.info/github/christopheraue/m-ruby-concurrently/Concurrently/Evaluation/TimeoutError)
47
+
48
+
49
+ ## 0.0.0 (~13.8 billion years ago)
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ Dir.chdir File.dirname __FILE__
2
+
3
+ namespace :ruby do
4
+ task :test do
5
+ sh "rspec"
6
+ end
7
+ end
8
+
9
+ namespace :mruby do
10
+ mruby_env = File.expand_path "test/mruby/testenv"
11
+ mruby_dir = "#{mruby_env}/mruby"
12
+
13
+ file mruby_dir do
14
+ sh "git clone --depth=1 git://github.com/mruby/mruby.git #{mruby_dir}"
15
+ end
16
+
17
+ task test: mruby_dir do
18
+ sh "cd #{mruby_dir} && MRUBY_CONFIG=#{mruby_env}/build_config.rb rake test"
19
+ end
20
+
21
+ task clean: mruby_dir do
22
+ sh "cd #{mruby_dir} && rake deep_clean"
23
+ end
24
+ end
25
+
26
+ task test: %w(ruby:test mruby:test)
27
+
28
+ task default: :test