rsh 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/rsh.rb +34 -30
- data/rsh.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/rsh.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# Creates and operates an 'rsh' command call instance. Parameters to rsh may
|
4
4
|
# be specified through either constructor or attribute accessors. Result of
|
5
|
-
# rsh execution (_String_) is either returned in functional style (<tt
|
5
|
+
# rsh execution (_String_) is either returned in functional style (<tt>execute</tt> method call)
|
6
6
|
# or in special attribute, _result_.
|
7
7
|
#
|
8
8
|
# == Synopsis
|
@@ -16,6 +16,23 @@
|
|
16
16
|
#
|
17
17
|
# 18:30:46.799 MSD Fri Oct 22 2010
|
18
18
|
#
|
19
|
+
# === Example:
|
20
|
+
#
|
21
|
+
# This is an example of rsh in action usin interactive Ruby.
|
22
|
+
#
|
23
|
+
# irb(main):001:0> require 'rsh'
|
24
|
+
# => true
|
25
|
+
#
|
26
|
+
# irb(main):002:0> rsh = Rsh.new(:host => "c7206", :ruser => "bill",
|
27
|
+
# :command => "show clock")
|
28
|
+
# => #<Rsh:0x2853f390 @ruser="bill", @executable="/usr/bin/rsh", @result="", @command="show clock", @nullr=false, @host="c7206", @to=3>
|
29
|
+
#
|
30
|
+
# irb(main):003:0> rsh.execute do |line| puts line end
|
31
|
+
#
|
32
|
+
# 18:30:46.799 MSD Fri Oct 22 2010
|
33
|
+
# => "\r\n18:30:46.799 MSD Fri Oct 22 2010\n"
|
34
|
+
#
|
35
|
+
#
|
19
36
|
# == See also
|
20
37
|
#
|
21
38
|
# % man 1 rsh
|
@@ -44,26 +61,22 @@ class Rsh
|
|
44
61
|
attr_accessor :nullr
|
45
62
|
|
46
63
|
# The Constructor. Checks the presence of rsh in the system (running,
|
47
|
-
# naturally, 'which rsh') and prepares the command to be run with <tt
|
64
|
+
# naturally, 'which rsh') and prepares the command to be run with <tt>execute</tt>.
|
48
65
|
# rsh CLI arguments are either having default values, being collected from constructor
|
49
66
|
# call or specified via accessors.
|
50
67
|
#
|
51
|
-
#
|
52
|
-
# new
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
# Argument defaults are:
|
68
|
+
# Call sequence:
|
69
|
+
# Rsh.new -> Rsh instance
|
70
|
+
# Rsh.new(:host => "hostname", :command => "example.sh", :ruser => "jack", :to => 5, :nullr => true) -> Rsh instance
|
71
|
+
#
|
72
|
+
# If called without arguments, the following default values are being used:
|
73
|
+
#
|
59
74
|
# :host => "localhost"
|
60
75
|
# :command => ""
|
61
76
|
# :ruser => "nobody"
|
62
77
|
# :to => 3
|
63
78
|
# :nullr => false
|
64
79
|
#
|
65
|
-
# Arguments hash is optional.
|
66
|
-
#
|
67
80
|
def initialize(args={})
|
68
81
|
args = {:host => "localhost",
|
69
82
|
:command => "",
|
@@ -92,6 +105,15 @@ class Rsh
|
|
92
105
|
# If given a block, calls it for each line received from rsh output
|
93
106
|
# (parameter _line_).
|
94
107
|
#
|
108
|
+
# Call sequence:
|
109
|
+
#
|
110
|
+
# a)
|
111
|
+
# rsh_inst.execute do |line|
|
112
|
+
# puts line
|
113
|
+
# done -> complete_result_String
|
114
|
+
# b)
|
115
|
+
# rsh_inst.execute -> complete_result_String
|
116
|
+
#
|
95
117
|
# Returns:: the complete rsh output as one _String_. The result is also
|
96
118
|
# stored and available via _result_ attribute.
|
97
119
|
#
|
@@ -106,22 +128,4 @@ class Rsh
|
|
106
128
|
@result
|
107
129
|
end
|
108
130
|
|
109
|
-
#
|
110
|
-
# :section: Example
|
111
|
-
#
|
112
|
-
# This is an example of rsh in action usin interactive Ruby.
|
113
|
-
#
|
114
|
-
# irb(main):001:0> require 'rsh'
|
115
|
-
# => true
|
116
|
-
#
|
117
|
-
# irb(main):002:0> rsh = Rsh.new(:host => "c7206", :ruser => "bill",
|
118
|
-
# :command => "show clock")
|
119
|
-
# => #<Rsh:0x2853f390 @ruser="bill", @executable="/usr/bin/rsh", @result="", @command="show clock", @nullr=false, @host="c7206", @to=3>
|
120
|
-
#
|
121
|
-
# irb(main):003:0> rsh.execute do |line| puts line end
|
122
|
-
#
|
123
|
-
# 18:30:46.799 MSD Fri Oct 22 2010
|
124
|
-
# => "\r\n18:30:46.799 MSD Fri Oct 22 2010\n"
|
125
|
-
#
|
126
|
-
|
127
131
|
end
|
data/rsh.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rsh}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Pavel Argentov"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-25}
|
13
13
|
s.description = %q{All freenixes (e.g. Linux, *BSD, etc.) have 'rsh' command.
|
14
14
|
Here's the gem wrapping call to this command and handling the command's result/output.}
|
15
15
|
s.email = %q{argentoff@gmail.com}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pavel Argentov
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-25 00:00:00 +04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|