Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Passive option #20

Closed
wants to merge 3 commits into
from
View
@@ -21,6 +21,7 @@ For example, this is my _config.yml file :
auto: true
ftp_host: dmathieu.com
ftp_dir: /web/portfolio
+ ftp_disable_passive: false
Glynn will connect itself to the host "dmathieu.com" and send every file to the FTP directory /web/portfolio.
To do yo, you just need to be at the top of your jekyll project. And in a console, enter the following :
@@ -29,6 +30,14 @@ To do yo, you just need to be at the top of your jekyll project. And in a consol
Quite simple again. It'll connect to the remote host, ask you for login and password and send the files :)
+Passive Mode
+------------
+
+By default, passive mode will be enabled, but if you do need to switch off the passive mode, simple add following configuration into jekyll ```_config.yml``` file:
+
+ ftp_disable_passive: true
+
+
Contributing
------------
View
@@ -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'] || false
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
@@ -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