rgrove-larch 1.0.0.2 → 1.0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY ADDED
@@ -0,0 +1,16 @@
1
+ Larch History
2
+ ================================================================================
3
+
4
+ Version 1.0.1 (?)
5
+ * Much more robust handling of unexpected server disconnects and dropped
6
+ connections.
7
+ * Fetch message headers in blocks of up to 1024 at a time rather than all at
8
+ once, to prevent potential problems with certain servers when a mailbox
9
+ contains a huge number of messages.
10
+ * Don't try to trap POSIX signals on platforms that aren't likely to support
11
+ them, and don't die if the platform sniffing doesn't save us.
12
+ * Add a new "insane" logging level, which will output all IMAP commands and
13
+ responses to STDERR.
14
+
15
+ Version 1.0.0 (2009-03-17)
16
+ * First release.
data/README.rdoc ADDED
@@ -0,0 +1,110 @@
1
+ = Larch
2
+
3
+ Larch is a tool to copy messages from one IMAP server to another quickly and
4
+ safely. It's smart enough not to copy messages that already exist on the
5
+ destination and robust enough to deal with ornery or misbehaving servers.
6
+
7
+ Larch is particularly well-suited for copying email to, from, or between Gmail
8
+ accounts.
9
+
10
+ *Author*:: Ryan Grove (mailto:ryan@wonko.com)
11
+ *Version*:: 1.0.0 (2009-03-17)
12
+ *Copyright*:: Copyright (c) 2009 Ryan Grove. All rights reserved.
13
+ *License*:: GPL 2.0 (http://opensource.org/licenses/gpl-2.0.php)
14
+ *Website*:: http://github.com/rgrove/larch
15
+
16
+ == Installation
17
+
18
+ Install Larch via RubyGems:
19
+
20
+ gem install larch
21
+
22
+ == Usage
23
+
24
+ Larch is run from the command line. At a minimum, you must specify a source
25
+ server and a destination server in the form of IMAP URIs. You may also specify
26
+ one or more options:
27
+
28
+ larch --from <uri> --to <uri> [options]
29
+
30
+ For an overview of all available command-line options, run:
31
+
32
+ larch --help
33
+
34
+ Specify a source server and a destination server and Larch will prompt you for
35
+ the necessary usernames and passwords, then sync the contents of the source's
36
+ +INBOX+ folder to the destination:
37
+
38
+ larch --from imap://mail.example.com --to imap://imap.gmail.com
39
+
40
+ To connect using SSL, specify a URI beginning with <tt>imaps://</tt>:
41
+
42
+ larch --from imaps://mail.example.com --to imaps://imap.gmail.com
43
+
44
+ If you'd like to sync a folder other than +INBOX+, specify the source and
45
+ destination folders using <tt>--from-folder</tt> and <tt>--to-folder</tt>:
46
+
47
+ larch --from imaps://mail.example.com --to imaps://imap.gmail.com \
48
+ --from-folder "Sent Mail" --to-folder "Sent Mail"
49
+
50
+ By default Larch will create the specified folder if it doesn't already exist on
51
+ the destination server. To prevent this, add the <tt>--no-create-folder</tt>
52
+ option:
53
+
54
+ larch --from imaps://mail.example.com --to imaps://imap.gmail.com \
55
+ --from-folder "Sent Mail" --to-folder "Sent Mail" --no-create-folder
56
+
57
+ == Server Support
58
+
59
+ Larch should work well with any server that properly supports
60
+ IMAP4rev1[http://tools.ietf.org/html/rfc3501], and does its best to get along
61
+ with servers that have buggy, unreliable, or incomplete IMAP implementations.
62
+
63
+ Larch has been tested on and is known to work well with the following IMAP
64
+ servers:
65
+
66
+ * Dovecot
67
+ * Gmail
68
+ * Microsoft Exchange 2003
69
+
70
+ == Known Issues
71
+
72
+ Larch uses Ruby's Net::IMAP standard library for all IMAP operations. While
73
+ Net::IMAP is generally a very solid library, it contains a bug that can cause a
74
+ deadlock to occur if a connection drops unexpectedly (either due to network
75
+ issues or because the server closed the connection without warning) when the
76
+ server has already begun sending a response and Net::IMAP is waiting to receive
77
+ more data.
78
+
79
+ If this happens, Net::IMAP will continue waiting forever without passing control
80
+ back to Larch, and you will need to manually kill and restart Larch.
81
+
82
+ == Credit
83
+
84
+ The Larch::IMAP class borrows heavily from Sup[http://sup.rubyforge.org] by
85
+ William Morgan, the source code of which should be required reading if you're
86
+ doing anything with IMAP in Ruby.
87
+
88
+ Larch uses the excellent Trollop[http://trollop.rubyforge.org] command-line
89
+ option parser (also by William Morgan) and the
90
+ HighLine[http://highline.rubyforge.org] command-line IO library (by James Edward
91
+ Gray II).
92
+
93
+ == License
94
+
95
+ Copyright (c) 2009 Ryan Grove <ryan@wonko.com>
96
+
97
+ Licensed under the GNU General Public License version 2.0.
98
+
99
+ This program is free software; you can redistribute it and/or modify it under
100
+ the terms of version 2.0 of the GNU General Public License as published by the
101
+ Free Software Foundation.
102
+
103
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY
104
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
105
+ PARTICULAR PURPOSE. See the GNU General Public License for more details.
106
+
107
+ You should have received a copy of the GNU General Public License along with
108
+ this program; if not, visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
109
+ or write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
110
+ Boston, MA 02111-1307 USA.
data/bin/larch CHANGED
@@ -74,6 +74,8 @@ EOS
74
74
  # Go go go!
75
75
  init(options[:verbosity])
76
76
 
77
+ Net::IMAP.debug = true if @log.level == :insane
78
+
77
79
  source = IMAP.new(options[:from], options[:from_user], options[:from_pass],
78
80
  :fast_scan => options[:fast_scan],
79
81
  :max_retries => options[:max_retries])
data/lib/larch/logger.rb CHANGED
@@ -4,11 +4,12 @@ class Logger
4
4
  attr_reader :level, :output
5
5
 
6
6
  LEVELS = {
7
- :fatal => 0,
8
- :error => 1,
9
- :warn => 2,
10
- :info => 3,
11
- :debug => 4
7
+ :fatal => 0,
8
+ :error => 1,
9
+ :warn => 2,
10
+ :info => 3,
11
+ :debug => 4,
12
+ :insane => 5
12
13
  }
13
14
 
14
15
  def initialize(level = :info, output = $stdout)
data/lib/larch/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Larch
2
2
  APP_NAME = 'Larch'
3
- APP_VERSION = '1.0.0'
3
+ APP_VERSION = '1.0.0.3'
4
4
  APP_AUTHOR = 'Ryan Grove'
5
5
  APP_EMAIL = 'ryan@wonko.com'
6
6
  APP_URL = 'http://github.com/rgrove/larch/'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgrove-larch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.2
4
+ version: 1.0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Grove
@@ -41,7 +41,9 @@ extensions: []
41
41
  extra_rdoc_files: []
42
42
 
43
43
  files:
44
+ - HISTORY
44
45
  - LICENSE
46
+ - README.rdoc
45
47
  - bin/larch
46
48
  - lib/larch.rb
47
49
  - lib/larch/errors.rb