Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions lib/ftp_sync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ def pull_dir(localpath, remotepath, options = {}, &block)
tocopy = []
recurse = []

# To trigger error if path doesnt exist since list will
# just return and empty array
@connection.chdir(remotepath)

@connection.list(remotepath) do |e|
entry = Net::FTP::List.parse(e)

Expand Down
9 changes: 8 additions & 1 deletion test/ftp_sync_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,15 @@ def test_pull_dir_from_subdir
assert File.exist?(File.join(@local, 'fileAA'))
assert File.exist?(File.join(@local, 'dirAA/fileAAA'))
end


def test_pull_dir_from_relative_dir
@ftp.pull_dir(@local, 'dirA')
assert File.exist?(File.join(@local, 'fileAA'))
assert File.exist?(File.join(@local, 'dirAA/fileAAA'))
end

def test_pull_dir_from_nonexistant_dir
omit "need a fix that doesn't break relative paths"
assert_raise Net::FTPPermError do
@ftp.pull_dir(@local, 'something')
end
Expand Down
3 changes: 2 additions & 1 deletion test/net/ftp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def mkdir(dir)
end

def chdir(dir)
raise Net::FTPPermError unless File.exist?(src_path(dir))
self.ftp_src = src_path(dir)
raise Net::FTPPermError unless File.exist?(ftp_src)
end

def list(dir)
Expand Down