scutil 0.3.1 → 0.3.2

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/CHANGELOG.rdoc CHANGED
@@ -1,9 +1,16 @@
1
1
 
2
2
  ==Changelog
3
3
 
4
+ ===0.3.2 | 2011-11-03
5
+
6
+ * Instance initialization will default to current user if username is
7
+ not specified.
8
+ * More documentation corrections.
9
+
4
10
  ===0.3.1 | 2011-10-26
5
11
 
6
- * Added conn method to instance to expose Net::SSH::Session object.
12
+ * Added conn method to instance to expose
13
+ Net::SSH::Connection::Session object.
7
14
  * Documentation corrections.
8
15
 
9
16
  ===0.3.0 | 2011-10-11
data/README.rdoc CHANGED
@@ -43,7 +43,7 @@ see Scutil.
43
43
  require 'scutil'
44
44
 
45
45
  # Class method executed immediately:
46
- Scutil.exec_command('servername1', 'username', 'pwd', nil,
46
+ Scutil.exec_command('servername1', 'username', nil,
47
47
  {
48
48
  :keys => '~mas/.ssh/id_rsa',
49
49
  :scutil_verbose => true
data/lib/scutil.rb CHANGED
@@ -30,7 +30,7 @@ require 'scutil/connection_cache'
30
30
  require 'scutil/system_connection'
31
31
 
32
32
  module Scutil
33
- SCUTIL_VERSION = '0.3.1'
33
+ SCUTIL_VERSION = '0.3.2'
34
34
  # By default, buffer 10M of data before writing.
35
35
  DEFAULT_OUTPUT_BUFFER_SIZE = 0xA00000
36
36
  # Checks for a command starting with _sudo_ by default.
@@ -67,7 +67,7 @@ module Scutil
67
67
  end
68
68
  end
69
69
 
70
- # Drops all instances of +hostname+ from connection_cache.
70
+ # Drops all instances of +hostname+ from @connection_cache.
71
71
  def clear!(hostname)
72
72
  if (Scutil.connection_cache.exists?(hostname))
73
73
  Scutil.connection_cache.remove(hostname)
data/lib/scutil/exec.rb CHANGED
@@ -7,7 +7,7 @@ module Scutil
7
7
  #
8
8
  # exec.exec_command('echo "foo"')
9
9
  #
10
- # exec.exec_command('echo "bar"; sudo whoami', "",
10
+ # exec.exec_command('echo "bar"; sudo whoami', nil,
11
11
  # { :scutil_force_pty => true,
12
12
  # :scutil_verbose => true
13
13
  # })
@@ -16,9 +16,11 @@ module Scutil
16
16
  include Scutil
17
17
  attr_reader :hostname,:username
18
18
 
19
- def initialize(hostname, username, options={})
19
+ # Defaults to current user (ENV['USER'] if _username_ is not
20
+ # specified.
21
+ def initialize(hostname, username=nil, options={})
20
22
  @hostname = hostname
21
- @username = username
23
+ @username = username.nil? ? ENV['USER'] : username
22
24
  @options = options
23
25
  end
24
26
 
@@ -39,14 +41,16 @@ module Scutil
39
41
  @options.merge!(options)
40
42
  end
41
43
 
44
+ # Exposes the raw Net:SSH::Connection::Session object associated
45
+ # with @hostname.
42
46
  def conn(pty_needed=false)
43
47
  conn = nil
44
- if Scutil.connection_cache.exists? @hostname
45
- sys_conn = Scutil.connection_cache.fetch @hostname
46
- conn = sys_conn.get_connection @hostname, @username, pty_needed, @options
48
+ if Scutil.connection_cache.exists?(@hostname)
49
+ sys_conn = Scutil.connection_cache.fetch(@hostname)
50
+ conn = sys_conn.get_connection(@hostname, @username, pty_needed, @options)
47
51
  else
48
- sys_conn = SystemConnection.new @hostname
49
- conn = sys_conn.get_connection @hostname, @username, pty_needed, @options
52
+ sys_conn = SystemConnection.new(@hostname)
53
+ conn = sys_conn.get_connection(@hostname, @username, pty_needed, @options)
50
54
  end
51
55
  conn
52
56
  end
data/scutil.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'scutil'
4
- s.version = '0.3.1'
5
- s.date = '2011-10-26'
4
+ s.version = '0.3.2'
5
+ s.date = '2011-11-03'
6
6
  s.summary = 'SSH Command UTILity'
7
7
  s.description = <<-EOF
8
8
  Scutil is a library for conveniently executing commands
@@ -25,6 +25,6 @@ scutil.gemspec
25
25
  README.rdoc
26
26
  CHANGELOG.rdoc
27
27
  THANKS.rdoc
28
- test/test_scutil.rb
29
28
  )
29
+ s.test_files = ['test/test_scutil.rb']
30
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scutil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-26 00:00:00.000000000Z
12
+ date: 2011-11-03 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh
16
- requirement: &19449700 !ruby/object:Gem::Requirement
16
+ requirement: &25161580 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 2.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *19449700
24
+ version_requirements: *25161580
25
25
  description: ! " Scutil is a library for conveniently executing commands \n remotely
26
26
  via SSH.\n"
27
27
  email: marcantoniosr@gmail.com
@@ -71,4 +71,5 @@ rubygems_version: 1.8.11
71
71
  signing_key:
72
72
  specification_version: 3
73
73
  summary: SSH Command UTILity
74
- test_files: []
74
+ test_files:
75
+ - test/test_scutil.rb