Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make script fetch configuration file if the URL provided.

  • Loading branch information...
commit 7815c15a1fd70586bcc5b05b70641eb1ef8b610c 1 parent 7d74563
beawesomeinstead authored
Showing with 14 additions and 1 deletion.
  1. +10 −1 imap-sync.rb
  2. +4 −0 readme
View
11 imap-sync.rb
@@ -2,7 +2,16 @@
if $PROGRAM_NAME == __FILE__
require 'yaml'
- C = YAML.load(File.read('configuration.yml'))
+ if ARGV
+ require 'open-uri'
+ begin
+ C = YAML.load(open(ARGV[0]))
+ rescue
+ raise "Unable to fetch configuration file."
+ end
+ else
+ C = YAML.load(File.read('configuration.yml'))
+ end
end
require 'net/imap'
View
4 readme
@@ -1 +1,5 @@
Copies messages from one IMAP server to another. Uses configuration file for safety.
+
+== Usage
+ruby imap-sync.rb # use configuration file from the script directory
+ruby imap-sync.rb http://pastie.org/447193.txt?key=ufvslgjncygggz9f3zq3la # use configuration file from the given URL
Please sign in to comment.
Something went wrong with that request. Please try again.