webget_ruby_commander 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/lib/webget_ruby_commander.rb +43 -0
- data/test/unit/webget_ruby_commander_test.rb +14 -0
- metadata +87 -0
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,43 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
|
3
|
+
= WebGet Ruby Gem: Commander is syntax sugar from Open4::spawn
|
4
|
+
|
5
|
+
Author:: Joel Parker Henderson, joelparkerhenderson@gmail.com
|
6
|
+
Copyright:: Copyright (c) 2006-2010 Joel Parker Henderson
|
7
|
+
License:: CreativeCommons License, Non-commercial Share Alike
|
8
|
+
License:: LGPL, GNU Lesser General Public License
|
9
|
+
|
10
|
+
Kernel#commander sugar method wrapper for Open4::spawn
|
11
|
+
|
12
|
+
==Syntax
|
13
|
+
commander(command, option=>value, option=>value, ...)
|
14
|
+
|
15
|
+
==Example
|
16
|
+
commander('ls')
|
17
|
+
=> Open4::spawn('ls',:stdout=>'',:stderr=>'')
|
18
|
+
=> 'ls', {}, status, stdout, stderr
|
19
|
+
|
20
|
+
Any options will be sent along to the spawn method.
|
21
|
+
|
22
|
+
=end
|
23
|
+
|
24
|
+
|
25
|
+
require 'open4'
|
26
|
+
|
27
|
+
module Kernel
|
28
|
+
|
29
|
+
# Spawn a command with Open4::spawn
|
30
|
+
#
|
31
|
+
# Optional args are the same as Open4::spawn (stdin, stdout, stderr).
|
32
|
+
#
|
33
|
+
# Return status, stdout, stderr
|
34
|
+
|
35
|
+
def commander(command,args={}) #=> status exit code, stdout string, stderr string
|
36
|
+
stdin=args['stdin']||nil
|
37
|
+
stdout=args['stdout']||''
|
38
|
+
stderr=args['stderr']||''
|
39
|
+
status = Open4::spawn(command,'stdin'=>stdin,'stdout'=>stdout,'stderr'=>stderr)
|
40
|
+
return status,stdout,stderr
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'webget_ruby_commander'
|
3
|
+
|
4
|
+
class Testing < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_commander
|
7
|
+
status,stdout,stderr=commander('true')
|
8
|
+
assert_equal(0,status)
|
9
|
+
assert_equal('',stdout)
|
10
|
+
assert_equal('',stderr)
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: webget_ruby_commander
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- WebGet
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDvDCCAyWgAwIBAgIJAIlSqEkDQaZIMA0GCSqGSIb3DQEBBQUAMIGbMQswCQYD
|
14
|
+
VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5j
|
15
|
+
aXNjbzETMBEGA1UEChMKV2ViR2V0LmNvbTETMBEGA1UECxMKV2ViR2V0LmNvbTET
|
16
|
+
MBEGA1UEAxMKV2ViR2V0LmNvbTEgMB4GCSqGSIb3DQEJARYRd2ViZ2V0QHdlYmdl
|
17
|
+
dC5jb20wHhcNMDkwMjI2MTk0NDU4WhcNMTExMTIzMTk0NDU4WjCBmzELMAkGA1UE
|
18
|
+
BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz
|
19
|
+
Y28xEzARBgNVBAoTCldlYkdldC5jb20xEzARBgNVBAsTCldlYkdldC5jb20xEzAR
|
20
|
+
BgNVBAMTCldlYkdldC5jb20xIDAeBgkqhkiG9w0BCQEWEXdlYmdldEB3ZWJnZXQu
|
21
|
+
Y29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXCFYfW6hCQl0ToNjaMIXG
|
22
|
+
ZfPF6OoR20BO/Tg6V37qPi7gDSZ6vIC6Mxcs8LtEcju85cD9lnKKl/lo4S5/w9Ha
|
23
|
+
hGD2ZFFfbF8420X5Za5G2KuriS3GzRz7F5dKCTjb1NH9TPlgOc71bcrDmCwwtFJl
|
24
|
+
T+tdfBju0YxLSBiMXf4y5QIDAQABo4IBBDCCAQAwHQYDVR0OBBYEFHB1kXO/Xd4g
|
25
|
+
G+AJ2/wwh6JOWXzNMIHQBgNVHSMEgcgwgcWAFHB1kXO/Xd4gG+AJ2/wwh6JOWXzN
|
26
|
+
oYGhpIGeMIGbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQG
|
27
|
+
A1UEBxMNU2FuIEZyYW5jaXNjbzETMBEGA1UEChMKV2ViR2V0LmNvbTETMBEGA1UE
|
28
|
+
CxMKV2ViR2V0LmNvbTETMBEGA1UEAxMKV2ViR2V0LmNvbTEgMB4GCSqGSIb3DQEJ
|
29
|
+
ARYRd2ViZ2V0QHdlYmdldC5jb22CCQCJUqhJA0GmSDAMBgNVHRMEBTADAQH/MA0G
|
30
|
+
CSqGSIb3DQEBBQUAA4GBADzVXlwuff0/w3yK4LflGKKhtC3oChIrwmSyP6tk628N
|
31
|
+
BHokpc4Kz63xSXqzYTnBS7rFBwlYThtNalQeWmoUjGh3Z0ZR0JlhU0ln8899LuJ3
|
32
|
+
DXnLFY0cVuBnNDMOOFl8vk1qIcZjcTovhzgcixpG6Uk5qmUsKHRLQf4oQJx7TfLK
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
|
35
|
+
date: 2010-02-13 00:00:00 -08:00
|
36
|
+
default_executable:
|
37
|
+
dependencies:
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: open4
|
40
|
+
type: :runtime
|
41
|
+
version_requirement:
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.9.6
|
47
|
+
version:
|
48
|
+
description:
|
49
|
+
email: webget@webget.com
|
50
|
+
executables: []
|
51
|
+
|
52
|
+
extensions: []
|
53
|
+
|
54
|
+
extra_rdoc_files: []
|
55
|
+
|
56
|
+
files:
|
57
|
+
- lib/webget_ruby_commander.rb
|
58
|
+
has_rdoc: true
|
59
|
+
homepage: http://webget.com/
|
60
|
+
licenses: []
|
61
|
+
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
version:
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 1.3.5
|
83
|
+
signing_key:
|
84
|
+
specification_version: 3
|
85
|
+
summary: "WebGet Ruby Gem: Provides Ruby Kernel#commander sugar for Open4::spawn"
|
86
|
+
test_files:
|
87
|
+
- test/unit/webget_ruby_commander_test.rb
|
metadata.gz.sig
ADDED
Binary file
|