multirb 0.0.1 → 0.0.2
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.
- data/README.md +14 -2
- data/bin/multirb +11 -10
- data/lib/multirb.rb +4 -5
- data/lib/multirb/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
#
|
1
|
+
# multirb
|
2
2
|
|
3
3
|
Runs an IRB-esque prompt (but it's NOT really IRB!) over multiple Rubies using RVM.
|
4
4
|
|
5
5
|

|
6
6
|
|
7
|
+
Note: This is NOT the same as [multiruby](http://www.infoq.com/news/2008/02/multiruby-testing) although multiruby has similar uses for fuller scripts and may be worth checking out.
|
8
|
+
|
7
9
|
## Why is this useful?
|
8
10
|
|
9
11
|
If you're a regular developer, it's probably not very useful. But if you're researching or training people in the differences between versions and implementations of Ruby, it could be very helpful indeed.
|
@@ -18,6 +20,8 @@ Install with:
|
|
18
20
|
|
19
21
|
You also need a complete, working [RVM](https://rvm.io/) installation. Feel free to submit pull requests to make this auto detect other Ruby version managers, such as rbenv.
|
20
22
|
|
23
|
+
Note: multirb works fine from MRI Ruby 1.9 and JRuby 1.7.x but has not been tested elsewhere yet.
|
24
|
+
|
21
25
|
## Usage
|
22
26
|
|
23
27
|
Run with:
|
@@ -40,7 +44,15 @@ Currently specifies jruby, 1.8.7, 1.9.2, 1.9.3, and 2.0.0 as 'all versions'; 1.8
|
|
40
44
|
|
41
45
|
## Versions
|
42
46
|
|
43
|
-
0.0.
|
47
|
+
0.0.3 (forthcoming):
|
48
|
+
* rbenv support
|
49
|
+
|
50
|
+
0.0.2 (CURRENT GEM RELEASE):
|
51
|
+
* Uses threads to speed up results (thanks to Ismael Abreu for initial implementation)
|
52
|
+
* Improved 'tempfile' usage to prevent errors on JRuby
|
53
|
+
|
54
|
+
0.0.1
|
55
|
+
* Initial version
|
44
56
|
|
45
57
|
## Contributing
|
46
58
|
|
data/bin/multirb
CHANGED
@@ -3,14 +3,6 @@
|
|
3
3
|
|
4
4
|
# multirb - Runs an IRB-esque prompt (but it's NOT really IRB!) over multiple
|
5
5
|
# versions of Ruby at once (using RVM)
|
6
|
-
#
|
7
|
-
# By Peter Cooper, BSD licensed
|
8
|
-
#
|
9
|
-
# 1. Type in expressions and press enter.
|
10
|
-
# 2. Leave whitespace on the end of lines to enter more lines.
|
11
|
-
# 3. Add # all to run all versions, nothing for default
|
12
|
-
# 4. Add # version,version,version to run specific versions.
|
13
|
-
# 5. exit on its own to exit (or Ctrl+D)
|
14
6
|
|
15
7
|
require_relative '../lib/multirb' # not strictly necessary, but laziness in development ;-)
|
16
8
|
|
@@ -18,13 +10,22 @@ include Multirb
|
|
18
10
|
|
19
11
|
loop do
|
20
12
|
lines = read_lines
|
21
|
-
|
13
|
+
file = create_and_save_code(lines)
|
22
14
|
|
23
15
|
versions = determine_versions(lines, ARGV)
|
24
16
|
|
17
|
+
threads = []
|
25
18
|
versions.each do |version|
|
26
|
-
|
19
|
+
threads << Thread.new do
|
20
|
+
Thread.current[:output] = run_code(file.path, version)
|
21
|
+
end
|
27
22
|
end
|
28
23
|
|
24
|
+
threads.zip(versions).each do |thread, version|
|
25
|
+
puts " #{version} => #{thread.join[:output]}"
|
26
|
+
end
|
27
|
+
|
28
|
+
file.unlink
|
29
|
+
|
29
30
|
puts
|
30
31
|
end
|
data/lib/multirb.rb
CHANGED
@@ -56,11 +56,10 @@ module Multirb
|
|
56
56
|
f = Tempfile.new('multirb')
|
57
57
|
f.puts create_code(lines)
|
58
58
|
f.close
|
59
|
-
f
|
59
|
+
f
|
60
60
|
end
|
61
61
|
|
62
|
-
def run_code(filename, version
|
63
|
-
|
62
|
+
def run_code(filename, version)
|
63
|
+
`rvm #{version} exec ruby #{filename}`
|
64
64
|
end
|
65
|
-
|
66
|
-
end
|
65
|
+
end
|
data/lib/multirb/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multirb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Run Ruby code over multiple implementations/versions using RVM from a
|
15
15
|
IRB-esque prompt
|