net-sftp 1.1.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. data/CHANGELOG.rdoc +23 -0
  2. data/Manifest +55 -0
  3. data/README.rdoc +96 -0
  4. data/Rakefile +30 -0
  5. data/lib/net/sftp.rb +53 -38
  6. data/lib/net/sftp/constants.rb +187 -0
  7. data/lib/net/sftp/errors.rb +34 -20
  8. data/lib/net/sftp/operations/dir.rb +93 -0
  9. data/lib/net/sftp/operations/download.rb +364 -0
  10. data/lib/net/sftp/operations/file.rb +176 -0
  11. data/lib/net/sftp/operations/file_factory.rb +60 -0
  12. data/lib/net/sftp/operations/upload.rb +387 -0
  13. data/lib/net/sftp/packet.rb +21 -0
  14. data/lib/net/sftp/protocol.rb +32 -0
  15. data/lib/net/sftp/protocol/01/attributes.rb +265 -96
  16. data/lib/net/sftp/protocol/01/base.rb +268 -0
  17. data/lib/net/sftp/protocol/01/name.rb +43 -0
  18. data/lib/net/sftp/protocol/02/base.rb +31 -0
  19. data/lib/net/sftp/protocol/03/base.rb +35 -0
  20. data/lib/net/sftp/protocol/04/attributes.rb +120 -195
  21. data/lib/net/sftp/protocol/04/base.rb +94 -0
  22. data/lib/net/sftp/protocol/04/name.rb +67 -0
  23. data/lib/net/sftp/protocol/05/base.rb +66 -0
  24. data/lib/net/sftp/protocol/06/attributes.rb +107 -0
  25. data/lib/net/sftp/protocol/06/base.rb +63 -0
  26. data/lib/net/sftp/protocol/base.rb +50 -0
  27. data/lib/net/sftp/request.rb +91 -0
  28. data/lib/net/sftp/response.rb +76 -0
  29. data/lib/net/sftp/session.rb +914 -238
  30. data/lib/net/sftp/version.rb +14 -21
  31. data/net-sftp.gemspec +60 -0
  32. data/setup.rb +1331 -0
  33. data/test/common.rb +173 -0
  34. data/test/protocol/01/test_attributes.rb +97 -0
  35. data/test/protocol/01/test_base.rb +210 -0
  36. data/test/protocol/01/test_name.rb +27 -0
  37. data/test/protocol/02/test_base.rb +26 -0
  38. data/test/protocol/03/test_base.rb +27 -0
  39. data/test/protocol/04/test_attributes.rb +148 -0
  40. data/test/protocol/04/test_base.rb +74 -0
  41. data/test/protocol/04/test_name.rb +49 -0
  42. data/test/protocol/05/test_base.rb +62 -0
  43. data/test/protocol/06/test_attributes.rb +124 -0
  44. data/test/protocol/06/test_base.rb +51 -0
  45. data/test/protocol/test_base.rb +42 -0
  46. data/test/test_all.rb +3 -0
  47. data/test/test_dir.rb +47 -0
  48. data/test/test_download.rb +252 -0
  49. data/test/test_file.rb +159 -0
  50. data/test/test_file_factory.rb +48 -0
  51. data/test/test_packet.rb +9 -0
  52. data/test/test_protocol.rb +17 -0
  53. data/test/test_request.rb +71 -0
  54. data/test/test_response.rb +53 -0
  55. data/test/test_session.rb +741 -0
  56. data/test/test_upload.rb +219 -0
  57. metadata +59 -111
  58. data/doc/LICENSE-BSD +0 -27
  59. data/doc/LICENSE-GPL +0 -280
  60. data/doc/LICENSE-RUBY +0 -56
  61. data/doc/faq/faq.html +0 -298
  62. data/doc/faq/faq.rb +0 -154
  63. data/doc/faq/faq.yml +0 -183
  64. data/examples/asynchronous.rb +0 -57
  65. data/examples/get-put.rb +0 -45
  66. data/examples/sftp-open-uri.rb +0 -30
  67. data/examples/ssh-service.rb +0 -30
  68. data/examples/synchronous.rb +0 -131
  69. data/lib/net/sftp/operations/abstract.rb +0 -108
  70. data/lib/net/sftp/operations/close.rb +0 -31
  71. data/lib/net/sftp/operations/errors.rb +0 -76
  72. data/lib/net/sftp/operations/fsetstat.rb +0 -36
  73. data/lib/net/sftp/operations/fstat.rb +0 -32
  74. data/lib/net/sftp/operations/lstat.rb +0 -31
  75. data/lib/net/sftp/operations/mkdir.rb +0 -33
  76. data/lib/net/sftp/operations/open.rb +0 -32
  77. data/lib/net/sftp/operations/opendir.rb +0 -32
  78. data/lib/net/sftp/operations/read.rb +0 -88
  79. data/lib/net/sftp/operations/readdir.rb +0 -55
  80. data/lib/net/sftp/operations/realpath.rb +0 -37
  81. data/lib/net/sftp/operations/remove.rb +0 -31
  82. data/lib/net/sftp/operations/rename.rb +0 -32
  83. data/lib/net/sftp/operations/rmdir.rb +0 -31
  84. data/lib/net/sftp/operations/services.rb +0 -42
  85. data/lib/net/sftp/operations/setstat.rb +0 -33
  86. data/lib/net/sftp/operations/stat.rb +0 -31
  87. data/lib/net/sftp/operations/write.rb +0 -63
  88. data/lib/net/sftp/protocol/01/impl.rb +0 -251
  89. data/lib/net/sftp/protocol/01/packet-assistant.rb +0 -82
  90. data/lib/net/sftp/protocol/01/services.rb +0 -47
  91. data/lib/net/sftp/protocol/02/impl.rb +0 -39
  92. data/lib/net/sftp/protocol/02/packet-assistant.rb +0 -32
  93. data/lib/net/sftp/protocol/02/services.rb +0 -44
  94. data/lib/net/sftp/protocol/03/impl.rb +0 -42
  95. data/lib/net/sftp/protocol/03/packet-assistant.rb +0 -35
  96. data/lib/net/sftp/protocol/03/services.rb +0 -44
  97. data/lib/net/sftp/protocol/04/impl.rb +0 -86
  98. data/lib/net/sftp/protocol/04/packet-assistant.rb +0 -45
  99. data/lib/net/sftp/protocol/04/services.rb +0 -44
  100. data/lib/net/sftp/protocol/05/impl.rb +0 -90
  101. data/lib/net/sftp/protocol/05/packet-assistant.rb +0 -34
  102. data/lib/net/sftp/protocol/05/services.rb +0 -44
  103. data/lib/net/sftp/protocol/constants.rb +0 -60
  104. data/lib/net/sftp/protocol/driver.rb +0 -235
  105. data/lib/net/sftp/protocol/packet-assistant.rb +0 -84
  106. data/lib/net/sftp/protocol/services.rb +0 -55
  107. data/lib/uri/open-sftp.rb +0 -54
  108. data/lib/uri/sftp.rb +0 -42
  109. data/test/ALL-TESTS.rb +0 -23
  110. data/test/operations/tc_abstract.rb +0 -124
  111. data/test/operations/tc_close.rb +0 -40
  112. data/test/operations/tc_fsetstat.rb +0 -48
  113. data/test/operations/tc_fstat.rb +0 -40
  114. data/test/operations/tc_lstat.rb +0 -40
  115. data/test/operations/tc_mkdir.rb +0 -48
  116. data/test/operations/tc_open.rb +0 -42
  117. data/test/operations/tc_opendir.rb +0 -40
  118. data/test/operations/tc_read.rb +0 -103
  119. data/test/operations/tc_readdir.rb +0 -88
  120. data/test/operations/tc_realpath.rb +0 -54
  121. data/test/operations/tc_remove.rb +0 -40
  122. data/test/operations/tc_rmdir.rb +0 -40
  123. data/test/operations/tc_setstat.rb +0 -48
  124. data/test/operations/tc_stat.rb +0 -40
  125. data/test/operations/tc_write.rb +0 -91
  126. data/test/protocol/01/tc_attributes.rb +0 -138
  127. data/test/protocol/01/tc_impl.rb +0 -294
  128. data/test/protocol/01/tc_packet_assistant.rb +0 -81
  129. data/test/protocol/02/tc_impl.rb +0 -41
  130. data/test/protocol/02/tc_packet_assistant.rb +0 -31
  131. data/test/protocol/03/tc_impl.rb +0 -48
  132. data/test/protocol/03/tc_packet_assistant.rb +0 -34
  133. data/test/protocol/04/tc_attributes.rb +0 -174
  134. data/test/protocol/04/tc_impl.rb +0 -91
  135. data/test/protocol/04/tc_packet_assistant.rb +0 -38
  136. data/test/protocol/05/tc_impl.rb +0 -61
  137. data/test/protocol/05/tc_packet_assistant.rb +0 -32
  138. data/test/protocol/tc_driver.rb +0 -219
@@ -1,30 +0,0 @@
1
- #--
2
- # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jamis@37signals.com)
4
- # All rights reserved.
5
- #
6
- # This source file is distributed as part of the Net::SFTP Secure FTP Client
7
- # library for Ruby. This file (and the library as a whole) may be used only as
8
- # allowed by either the BSD license, or the Ruby license (or, by association
9
- # with the Ruby license, the GPL). See the "doc" subdirectory of the Net::SFTP
10
- # distribution for the texts of these licenses.
11
- # -----------------------------------------------------------------------------
12
- # net-sftp website: http://net-ssh.rubyforge.org/sftp
13
- # project website : http://rubyforge.org/projects/net-ssh
14
- # =============================================================================
15
- #++
16
-
17
- $:.unshift "../lib"
18
- require 'net/ssh'
19
- require 'net/sftp'
20
-
21
- Net::SSH.start( 'localhost' ) do |session|
22
- session.sftp.connect do |sftp|
23
- h = sftp.opendir( "." )
24
- sftp.readdir( h ).sort { |a,b| a.filename <=> b.filename }.each do |item|
25
- puts "%06o %6d %-20s" %
26
- [ item.attributes.permissions, item.attributes.size, item.filename ]
27
- end
28
- sftp.close_handle( h )
29
- end
30
- end
@@ -1,131 +0,0 @@
1
- #--
2
- # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jamis@37signals.com)
4
- # All rights reserved.
5
- #
6
- # This source file is distributed as part of the Net::SFTP Secure FTP Client
7
- # library for Ruby. This file (and the library as a whole) may be used only as
8
- # allowed by either the BSD license, or the Ruby license (or, by association
9
- # with the Ruby license, the GPL). See the "doc" subdirectory of the Net::SFTP
10
- # distribution for the texts of these licenses.
11
- # -----------------------------------------------------------------------------
12
- # net-sftp website: http://net-ssh.rubyforge.org/sftp
13
- # project website : http://rubyforge.org/projects/net-ssh
14
- # =============================================================================
15
- #++
16
-
17
- $:.unshift "../lib"
18
- require 'net/sftp'
19
-
20
- Net::SFTP.start( 'localhost',
21
- :registry_options => { :logs => { :levels => { "sftp.*" => :debug } } }
22
- ) do |sftp|
23
- puts "----------------------------------------------"
24
- puts "getting handle..."
25
- handle = sftp.open_handle( "temp/out" )
26
- puts "got handle: #{handle.inspect}"
27
- puts "reading..."
28
- data = sftp.read( handle,
29
- :chunk_size => 4*1024,
30
- :progress_callback => proc { |data| puts " [#{data.length}]" } )
31
- puts "got data: #{data.length} bytes"
32
- sftp.close_handle( handle )
33
-
34
- puts "----------------------------------------------"
35
- puts "getting handle..."
36
- sftp.open_handle( "temp/out" ) do |handle|
37
- puts "got handle: #{handle.inspect}"
38
- puts "reading..."
39
- data = sftp.read( handle )
40
- puts "got data: #{data.length} bytes"
41
- end
42
-
43
- puts "----------------------------------------------"
44
- puts "opening handle for writing..."
45
- sftp.open_handle( "temp/blah", "w" ) do |handle|
46
- puts "got handle: #{handle.inspect}"
47
- data = "1234567890" * 100
48
- puts "writing #{data.length} bytes..."
49
- p sftp.write( handle, data ).code
50
- end
51
-
52
- puts "----------------------------------------------"
53
- puts "opening handle for writing..."
54
- handle = sftp.open( "temp/blah", IO::WRONLY | IO::CREAT )
55
- puts "got handle: #{handle.inspect}"
56
- data = "1234567890" * 100000
57
- puts "writing #{data.length} bytes..."
58
- p sftp.write( handle, data ).code
59
- sftp.close_handle( handle )
60
-
61
- puts "----------------------------------------------"
62
- puts "opening directory handle..."
63
- handle = sftp.opendir( "/usr/lib" )
64
- puts "got handle: #{handle.inspect}"
65
- puts "reading directory..."
66
- items = sftp.readdir( handle )
67
- puts "got #{items.length} entries"
68
- sftp.close_handle( handle )
69
-
70
- puts "----------------------------------------------"
71
- puts "removing file..."
72
- p sftp.remove( "temp/blah" ).code
73
-
74
- puts "----------------------------------------------"
75
- puts "getting attributes (stat)..."
76
- p sftp.stat( "temp/out" )
77
-
78
- puts "----------------------------------------------"
79
- puts "getting attributes (lstat)..."
80
- p sftp.lstat( "temp/out" )
81
-
82
- puts "----------------------------------------------"
83
- puts "getting handle..."
84
- handle = sftp.open( "temp/out" )
85
- puts "getting attributes (fstat)..."
86
- p sftp.fstat( handle )
87
- sftp.close_handle( handle )
88
-
89
- puts "----------------------------------------------"
90
- puts "setting attributes (setstat)..."
91
- p sftp.setstat( "temp/out", :permissions => 0777 )
92
- puts "getting attributes (stat)..."
93
- p sftp.stat( "temp/out" )
94
-
95
- puts "----------------------------------------------"
96
- puts "getting handle..."
97
- handle = sftp.open( "temp/out" )
98
- puts "setting attributes (fsetstat)..."
99
- p sftp.fsetstat( handle, :permissions => 0660 )
100
- sftp.close_handle( handle )
101
- puts "getting attributes (stat)..."
102
- p sftp.stat( "temp/out" )
103
-
104
- puts "----------------------------------------------"
105
- puts "mkdir..."
106
- p sftp.mkdir( "temp/test_dir", :permissions => 0500 )
107
- puts "getting attributes (stat)..."
108
- p sftp.stat( "temp/test_dir" )
109
-
110
- puts "----------------------------------------------"
111
- puts "rmdir..."
112
- p sftp.rmdir( "temp/test_dir" )
113
-
114
- puts "----------------------------------------------"
115
- puts "realpath..."
116
- p sftp.realpath( "." )
117
-
118
- # 'rename' is only available from protocol version 2+.
119
- if sftp.support?( :rename )
120
- puts "----------------------------------------------"
121
- puts "rename..."
122
- p sftp.rename( "temp/out", "temp/out2" )
123
- puts "getting realpath..."
124
- p sftp.realpath( "temp/out2" )
125
- puts "restoring name..."
126
- p sftp.rename( "temp/out2", "temp/out" )
127
- end
128
-
129
- puts "----------------------------------------------"
130
- puts "done!"
131
- end
@@ -1,108 +0,0 @@
1
- #--
2
- # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jamis@37signals.com)
4
- # All rights reserved.
5
- #
6
- # This source file is distributed as part of the Net::SFTP Secure FTP Client
7
- # library for Ruby. This file (and the library as a whole) may be used only as
8
- # allowed by either the BSD license, or the Ruby license (or, by association
9
- # with the Ruby license, the GPL). See the "doc" subdirectory of the Net::SFTP
10
- # distribution for the texts of these licenses.
11
- # -----------------------------------------------------------------------------
12
- # net-sftp website: http://net-ssh.rubyforge.org/sftp
13
- # project website : http://rubyforge.org/projects/net-ssh
14
- # =============================================================================
15
- #++
16
-
17
- require 'net/sftp/operations/errors'
18
-
19
- module Net ; module SFTP ; module Operations
20
-
21
- # The base class for all SFTP operations. Subclasses must implement a
22
- # +perform+ method, which accepts the arguments expected by the corresponding
23
- # method of the driver. Subclasses _may_ also override the default
24
- # implementations of +do_status+, +do_data+, +do_name+, +do_handle+, and
25
- # +do_attrs+, as necessary.
26
- class Abstract
27
- include Constants
28
-
29
- # A structure for reporting status information.
30
- Status = Struct.new( :code, :message, :language )
31
-
32
- # A constant for representing the commonly-used FX_OK status.
33
- OK = Status.new( FX_OK, "Success", "" )
34
-
35
- # Create a new operation with the given logger instance, which will
36
- # operate atop the given session, using the given driver to format and
37
- # send the requests to the server.
38
- def initialize( log, session, driver )
39
- @log = log
40
- @session = session
41
- @driver = driver
42
- end
43
-
44
- # Execute the operation. If a callback is given, the operation will be
45
- # performed asynchronously with the callback being invoked when the
46
- # operation completes. If a callback is not given, the operation will
47
- # be performed synchronously, with the expected value being returned.
48
- def execute( *args, &callback )
49
- @log.debug "executing" if @log.debug?
50
-
51
- unless block_given?
52
- status = result = nil
53
- callback = Proc.new do |status, *pargs|
54
- status = status
55
- result = case
56
- when pargs.empty? then @session.status
57
- when pargs.length == 1 then pargs.first
58
- else pargs
59
- end
60
- end
61
- end
62
-
63
- @callback = callback
64
- @id = perform *args
65
- @log.debug "received request id #{@id}"
66
- @session.register( @id, self )
67
-
68
- unless block_given?
69
- @session.loop { status.nil? }
70
- @session.status = status
71
- return result
72
- end
73
- end
74
-
75
- # A callback for SFTP status packets. By default, raises an exception unless
76
- # the status is FX_OK, in which case the registered callback is invoked.
77
- def do_status( code, message, language )
78
- raise StatusException.new( code, message, language ) unless code == FX_OK
79
- @callback[ Status.new( code, message, language ) ]
80
- end
81
-
82
- # A callback for SFTP handle packets. By default, invokes the registered
83
- # callback, passing an OK status and the handle.
84
- def do_handle( handle )
85
- @callback[ OK, handle ]
86
- end
87
-
88
- # A callback for SFTP data packets. By default, invokes the registered
89
- # callback, passing an OK status and the data.
90
- def do_data( data )
91
- @callback[ OK, data ]
92
- end
93
-
94
- # A callback for SFTP name packets. By default, invokes the registered
95
- # callback, passing an OK status and the list of items.
96
- def do_name( items )
97
- @callback[ OK, items ]
98
- end
99
-
100
- # A callback for SFTP attrs packets. By default, invokes the registered
101
- # callback, passing an OK status and the attributes object.
102
- def do_attrs( attributes )
103
- @callback[ OK, attributes ]
104
- end
105
-
106
- end
107
-
108
- end ; end ; end
@@ -1,31 +0,0 @@
1
- #--
2
- # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jamis@37signals.com)
4
- # All rights reserved.
5
- #
6
- # This source file is distributed as part of the Net::SFTP Secure FTP Client
7
- # library for Ruby. This file (and the library as a whole) may be used only as
8
- # allowed by either the BSD license, or the Ruby license (or, by association
9
- # with the Ruby license, the GPL). See the "doc" subdirectory of the Net::SFTP
10
- # distribution for the texts of these licenses.
11
- # -----------------------------------------------------------------------------
12
- # net-sftp website: http://net-ssh.rubyforge.org/sftp
13
- # project website : http://rubyforge.org/projects/net-ssh
14
- # =============================================================================
15
- #++
16
-
17
- require 'net/sftp/operations/abstract'
18
-
19
- module Net ; module SFTP ; module Operations
20
-
21
- # The implementation of the close operation, for closing an open handle.
22
- class Close < Abstract
23
-
24
- # Closes the given handle.
25
- def perform( handle )
26
- @driver.close_handle( nil, handle )
27
- end
28
-
29
- end
30
-
31
- end ; end ; end
@@ -1,76 +0,0 @@
1
- #--
2
- # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jamis@37signals.com)
4
- # All rights reserved.
5
- #
6
- # This source file is distributed as part of the Net::SFTP Secure FTP Client
7
- # library for Ruby. This file (and the library as a whole) may be used only as
8
- # allowed by either the BSD license, or the Ruby license (or, by association
9
- # with the Ruby license, the GPL). See the "doc" subdirectory of the Net::SFTP
10
- # distribution for the texts of these licenses.
11
- # -----------------------------------------------------------------------------
12
- # net-sftp website: http://net-ssh.rubyforge.org/sftp
13
- # project website : http://rubyforge.org/projects/net-ssh
14
- # =============================================================================
15
- #++
16
-
17
- require 'net/sftp/errors'
18
-
19
- module Net ; module SFTP ; module Operations
20
-
21
- module Constants
22
- FX_OK = 0
23
- FX_EOF = 1
24
- FX_NO_SUCH_FILE = 2
25
- FX_PERMISSION_DENIED = 3
26
- FX_FAILURE = 4
27
- FX_BAD_MESSAGE = 5
28
- FX_NO_CONNECTION = 6
29
- FX_CONNECTION_LOST = 7
30
- FX_OP_UNSUPPORTED = 8
31
- FX_INVALID_HANDLE = 9
32
- FX_NO_SUCH_PATH = 10
33
- FX_FILE_ALREADY_EXISTS = 11
34
- FX_WRITE_PROTECT = 12
35
- FX_NO_MEDIA = 13
36
- FX_NO_SPACE_ON_FILESYSTEM = 14
37
- FX_QUOTA_EXCEEDED = 15
38
- FX_UNKNOWN_PRINCIPLE = 16
39
- FX_LOCK_CONFlICT = 17
40
- FX_DIR_NOT_EMPTY = 18
41
- FX_NOT_A_DIRECTORY = 19
42
- FX_INVALID_FILENAME = 20
43
- FX_LINK_LOOP = 21
44
- end
45
-
46
- # A exception class for reporting a non-success result of an operation.
47
- class StatusException < Net::SFTP::Exception
48
-
49
- # The error code (numeric)
50
- attr_reader :code
51
-
52
- # The description of the error
53
- attr_reader :description
54
-
55
- # The language in which the description is being reported (usually the
56
- # empty string)
57
- attr_reader :language
58
-
59
- # Create a new status exception that reports the given code and
60
- # description.
61
- def initialize( code, description, language )
62
- @code = code
63
- @description = description
64
- @language = language
65
- end
66
-
67
- # Override the default message format, to include the code and
68
- # description.
69
- def message
70
- m = super
71
- m << " (#{code}, #{description.inspect})"
72
- end
73
-
74
- end
75
-
76
- end ; end ; end
@@ -1,36 +0,0 @@
1
- #--
2
- # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jamis@37signals.com)
4
- # All rights reserved.
5
- #
6
- # This source file is distributed as part of the Net::SFTP Secure FTP Client
7
- # library for Ruby. This file (and the library as a whole) may be used only as
8
- # allowed by either the BSD license, or the Ruby license (or, by association
9
- # with the Ruby license, the GPL). See the "doc" subdirectory of the Net::SFTP
10
- # distribution for the texts of these licenses.
11
- # -----------------------------------------------------------------------------
12
- # net-sftp website: http://net-ssh.rubyforge.org/sftp
13
- # project website : http://rubyforge.org/projects/net-ssh
14
- # =============================================================================
15
- #++
16
-
17
- require 'net/sftp/operations/abstract'
18
-
19
- module Net ; module SFTP ; module Operations
20
-
21
- # The implementation of the +fsetstat+ operation.
22
- class Fsetstat < Abstract
23
-
24
- # Performs the fsetstat operation on the given handle. The +hash+
25
- # parameter is a Hash of attribute name/value pairs, from which an
26
- # attributes object will be created and sent to the server. It
27
- # represents the attributes to set on the file/directory represented
28
- # by the handle.
29
- def perform( handle, hash )
30
- attrs = @driver.attr_factory.from_hash( hash )
31
- @driver.fsetstat( nil, handle, attrs )
32
- end
33
-
34
- end
35
-
36
- end ; end ; end
@@ -1,32 +0,0 @@
1
- #--
2
- # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jamis@37signals.com)
4
- # All rights reserved.
5
- #
6
- # This source file is distributed as part of the Net::SFTP Secure FTP Client
7
- # library for Ruby. This file (and the library as a whole) may be used only as
8
- # allowed by either the BSD license, or the Ruby license (or, by association
9
- # with the Ruby license, the GPL). See the "doc" subdirectory of the Net::SFTP
10
- # distribution for the texts of these licenses.
11
- # -----------------------------------------------------------------------------
12
- # net-sftp website: http://net-ssh.rubyforge.org/sftp
13
- # project website : http://rubyforge.org/projects/net-ssh
14
- # =============================================================================
15
- #++
16
-
17
- require 'net/sftp/operations/abstract'
18
-
19
- module Net ; module SFTP ; module Operations
20
-
21
- # The implementation of the +fstat+ operation.
22
- class Fstat < Abstract
23
-
24
- # Ask the server for the attributes of the file/directory represented by
25
- # the given handle.
26
- def perform( handle )
27
- @driver.fstat( nil, handle )
28
- end
29
-
30
- end
31
-
32
- end ; end ; end