Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Passive option #20

Closed
wants to merge 3 commits into from

2 participants

Leon Guan Damien Mathieu
Leon Guan

The passive mode is enabled by default right now. But in certain situations, we might not be able to connect to server with passive mode on. So I added an option to disable the passive mode in configuration file.

Damien Mathieu
Owner

Could you write a test about this ?
The travis build fails, but I believe it's not due to your changes. I'll look into it soon.

Leon Guan

Thanks, just back from vacation...

About CI build failure, I made a check locally, got following messages:

NOTE: Gem.available? is deprecated, use Specification::find_by_name. It will be removed on or after 2011-11-01.
Gem.available? called from /Users/leon/.rvm/gems/ruby-1.9.2-p320@glynn/gems/sdoc-0.2.20/lib/sdoc/json_backend.rb:9.

It looks like the bundled version for SDoc is pretty out date, maybe bundle update can fix the deprecated issue.

For the tests, I will try to add and send another pull request, thanks for your great plugin.

Damien Mathieu
Owner

The build is not fixed on master. If you were to rebase your branch on it, and to add tests, I could merge your PR.

Damien Mathieu
Owner

I have merged your pull request with a few changes in 885bd89
Thanks

Damien Mathieu dmathieu closed this
Leon Guan

@dmathieu Sorry for my absence, full scheduled. Anyway, thanks a lot for your updates, perfect!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 3 deletions.
  1. +9 −0 README.md
  2. +2 −1  bin/glynn
  3. +3 −2 lib/glynn/ftp.rb
9 README.md
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
------------
3  bin/glynn
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"
5 lib/glynn/ftp.rb
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
Something went wrong with that request. Please try again.