sixarm_ruby_commander 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig ADDED
Binary file
data/.gemtest ADDED
File without changes
data/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # SixArm.com » Ruby » <br> Commander is syntax sugar from Open4::spawn
2
+
3
+ * Docs: <http://sixarm.com/sixarm_ruby_commander/doc>
4
+ * Repo: <http://github.com/sixarm/sixarm_ruby_commander>
5
+ * Email: Joel Parker Henderson, <joel@sixarm.com>
6
+
7
+
8
+ ## Introduction
9
+
10
+ Kernel#commander sugar wrapper for Open4::spawn
11
+
12
+ Syntax:
13
+
14
+ commander(command, option=>value, option=>value, ...)
15
+
16
+ Example:
17
+
18
+ commander('ls')
19
+ #=> Open4::spawn('ls',:stdout=>'',:stderr=>'')
20
+ #=> 'ls', {}, status, stdout, stderr
21
+
22
+ Any options will be sent along to the spawn method.
23
+
24
+ For docs go to <http://sixarm.com/sixarm_ruby_commander/doc>
25
+
26
+ Want to help? We're happy to get pull requests.
27
+
28
+
29
+ ## Install quickstart
30
+
31
+ Install:
32
+
33
+ gem install sixarm_ruby_commander
34
+
35
+ Bundler:
36
+
37
+ gem "sixarm_ruby_commander", "~>1.1.0"
38
+
39
+ Require:
40
+
41
+ require "sixarm_ruby_commander"
42
+
43
+
44
+ ## Install with security (optional)
45
+
46
+ To enable high security for all our gems:
47
+
48
+ wget http://sixarm.com/sixarm.pem
49
+ gem cert --add sixarm.pem
50
+ gem sources --add http://sixarm.com
51
+
52
+ To install with high security:
53
+
54
+ gem install sixarm_ruby_commander --test --trust-policy HighSecurity
55
+
56
+
57
+ ## Changes
58
+
59
+ * 2012-03-23 1.1.0 Upgrade for Ruby 1.9.3, minitest/spec, and improved docs.
60
+ * 2011-10-06 1.0.2 Updates for gem publishing
61
+
62
+
63
+ ## License
64
+
65
+ You may choose any of these open source licenses:
66
+
67
+ * Apache License
68
+ * BSD License
69
+ * CreativeCommons License, Non-commercial Share Alike
70
+ * GNU General Public License Version 2 (GPL 2)
71
+ * GNU Lesser General Public License (LGPL)
72
+ * MIT License
73
+ * Perl Artistic License
74
+ * Ruby License
75
+
76
+ The software is provided "as is", without warranty of any kind,
77
+ express or implied, including but not limited to the warranties of
78
+ merchantability, fitness for a particular purpose and noninfringement.
79
+
80
+ In no event shall the authors or copyright holders be liable for any
81
+ claim, damages or other liability, whether in an action of contract,
82
+ tort or otherwise, arising from, out of or in connection with the
83
+ software or the use or other dealings in the software.
84
+
85
+ This license is for the included software that is created by SixArm;
86
+ some of the included software may have its own licenses, copyrights,
87
+ authors, etc. and these do take precedence over the SixArm license.
88
+
89
+ Copyright (c) 2005-2013 Joel Parker Henderson
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'lib' << 'test'
7
+ t.pattern = 'test/*.rb'
8
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.2
@@ -0,0 +1,33 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README
4
+ =end
5
+
6
+
7
+ require 'open4'
8
+
9
+ module Kernel
10
+
11
+ # Spawn a command with Open4::spawn
12
+ #
13
+ # Optional args are the same as Open4::spawn (stdin, stdout, stderr).
14
+ #
15
+ # @example
16
+ #
17
+ # commander('ls')
18
+ #
19
+ # @example with streams
20
+ #
21
+ # commander('mycommand', :stdin => 'hello', :stdout => '', :stderr => '')
22
+ #
23
+ # @return [status, stdout, stderr]
24
+
25
+ def commander(command,args={}) #=> status exit code, stdout string, stderr string
26
+ stdin=args['stdin']||args[:stdin]||nil
27
+ stdout=args['stdout']||args[:stdout]||''
28
+ stderr=args['stderr']||args[:stderr]||''
29
+ status = Open4::spawn(command,'stdin'=>stdin,'stdout'=>stdout,'stderr'=>stderr)
30
+ return status,stdout,stderr
31
+ end
32
+
33
+ end
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'sixarm_ruby_commander'
6
+
7
+ describe Kernel do
8
+
9
+ describe ".commander" do
10
+
11
+ it "does status" do
12
+ status,stdout,stderr=commander('true')
13
+ status.must_equal 0
14
+ stdout.must_equal ""
15
+ stderr.must_equal ""
16
+ end
17
+
18
+ it "does stdout" do
19
+ status,stdout,stderr=commander('echo "foo"')
20
+ status.must_equal 0
21
+ stdout.must_equal "foo\n"
22
+ stderr.must_equal ""
23
+ end
24
+
25
+ it "does stderr" do
26
+ status,stdout,stderr=commander('echo "foo" >&2')
27
+ status.must_equal 0
28
+ stdout.must_equal ""
29
+ stderr.must_equal "foo\n"
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sixarm_ruby_commander
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - SixArm
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain:
12
+ - !binary |-
13
+ LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCRENDQW0yZ0F3SUJB
14
+ Z0lKQUtQd0VFVFU1YkhvTUEwR0NTcUdTSWIzRFFFQkJRVUFNR0F4Q3pBSkJn
15
+ TlYKQkFZVEFsVlRNUk13RVFZRFZRUUlFd3BEWVd4cFptOXlibWxoTVJZd0ZB
16
+ WURWUVFIRXcxVFlXNGdSbkpoYm1OcApjMk52TVE4d0RRWURWUVFLRXdaVGFY
17
+ aEJjbTB4RXpBUkJnTlZCQU1UQ25OcGVHRnliUzVqYjIwd0hoY05NVEF4Ck1q
18
+ RXpNak15TnpFeldoY05NVE13T1RBNE1qTXlOekV6V2pCZ01Rc3dDUVlEVlFR
19
+ R0V3SlZVekVUTUJFR0ExVUUKQ0JNS1EyRnNhV1p2Y201cFlURVdNQlFHQTFV
20
+ RU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wbFE0bk16aXBYY1o5VEhxczY1UElMMHEKZWFid3BDYkFvcG89
37
+ Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
38
+ date: 2012-03-23 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: open4
42
+ requirement: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 1.3.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: 1.3.0
56
+ description:
57
+ email: sixarm@sixarm.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gemtest
63
+ - Rakefile
64
+ - README.md
65
+ - VERSION
66
+ - lib/sixarm_ruby_commander.rb
67
+ - test/sixarm_ruby_commander_test.rb
68
+ homepage: http://sixarm.com/
69
+ licenses: []
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubyforge_project:
88
+ rubygems_version: 1.8.19
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: SixArm.com » Ruby » Kernel#commander method sugar for Open4::spawn
92
+ test_files:
93
+ - test/sixarm_ruby_commander_test.rb
94
+ has_rdoc: true
metadata.gz.sig ADDED
Binary file