Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for option to disable passive mode.

  • Loading branch information...
commit add737f77064422554ebed0f2cbdf804dc87dca8 1 parent f0edd68
@pzgz authored
Showing with 5 additions and 3 deletions.
  1. +2 −1  bin/glynn
  2. +3 −2 lib/glynn/ftp.rb
View
3  bin/glynn
@@ -21,6 +21,7 @@ case ARGV.size
end
options = Jekyll.configuration(options)
ftp_port = (options['ftp_port'] || 21).to_i
+ftp_disable_passive = options['ftp_disable_passive'] || true
puts "Building site: #{options['source']} -> #{options['destination']}"
jekyll = Glynn::Jekyll.new
@@ -52,7 +53,7 @@ rescue NoMethodError, Interrupt
exit
end
-ftp = Glynn::Ftp.new(options['ftp_host'], ftp_port, {:username => username, :password => password})
+ftp = Glynn::Ftp.new(options['ftp_host'], ftp_port, {:username => username, :password => password, :disable_passive => ftp_disable_passive})
puts "\r\nConnected to server. Sending site"
ftp.sync(options['destination'], options['ftp_dir'])
puts "Successfully sent site"
View
5 lib/glynn/ftp.rb
@@ -2,12 +2,13 @@
module Glynn
class Ftp
- attr_reader :host, :port, :username, :password
+ attr_reader :host, :port, :username, :password, :disable_passive
def initialize(host, port = 21, options = Hash.new)
options = {:username => nil, :password => nil}.merge(options)
@host, @port = host, port
@username, @password = options[:username], options[:password]
+ @disable_passive = options[:disable_passive]
end
def sync(local, distant)
@@ -19,7 +20,7 @@ def sync(local, distant)
private
def connect
Net::FTP.open(host) do |ftp|
- ftp.passive = true
+ ftp.passive = !@disable_passive
ftp.connect(host, port)
ftp.login(username, password)
yield ftp
Please sign in to comment.
Something went wrong with that request. Please try again.