sfl 1.0 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +20 -2
  2. data/lib/sfl.rb +22 -0
  3. metadata +2 -2
data/README.md CHANGED
@@ -1,9 +1,12 @@
1
1
  # Spawn for Legacy
2
2
 
3
- Kernel.spawn in ruby 1.9 solves all issues on asynchronous executions.[1](http://ujihisa.blogspot.com/2010/03/how-to-run-external-command.html)[2](http://ujihisa.blogspot.com/2010/03/all-about-spawn.html)
3
+ ![demo](http://gyazo.com/e22144b2aadbbecfc43761f95c27bf3e.png)
4
+
5
+ Kernel.spawn in ruby 1.9 solves all issues on asynchronous executions[[1]](http://ujihisa.blogspot.com/2010/03/how-to-run-external-command.html)[[2]](http://ujihisa.blogspot.com/2010/03/all-about-spawn.html).
4
6
  But ruby 1.8, the legacy version of MRI, is still used on many environments.
5
7
 
6
8
  This library provides `spawn()` which is almost perfectly compatible with ruby 1.9's.
9
+ This library is pure ruby; you don't need to build it.
7
10
 
8
11
  ## Install
9
12
 
@@ -18,7 +21,7 @@ This library provides `spawn()` which is almost perfectly compatible with ruby 1
18
21
 
19
22
  If your ruby is 1.9, `require 'sfl'` doesn't do anything. If your ruby is 1.8, that defines `spawn`.
20
23
 
21
- ## How compatible the spawn is?
24
+ ## How compatible this spawn is?
22
25
 
23
26
  (I'll put the coverage here later)
24
27
 
@@ -26,3 +29,18 @@ If your ruby is 1.9, `require 'sfl'` doesn't do anything. If your ruby is 1.8, t
26
29
 
27
30
  * At first I tried to use the name `spawn` as this gem library name, but the name was already used. The `spawn` gem library does not mean ruby 1.9's `spawn` at all.
28
31
  * Ruby 1.9's `open3` library, based on `spawn`, is very useful. I would like to port `open3` to ruby 1.8 in my future.
32
+
33
+ ## Supports
34
+
35
+ * (On UNIX) MRI 1.8.6, 1.8.7, 1.9.1, 1.9.2pre
36
+ * (On Windows) MRI 1.9.1, 1.9.2pre
37
+
38
+ Currently there are no supports on:
39
+
40
+ * MRI 1.8 on Windows
41
+ * Other Ruby implementations such as JRuby, Rubinius and MacRuby
42
+
43
+ ## Author
44
+
45
+ Tatsuhiro Ujihisa
46
+ <http://ujihisa.blogspot.com/>
data/lib/sfl.rb CHANGED
@@ -105,4 +105,26 @@ if RUBY_VERSION < '1.9'
105
105
  def spawn(*x)
106
106
  SFL.new(*x).run
107
107
  end
108
+
109
+ def Process.spawn(*x)
110
+ SFL.new(*x).run
111
+ end
112
+ end
113
+
114
+ if RUBY_VERSION <= '1.8.6'
115
+ class Array
116
+ alias orig_flatten flatten
117
+
118
+ def flatten(depth = -1)
119
+ if depth < 0
120
+ orig_flatten
121
+ elsif depth == 0
122
+ self
123
+ else
124
+ inject([]) {|m, i|
125
+ Array === i ? m + i : m << i
126
+ }.flatten(depth - 1)
127
+ end
128
+ end
129
+ end
108
130
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfl
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.0"
4
+ version: "1.1"
5
5
  platform: ruby
6
6
  authors:
7
7
  - ujihisa
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-07 00:00:00 -08:00
12
+ date: 2010-03-11 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15