lib/middleman-deploy/methods/ftp.rb in middleman-deploy-1.0.0 vs lib/middleman-deploy/methods/ftp.rb in middleman-deploy-2.0.0.pre.alpha
- old
+ new
@@ -16,15 +16,15 @@
@path = self.options.path
@port = self.options.port
end
def process
- puts "## Deploying via ftp to #{self.user}@#{self.host}:#{self.path}"
+ puts "## Deploying via ftp to #{user}@#{host}:#{path}"
ftp = open_connection
- Dir.chdir(self.server_instance.build_dir) do
+ Dir.chdir(build_dir) do
filtered_files.each do |filename|
if File.directory?(filename)
upload_directory(ftp, filename)
else
upload_binary(ftp, filename)
@@ -55,13 +55,13 @@
end
end
end
def open_connection
- ftp = Net::FTP.new(self.host)
- ftp.login(self.user, self.pass)
- ftp.chdir(self.path)
+ ftp = Net::FTP.new(host)
+ ftp.login(user, pass)
+ ftp.chdir(path)
ftp.passive = true
ftp
end
@@ -74,14 +74,12 @@
puts "Copied #{filename}"
end
def upload_directory(ftp, filename)
- begin
- ftp.mkdir(filename)
- puts "Created directory #{filename}"
- rescue
- end
+ ftp.mkdir(filename)
+ puts "Created directory #{filename}"
+ rescue
end
end
end
end
end