Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
1,471 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
=== (unreleased) | ||
|
||
* 1 major enhancement | ||
|
||
* Rewritten! (Never, ever, do this at home.) New and improved API. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
lib/net/sftp/constants.rb | ||
lib/net/sftp/errors.rb | ||
lib/net/sftp/operations/download.rb | ||
lib/net/sftp/operations/file.rb | ||
lib/net/sftp/operations/file_factory.rb | ||
lib/net/sftp/operations/upload.rb | ||
lib/net/sftp/packet.rb | ||
lib/net/sftp/protocol/01/attributes.rb | ||
lib/net/sftp/protocol/01/base.rb | ||
lib/net/sftp/protocol/01/name.rb | ||
lib/net/sftp/protocol/02/base.rb | ||
lib/net/sftp/protocol/03/base.rb | ||
lib/net/sftp/protocol/04/attributes.rb | ||
lib/net/sftp/protocol/04/base.rb | ||
lib/net/sftp/protocol/04/name.rb | ||
lib/net/sftp/protocol/05/base.rb | ||
lib/net/sftp/protocol/06/attributes.rb | ||
lib/net/sftp/protocol/06/base.rb | ||
lib/net/sftp/protocol/base.rb | ||
lib/net/sftp/protocol.rb | ||
lib/net/sftp/request.rb | ||
lib/net/sftp/response.rb | ||
lib/net/sftp/session.rb | ||
lib/net/sftp/version.rb | ||
lib/net/sftp.rb | ||
test/common.rb | ||
test/test_download.rb | ||
test/test_file.rb | ||
test/test_file_factory.rb | ||
test/test_packet.rb | ||
test/test_request.rb | ||
test/test_response.rb | ||
test/test_session.rb | ||
test/test_upload.rb | ||
History.txt | ||
Manifest.txt | ||
README.txt | ||
Rakefile | ||
setup.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
= Net::SFTP | ||
|
||
* http://net-ssh.rubyforge.org/sftp | ||
|
||
== DESCRIPTION: | ||
|
||
Net::SFTP is a pure-Ruby implementation of the SFTP protocol (specifically, versions 1 through 6 of the SFTP protocol). Note that this is the "Secure File Transfer Protocol", typically run over an SSH connection, and has nothing to do with the FTP protocol. | ||
|
||
== FEATURES/PROBLEMS: | ||
|
||
* Transfer files or even entire directory trees to or from a remote host via SFTP | ||
* Completely supports all six protocol versions | ||
* Asynchronous and synchronous operation | ||
* Read and write files using an IO-like interface | ||
|
||
== SYNOPSIS: | ||
|
||
require 'net/sftp' | ||
|
||
Net::SFTP.start('host', 'username', 'password') do |sftp| | ||
sftp.download!("/path/to/remote", "/path/to/local") | ||
end | ||
|
||
== REQUIREMENTS: | ||
|
||
* Net::SSH 2 | ||
|
||
If you wish to run the tests, you'll need: | ||
|
||
* Hoe | ||
* Mocha | ||
|
||
== INSTALL: | ||
|
||
* sudo gem install net-sftp | ||
|
||
Or, if you prefer to do it the hard way (sans Rubygems): | ||
|
||
* tar xzf net-ssh-*.tgz | ||
* cd net-ssh-* | ||
* ruby setup.rb config | ||
* sudo ruby setup.rb install | ||
|
||
== LICENSE: | ||
|
||
(The MIT License) | ||
|
||
Copyright (c) 2008 Jamis Buck <jamis@37signals.com> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
'Software'), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,199 +1,37 @@ | ||
require 'rubygems' | ||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rake/rdoctask' | ||
require 'rake/contrib/sshpublisher' | ||
|
||
$LOAD_PATH.unshift "../net-ssh/lib" | ||
require "./lib/net/sftp/version" | ||
|
||
PACKAGE_NAME = "net-sftp" | ||
PACKAGE_VERSION = Net::SFTP::Version::STRING.dup | ||
|
||
if ENV['SNAPSHOT'].to_i == 1 | ||
PACKAGE_VERSION << "." << Time.now.utc.strftime("%Y%m%d%H%M%S") | ||
end | ||
|
||
SOURCE_FILES = FileList.new do |fl| | ||
[ "lib", "test" ].each do |dir| | ||
fl.include "#{dir}/**/*" | ||
end | ||
fl.include "Rakefile" | ||
end | ||
|
||
PACKAGE_FILES = FileList.new do |fl| | ||
[ "api", "doc" ].each do |dir| | ||
fl.include "#{dir}/**/*" | ||
end | ||
fl.include "NEWS", "LICENSE", "TODO", "#{PACKAGE_NAME}.gemspec" | ||
fl.include "README", "THANKS", "setup.rb" | ||
fl.include SOURCE_FILES | ||
end | ||
|
||
Gem.manage_gems | ||
|
||
def can_require( file ) | ||
begin | ||
require file | ||
return true | ||
rescue LoadError | ||
return false | ||
end | ||
end | ||
|
||
desc "Default task" | ||
task :default => [ :test ] | ||
|
||
desc "Build documentation" | ||
task :doc => [ :rdoc ] | ||
|
||
task :rdoc => SOURCE_FILES | ||
|
||
desc "Clean generated files" | ||
task :clean do | ||
rm_rf "coverage" | ||
rm_rf "pkg" | ||
rm_rf "api" | ||
end | ||
|
||
Rake::TestTask.new do |t| | ||
t.test_files = FileList["test/test_*.rb"] | ||
t.libs << "test" | ||
t.verbose = true | ||
end | ||
|
||
desc "Build a code coverage report" | ||
task :coverage do | ||
files = Dir.glob("test/test_*.rb").join(" ") | ||
sh "rcov -o coverage #{files}" | ||
end | ||
|
||
desc "Prepackage warnings and reminders" | ||
task :prepackage do | ||
unless ENV["OK"] == "yes" | ||
puts "=========================================================" | ||
puts "Please check that the following files have been updated" | ||
puts "in preparation for this release:" | ||
puts | ||
puts " NEWS (with latest release notes)" | ||
puts " lib/net/sftp/version.rb (with current version number)" | ||
puts | ||
puts " git tag v#{Net::SFTP::Version::STRING}" | ||
puts | ||
puts "If you are sure these have all been taken care of, re-run" | ||
puts "rake with 'OK=yes'." | ||
puts "=========================================================" | ||
puts | ||
|
||
abort | ||
end | ||
end | ||
|
||
desc "Tag the current HEAD with the current release version" | ||
task :tag do | ||
warn "WARNING: this will tag HEAD using the tag v#{Net::SSH::Version::STRING}" | ||
warn "If you do not wish to continue, you have 5 seconds to cancel by pressing CTRL-C..." | ||
5.times { |i| print "#{5-i} "; $stdout.flush; sleep 1 } | ||
system "git tag v#{Net::SSH::Version::STRING}" | ||
end | ||
|
||
package_name = "#{PACKAGE_NAME}-#{PACKAGE_VERSION}" | ||
package_dir = "pkg" | ||
package_dir_path = "#{package_dir}/#{package_name}" | ||
|
||
gz_file = "#{package_name}.tar.gz" | ||
bz2_file = "#{package_name}.tar.bz2" | ||
zip_file = "#{package_name}.zip" | ||
gem_file = "#{package_name}.gem" | ||
|
||
task :gzip => SOURCE_FILES + [ :doc, "#{package_dir}/#{gz_file}" ] | ||
task :bzip => SOURCE_FILES + [ :doc, "#{package_dir}/#{bz2_file}" ] | ||
task :zip => SOURCE_FILES + [ :doc, "#{package_dir}/#{zip_file}" ] | ||
task :gem => SOURCE_FILES + [ "#{package_dir}/#{gem_file}" ] | ||
|
||
desc "Build all packages" | ||
task :package => [ :prepackage, :test, :gzip, :bzip, :zip, :gem ] | ||
|
||
directory package_dir | ||
|
||
file package_dir_path do | ||
mkdir_p package_dir_path rescue nil | ||
PACKAGE_FILES.each do |fn| | ||
f = File.join( package_dir_path, fn ) | ||
if File.directory?( fn ) | ||
mkdir_p f unless File.exist?( f ) | ||
else | ||
dir = File.dirname( f ) | ||
mkdir_p dir unless File.exist?( dir ) | ||
rm_f f | ||
safe_ln fn, f | ||
if ENV['REBUILD_MANIFEST'] | ||
source_files = FileList.new do |fl| | ||
[ "lib", "test" ].each do |dir| | ||
fl.include "#{dir}/**/*" | ||
end | ||
end | ||
end | ||
|
||
file "#{package_dir}/#{zip_file}" => package_dir_path do | ||
rm_f "#{package_dir}/#{zip_file}" | ||
FileUtils.chdir package_dir do | ||
sh %{zip -r #{zip_file} #{package_name}} | ||
end | ||
end | ||
|
||
file "#{package_dir}/#{gz_file}" => package_dir_path do | ||
rm_f "#{package_dir}/#{gz_file}" | ||
FileUtils.chdir package_dir do | ||
sh %{tar czvf #{gz_file} #{package_name}} | ||
end | ||
end | ||
|
||
file "#{package_dir}/#{bz2_file}" => package_dir_path do | ||
rm_f "#{package_dir}/#{bz2_file}" | ||
FileUtils.chdir package_dir do | ||
sh %{tar cjvf #{bz2_file} #{package_name}} | ||
fl.include "History.txt", "Manifest.txt", "README.txt" | ||
fl.include "Rakefile", "setup.rb" | ||
end | ||
end | ||
|
||
file "#{package_dir}/#{gem_file}" => package_dir do | ||
spec = eval(File.read(PACKAGE_NAME+".gemspec")) | ||
spec.version = PACKAGE_VERSION | ||
Gem::Builder.new(spec).build | ||
mv gem_file, "#{package_dir}/#{gem_file}" | ||
end | ||
|
||
rdoc_dir = "api" | ||
|
||
desc "Build the RDoc API documentation" | ||
task :rdoc => :rdoc_core do | ||
img_dir = File.join( rdoc_dir, "files", "doc", "images" ) | ||
mkdir_p img_dir | ||
Dir["doc/images/*"].reject { |i| File.directory?(i) }.each { |f| | ||
cp f, img_dir | ||
} | ||
end | ||
|
||
Rake::RDocTask.new( :rdoc_core ) do |rdoc| | ||
rdoc.rdoc_dir = rdoc_dir | ||
rdoc.title = "Net::SFTP -- An SFTP client in, and for, Ruby" | ||
rdoc.options += %w(--line-numbers --inline-source --main README) | ||
#rdoc.rdoc_files.include 'README' | ||
rdoc.rdoc_files.include 'lib/**/*.rb' | ||
|
||
if can_require( "rdoc/generators/template/html/jamis" ) | ||
rdoc.template = "jamis" | ||
File.open("Manifest.txt", "w") do |f| | ||
source_files.each do |file| | ||
next if File.directory?(file) | ||
f.puts(file) | ||
end | ||
end | ||
end | ||
|
||
desc "Publish the API documentation" | ||
task :pubrdoc => [ :rdoc ] do | ||
Rake::SshDirPublisher.new( | ||
"minam@rubyforge.org", | ||
"/var/www/gforge-projects/net-ssh/api", | ||
"api" ).upload | ||
end | ||
$LOAD_PATH.unshift "../net-ssh/lib" | ||
require './lib/net/sftp/version' | ||
|
||
desc "Publish the documentation" | ||
task :pubdoc => [:pubrdoc] | ||
require 'hoe' | ||
|
||
desc "Start an IRB session with the dev load-path preloaded" | ||
task :irb do | ||
system "irb -I../net-ssh/lib -Ilib -rnet/sftp" | ||
end | ||
version = Net::SFTP::Version::STRING.dup | ||
if ENV['SNAPSHOT'].to_i == 1 | ||
version << "." << Time.now.utc.strftime("%Y%m%d%H%M%S") | ||
end | ||
|
||
Hoe.new('net-sftp', version) do |p| | ||
p.author = "Jamis Buck" | ||
p.email = "jamis@jamisbuck.org" | ||
p.summary = "A pure Ruby implementation of the SFTP client protocol" | ||
p.url = "http://net-ssh.rubyforge.org/sftp" | ||
p.extra_deps << [["net-ssh", ">= 1.99.1"]] | ||
p.need_zip = true | ||
p.rubyforge_name = "net-ssh" | ||
end |
Oops, something went wrong.