webget_commander 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ �P��{�elް�.J��"�.tý�r~rUK�<��� zL�-��?����aeM�hks���_�|�h�:�O��ai�0��s�u�~z�ת��JT�$�G&��=[(i�(���<�2�T+��
@@ -0,0 +1,40 @@
1
+ # = WebGet.com Ruby Commander
2
+ #
3
+ # Author:: Joel Parker Henderson, joelparkerhenderson@gmail.com
4
+ # Copyright:: Copyright (c) 2006-2009 Joel Parker Henderson
5
+ # License:: CreativeCommons License, Non-commercial Share Alike
6
+ # License:: LGPL, GNU Lesser General Public License
7
+ #
8
+ # Kernel#commander sugar method wrapper for Open4::spawn
9
+ #
10
+ # ==Syntax
11
+ # commander(command, option=>value, option=>value, ...)
12
+ #
13
+ # ==Example
14
+ # commander('ls')
15
+ # => Open4::spawn('ls',:stdout=>'',:stderr=>'')
16
+ # => 'ls', {}, status, stdout, stderr
17
+ #
18
+ # Any options will be sent along to the spawn method.
19
+ #
20
+ ##
21
+
22
+ require 'open4'
23
+
24
+ module Kernel
25
+
26
+ # Spawn a command with Open4::spawn
27
+ #
28
+ # Optional args are the same as Open4::spawn (stdin, stdout, stderr).
29
+ #
30
+ # Return status, stdout, stderr
31
+
32
+ def commander(command,args={}) #=> status exit code, stdout string, stderr string
33
+ stdin=args['stdin']||nil
34
+ stdout=args['stdout']||''
35
+ stderr=args['stderr']||''
36
+ status = Open4::spawn(command,'stdin'=>stdin,'stdout'=>stdout,'stderr'=>stderr)
37
+ return status,stdout,stderr
38
+ end
39
+
40
+ end
@@ -0,0 +1,14 @@
1
+ require 'test/unit'
2
+ require 'webget_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_commander
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
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: 2009-10-27 00:00:00 -07: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_commander.rb
58
+ has_rdoc: true
59
+ homepage: http://webget.com/gems/ruby_commander
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 commander gemp provides Ruby Kernel#commander sugar for Open4::spawn
86
+ test_files:
87
+ - test/webget_commander/webget_commander_test.rb
Binary file