systemu 2.5.2 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Rakefile +1 -0
- data/lib/systemu.rb +19 -9
- data/systemu.gemspec +2 -1
- data/test/systemu_test.rb +14 -0
- metadata +7 -8
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
M2Y5MTczYmJjMzYzNmQ2NzIxMDQ0NTY0MWU2NWFlMGQzYTI2MmQwNA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZjMyODk2OGRmNWEwMWUyZjE3MmNmNDExM2ZkZjY3OTFjNjllYmNiMw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Mzk4ZjliMjIzNDQ5Y2JmNjE0ZDRkZmE2ZmU3ZDFmNGM1NmJiMGQyZTk1OTMy
|
10
|
+
MTBmOTZjZTM2MjRhMDdlMGQzNjY3Zjc4ZGI5NmUxMjcyODY3MzkxNTRjMmFj
|
11
|
+
OTc0YmU2ZWFiN2NkZWM2MTk5ZDIwNWRiYjAzNmVkOWY4NzE4MGY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTNjMzNjYzUwNTAwOGZkMjdmMzRjYjM3NzIwNTU2ZjMzYmJjYmZkZGMwOWUw
|
14
|
+
ODk5NTdkOTNhN2ZlNTRmNTdlYjgyZmFkYmI3ZmYzZTkyMzE3NDkyMDljNzI3
|
15
|
+
YzFmMDZkODg0ZjA0OTY3ZmFlYWY5NWZmYjc4MWQ2NzI3YjEwNmQ=
|
data/Rakefile
CHANGED
@@ -118,6 +118,7 @@ task :gemspec do
|
|
118
118
|
spec.platform = Gem::Platform::RUBY
|
119
119
|
spec.summary = #{ lib.inspect }
|
120
120
|
spec.description = #{ description.inspect }
|
121
|
+
spec.license = "same as ruby's"
|
121
122
|
|
122
123
|
spec.files =\n#{ files.sort.pretty_inspect }
|
123
124
|
spec.executables = #{ executables.inspect }
|
data/lib/systemu.rb
CHANGED
@@ -14,7 +14,7 @@ class SystemUniversal
|
|
14
14
|
#
|
15
15
|
# constants
|
16
16
|
#
|
17
|
-
SystemUniversal::VERSION = '2.
|
17
|
+
SystemUniversal::VERSION = '2.6.0' unless SystemUniversal.send(:const_defined?, :VERSION)
|
18
18
|
def SystemUniversal.version() SystemUniversal::VERSION end
|
19
19
|
def version() SystemUniversal::VERSION end
|
20
20
|
#
|
@@ -73,7 +73,7 @@ class SystemUniversal
|
|
73
73
|
thread = nil
|
74
74
|
|
75
75
|
quietly{
|
76
|
-
IO.popen "#{ quote(@ruby) } #{ quote(c['program']) }", '
|
76
|
+
IO.popen "#{ quote(@ruby) } #{ quote(c['program']) }", 'rb+' do |pipe|
|
77
77
|
line = pipe.gets
|
78
78
|
case line
|
79
79
|
when %r/^pid: \d+$/
|
@@ -108,11 +108,11 @@ class SystemUniversal
|
|
108
108
|
end
|
109
109
|
|
110
110
|
if @stdout or @stderr
|
111
|
-
open(c['stdout']){|f| relay f => @stdout} if @stdout
|
112
|
-
open(c['stderr']){|f| relay f => @stderr} if @stderr
|
111
|
+
open(c['stdout'], 'rb'){|f| relay f => @stdout} if @stdout
|
112
|
+
open(c['stderr'], 'rb'){|f| relay f => @stderr} if @stderr
|
113
113
|
status
|
114
114
|
else
|
115
|
-
[status,
|
115
|
+
[status, open(c['stdout'], 'rb'){|f| f.read}, open(c['stderr'], 'rb'){|f| f.read}]
|
116
116
|
end
|
117
117
|
end
|
118
118
|
end
|
@@ -140,7 +140,7 @@ class SystemUniversal
|
|
140
140
|
config = File.expand_path(File.join(tmp, 'config'))
|
141
141
|
|
142
142
|
if @stdin
|
143
|
-
open(stdin, '
|
143
|
+
open(stdin, 'wb'){|f| relay @stdin => f}
|
144
144
|
else
|
145
145
|
FileUtils.touch stdin
|
146
146
|
end
|
@@ -155,9 +155,9 @@ class SystemUniversal
|
|
155
155
|
c['stdout'] = stdout
|
156
156
|
c['stderr'] = stderr
|
157
157
|
c['program'] = program
|
158
|
-
open(config, '
|
158
|
+
open(config, 'wb'){|f| Marshal.dump(c, f)}
|
159
159
|
|
160
|
-
open(program, '
|
160
|
+
open(program, 'wb'){|f| f.write child_program(config)}
|
161
161
|
|
162
162
|
c
|
163
163
|
end
|
@@ -217,11 +217,21 @@ class SystemUniversal
|
|
217
217
|
end
|
218
218
|
end
|
219
219
|
|
220
|
+
def slug_for(*args)
|
221
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
222
|
+
join = (options[:join] || options['join'] || '_').to_s
|
223
|
+
string = args.flatten.compact.join(join)
|
224
|
+
words = string.to_s.scan(%r|[/\w]+|)
|
225
|
+
words.map!{|word| word.gsub %r|[^/0-9a-zA-Z_-]|, ''}
|
226
|
+
words.delete_if{|word| word.nil? or word.strip.empty?}
|
227
|
+
words.join(join).downcase.gsub('/', (join * 2))
|
228
|
+
end
|
229
|
+
|
220
230
|
def tmpdir d = Dir.tmpdir, max = 42, &b
|
221
231
|
i = -1 and loop{
|
222
232
|
i += 1
|
223
233
|
|
224
|
-
tmp = File.join
|
234
|
+
tmp = File.join(d, slug_for("systemu_#{ @host }_#{ @ppid }_#{ @pid }_#{ rand }_#{ i += 1 }"))
|
225
235
|
|
226
236
|
begin
|
227
237
|
Dir.mkdir tmp
|
data/systemu.gemspec
CHANGED
@@ -3,10 +3,11 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "systemu"
|
6
|
-
spec.version = "2.
|
6
|
+
spec.version = "2.6.0"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "systemu"
|
9
9
|
spec.description = "description: systemu kicks the ass"
|
10
|
+
spec.license = "same as ruby's"
|
10
11
|
|
11
12
|
spec.files =
|
12
13
|
["LICENSE",
|
data/test/systemu_test.rb
CHANGED
@@ -17,6 +17,20 @@ Testing SystemU do
|
|
17
17
|
assert{ stdout == stdin }
|
18
18
|
end
|
19
19
|
|
20
|
+
testing 'silly hostnames' do
|
21
|
+
host = SystemU.instance_variable_get('@host')
|
22
|
+
silly_hostname = "silly's hostname with spaces"
|
23
|
+
begin
|
24
|
+
SystemU.instance_variable_set('@host', silly_hostname)
|
25
|
+
assert{ SystemU.instance_variable_get('@host') == silly_hostname }
|
26
|
+
stdin = '42'
|
27
|
+
status, stdout, stderr = assert{ systemu :bin/:cat, :stdin => stdin }
|
28
|
+
assert{ status == 0 }
|
29
|
+
ensure
|
30
|
+
assert{ SystemU.instance_variable_set('@host', host) }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
20
34
|
end
|
21
35
|
|
22
36
|
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: systemu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
5
|
-
prerelease:
|
4
|
+
version: 2.6.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ara T. Howard
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-12-07 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: ! 'description: systemu kicks the ass'
|
15
14
|
email: ara.t.howard@gmail.com
|
@@ -32,27 +31,27 @@ files:
|
|
32
31
|
- test/systemu_test.rb
|
33
32
|
- test/testing.rb
|
34
33
|
homepage: https://github.com/ahoward/systemu
|
35
|
-
licenses:
|
34
|
+
licenses:
|
35
|
+
- same as ruby's
|
36
|
+
metadata: {}
|
36
37
|
post_install_message:
|
37
38
|
rdoc_options: []
|
38
39
|
require_paths:
|
39
40
|
- lib
|
40
41
|
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
-
none: false
|
48
47
|
requirements:
|
49
48
|
- - ! '>='
|
50
49
|
- !ruby/object:Gem::Version
|
51
50
|
version: '0'
|
52
51
|
requirements: []
|
53
52
|
rubyforge_project: codeforpeople
|
54
|
-
rubygems_version:
|
53
|
+
rubygems_version: 2.0.3
|
55
54
|
signing_key:
|
56
|
-
specification_version:
|
55
|
+
specification_version: 4
|
57
56
|
summary: systemu
|
58
57
|
test_files: []
|