Created
June 8, 2015 13:58
-
-
Save universal/b619252a0cb7e8862dad to your computer and use it in GitHub Desktop.
net/http download
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # encoding: UTF-8 | |
| require 'net/http' | |
| require 'net/https' | |
| require 'uri' | |
| module Literature | |
| class BibliographyDownloader | |
| def self.download | |
| uri = URI.parse(WebsitePrep.config.svn_url) | |
| base = Net::HTTP.new(uri.host, uri.port) | |
| base.ssl_version = :TLSv1 | |
| base.use_ssl = true | |
| base.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
| base.start do |http| | |
| request = Net::HTTP::Get.new('/svn/tex/trunk/bibtex/bib/literature.bib') | |
| request.basic_auth WebsitePrep.config.svn_user, WebsitePrep.config.svn_pass | |
| response = http.request(request) | |
| open(WebsitePrep.config.bib_file, "wb") do |file| | |
| file.write(response.body) | |
| end | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment