Revision: 2558
Updated Code
at January 18, 2008 19:04 by gtcaz
Updated Code
#!/usr/bin/env ruby BEGIN {$VERBOSE = true} require 'date' require 'fileutils' require 'time' LOCAL_FILE = 'e_setup.exe' REMOTE_FILE = 'http://opencompany.org/download/e_setup.exe' WGET_CMD = '/usr/bin/wget --spider -S' def download_run() `curl -R -O #{REMOTE_FILE}` puts "Setting file permissions..." `chmod +x #{LOCAL_FILE}` puts "Running setup." `cygstart #{LOCAL_FILE}` end unless File.exists?(LOCAL_FILE) download_run() exit() end puts "Checking modification times..." begin mod_time = Time.parse(%x{#{WGET_CMD} #{REMOTE_FILE} 2>&1}.split("\n").grep(/Last-Modified:/)[0].split(": ")[1].chomp) if mod_time > File.mtime(LOCAL_FILE) puts "Remote file is newer. Downloading..." download_run() else puts "Remote file no newer than local file. Nothing to do." end rescue puts "Error during download process: ",$! exit(false) end
Revision: 2557
Updated Code
at March 13, 2007 10:52 by gtcaz
Updated Code
#!/usr/bin/env ruby BEGIN {$VERBOSE = true} require 'date' LOCAL_FILE = 'e_beta_setup.exe' REMOTE_FILE = 'http://opencompany.org/download/e_beta_setup.exe' WGET_CMD = '/usr/bin/wget --spider -S' def download_run() `curl -R -O #{REMOTE_FILE}` puts "Setting file permissions..." `chmod +x #{LOCAL_FILE}` puts "Running setup." `run #{LOCAL_FILE}` end unless File.exists?(LOCAL_FILE) download_run() exit() end puts "Checking modification times..." begin mod_time = Time.parse(%x{#{WGET_CMD} #{REMOTE_FILE} 2>&1}.split("\n").grep(/Last-Modified:/)[0].split(": ")[1].chomp) if mod_time > File.mtime(LOCAL_FILE) puts "Remote file is newer. Downloading..." download_run() else puts "Remote file no newer than local file. Nothing to do." end rescue puts "Communication error." exit(false) end
Revision: 2556
Updated Code
at March 9, 2007 12:04 by gtcaz
Updated Code
#!/usr/bin/env ruby require 'date' LOCAL_FILE = 'e_beta_setup.exe' REMOTE_FILE = 'http://opencompany.org/download/e_beta_setup.exe' WGET_CMD = '/usr/bin/wget --spider -S' def download_run() `curl -R -O #{REMOTE_FILE}` puts "Setting file permissions..." `chmod +x #{LOCAL_FILE}` puts "Running setup." `run #{LOCAL_FILE}` end unless File.exists?(LOCAL_FILE) download_run() exit() end puts "Checking modification times..." begin mod_time = Time.parse(%x{#{WGET_CMD} #{REMOTE_FILE} 2>&1}.split("\n").grep(/Last-Modified:/)[0].split(": ")[1].chomp) if mod_time > File.mtime(LOCAL_FILE) puts "Remote file is newer. Downloading..." download_run() else puts "Remote file no newer than local file. Nothing to do." end rescue puts "Communication error." exit(false) end
Revision: 2555
Updated Code
at March 9, 2007 12:03 by gtcaz
Updated Code
#!/usr/bin/env ruby require 'open-uri' require 'date' LOCAL_FILE = 'e_beta_setup.exe' REMOTE_FILE = 'http://opencompany.org/download/e_beta_setup.exe' WGET_CMD = '/usr/bin/wget --spider -S' def download_run() `curl -R -O #{REMOTE_FILE}` puts "Setting file permissions..." `chmod +x #{LOCAL_FILE}` puts "Running setup." `run #{LOCAL_FILE}` end unless File.exists?(LOCAL_FILE) download_run() exit() end puts "Checking modification times..." begin mod_time = Time.parse(%x{#{WGET_CMD} #{REMOTE_FILE} 2>&1}.split("\n").grep(/Last-Modified:/)[0].split(": ")[1].chomp) if mod_time > File.mtime(LOCAL_FILE) puts "Remote file is newer. Downloading..." download_run() else puts "Remote file no newer than local file. Nothing to do." end rescue puts "Communication error." exit(false) end
Revision: 2554
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 9, 2007 12:02 by gtcaz
Initial Code
#!/usr/bin/env ruby require 'open-uri' require 'date' LOCAL_FILE = 'e_beta_setup.exe' REMOTE_FILE = 'http://opencompany.org/download/e_beta_setup.exe' WGET_CMD = '/usr/bin/wget --spider -S' def download_run() `curl -R -O #{REMOTE_FILE}` puts "Setting file permissions..." `chmod +x #{LOCAL_FILE}` puts "Running setup." `run #{LOCAL_FILE}` end unless File.exists?(LOCAL_FILE) download_run() exit() end puts "Checking modification times..." begin mod_time = Time.parse(%x{#{WGET_CMD} #{REMOTE_FILE} 2>&1}.split("\n").grep(/Last-Modified:/)[0].split(": ")[1].chomp) if mod_time > File.mtime(LOCAL_FILE) puts "Remote file is newer. Downloading..." download_run() else puts "Remote file no newer than local file. Nothing to do." end rescue puts "Communication error." exit(false) end
Initial URL
Initial Description
Requires wget and curl.
Initial Title
Check for e updates
Initial Tags
ruby, download, update
Initial Language
Ruby