lib/middleman-deploy/methods/ftp.rb in middleman-deploy-0.2.4 vs lib/middleman-deploy/methods/ftp.rb in middleman-deploy-0.3.0
- old
+ new
@@ -3,14 +3,13 @@
module Middleman
module Deploy
module Methods
class Ftp < Base
-
attr_reader :host, :port, :pass, :path, :user
- def initialize(server_instance, options={})
+ def initialize(server_instance, options = {})
super(server_instance, options)
@host = self.options.host
@user = self.options.user
@pass = self.options.password
@@ -25,30 +24,30 @@
Dir.chdir(self.server_instance.build_dir) do
filtered_files.each do |filename|
if File.directory?(filename)
upload_directory(ftp, filename)
- else
+ else
upload_binary(ftp, filename)
end
end
end
ftp.close
end
- protected
+ protected
def filtered_files
files = Dir.glob('**/*', File::FNM_DOTMATCH)
files.reject { |filename| filename =~ Regexp.new('\.$') }
end
def handle_exception(exception, ftp, filename)
reply = exception.message
- err_code = reply[0,3].to_i
+ err_code = reply[0, 3].to_i
if err_code == 550
if File.binary?(filename)
ftp.putbinaryfile(filename, filename)
else
@@ -81,11 +80,9 @@
ftp.mkdir(filename)
puts "Created directory #{filename}"
rescue
end
end
-
-
end
end
end
end