Module: Sfd2
Constant Summary collapse
- HELP_MSG =
" Downloads all of Salesforce documents by a single command. Usage: run sfd2 in your command line: $ sfd2 "
- VERSION =
"2.0.0"
Instance Method Summary collapse
Instance Method Details
#download(folder, url) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sfd2/utils.rb', line 15 def download(folder, url) file_path = "#{folder}/#{File.basename(url)}" = nil begin File.open(file_path, "wb") do |file| file.write open(url, :content_length_proc => lambda {|t| if t && 0 < t = ProgressBar.new(File.basename(url).split('_')[1], t) .file_transfer_mode end }, :progress_proc => lambda {|s| .set s if } ).read end rescue Exception => e puts e. end end |