imapget 0.1.0.pre1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +1 -1
- data/Rakefile +2 -2
- data/lib/imapget.rb +5 -4
- data/lib/imapget/cli.rb +10 -19
- data/lib/imapget/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24c3643da9e9ab040c44f280b07e4f8e9f654ce5
|
4
|
+
data.tar.gz: 99b0c5f0416b2a32ed7cafce338a31155d568a79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b16c28b4d1b57ead67cdc88caaff2de8fad7e687ba3f98e72ae124cefb0e3d981ff152f04c0e9e142314ac3e58073306f57c39998ba6648e295df150a30e1400
|
7
|
+
data.tar.gz: 357e07e15487f26cea34867070bae2bc505e416c736a1e8ee842c6e89da80cde11386cdc2c192dc1dcb2e400666f86836817600f2af56401ce7b761b4b098260
|
data/ChangeLog
CHANGED
data/Rakefile
CHANGED
@@ -8,12 +8,12 @@ begin
|
|
8
8
|
name: %q{imapget},
|
9
9
|
version: IMAPGet::VERSION,
|
10
10
|
summary: %q{Get IMAP mails.},
|
11
|
-
description: %q{Download e-mails from IMAP
|
11
|
+
description: %q{Download e-mails from IMAP servers.},
|
12
12
|
author: %q{Jens Wille},
|
13
13
|
email: %q{jens.wille@gmail.com},
|
14
14
|
license: %q{AGPL-3.0},
|
15
15
|
homepage: :blackwinter,
|
16
|
-
dependencies: %w[
|
16
|
+
dependencies: %w[cyclops] << ['ruby-nuggets', '>= 0.9.8'],
|
17
17
|
|
18
18
|
required_ruby_version: '>= 1.9.3'
|
19
19
|
}
|
data/lib/imapget.rb
CHANGED
@@ -27,6 +27,7 @@
|
|
27
27
|
require 'time'
|
28
28
|
require 'net/imap'
|
29
29
|
require 'fileutils'
|
30
|
+
require 'nuggets/hash/zip'
|
30
31
|
|
31
32
|
require_relative 'imapget/version'
|
32
33
|
|
@@ -71,7 +72,7 @@ class IMAPGet
|
|
71
72
|
end
|
72
73
|
|
73
74
|
def mailboxes
|
74
|
-
@mailboxes ||= imap.list('', '*').
|
75
|
+
@mailboxes ||= imap.list('', '*').sort_by(&:name)
|
75
76
|
end
|
76
77
|
|
77
78
|
def each
|
@@ -121,7 +122,7 @@ class IMAPGet
|
|
121
122
|
def dupes(name, quiet = false)
|
122
123
|
imap.examine(name)
|
123
124
|
|
124
|
-
hash = Hash.
|
125
|
+
hash = Hash.zipkey { |h, k| h[k] = [] }
|
125
126
|
|
126
127
|
1.step(size(name), step = batch_size) { |i|
|
127
128
|
fetch_batch([[i, step]]) { |mail|
|
@@ -151,8 +152,8 @@ class IMAPGet
|
|
151
152
|
end
|
152
153
|
end
|
153
154
|
|
154
|
-
def uniq!(name)
|
155
|
-
delete!(name, dupes(name, true))
|
155
|
+
def uniq!(name, &block)
|
156
|
+
delete!(name, dupes(name, true), &block)
|
156
157
|
end
|
157
158
|
|
158
159
|
private
|
data/lib/imapget/cli.rb
CHANGED
@@ -24,13 +24,12 @@
|
|
24
24
|
###############################################################################
|
25
25
|
#++
|
26
26
|
|
27
|
-
require '
|
28
|
-
|
27
|
+
require 'cyclops'
|
29
28
|
require 'imapget'
|
30
29
|
|
31
30
|
class IMAPGet
|
32
31
|
|
33
|
-
class CLI <
|
32
|
+
class CLI < Cyclops
|
34
33
|
|
35
34
|
class << self
|
36
35
|
|
@@ -54,13 +53,13 @@ class IMAPGet
|
|
54
53
|
profiles, default_config = config.partition { |k,| k.is_a?(String) }
|
55
54
|
|
56
55
|
(arguments.empty? ? profiles.map(&:first) : arguments).each { |profile|
|
57
|
-
|
56
|
+
profile_config = profile_config(profile, profiles, default_config) or next
|
58
57
|
|
59
58
|
imapget = IMAPGet.new(profile_config)
|
60
59
|
|
61
60
|
if options[:check]
|
62
61
|
imapget.each { |mailbox| puts mailbox.name }
|
63
|
-
elsif options[:
|
62
|
+
elsif options[:dupes]
|
64
63
|
imapget.each { |mailbox| imapget.dupes(mailbox.name) }
|
65
64
|
elsif options[:uniq]
|
66
65
|
imapget.each { |mailbox| imapget.uniq!(mailbox.name) {
|
@@ -79,28 +78,20 @@ class IMAPGet
|
|
79
78
|
end
|
80
79
|
|
81
80
|
def opts(opts)
|
82
|
-
opts.
|
83
|
-
options[:directory] = d
|
84
|
-
}
|
81
|
+
opts.option(:directory__PATH, 'Path to directory to store mails in [Default: BASE_DIR/<profile>]')
|
85
82
|
|
86
|
-
opts.separator
|
83
|
+
opts.separator
|
87
84
|
|
88
|
-
opts.
|
89
|
-
options[:check] = true
|
90
|
-
}
|
85
|
+
opts.switch(:check, :C, "Only check include/exclude statements; don't download any mails")
|
91
86
|
|
92
|
-
opts.
|
93
|
-
options[:dupe] = true
|
94
|
-
}
|
87
|
+
opts.switch(:dupes, :D, "Only check for duplicate mails; don't download any mails")
|
95
88
|
|
96
|
-
opts.
|
97
|
-
options[:uniq] = true
|
98
|
-
}
|
89
|
+
opts.switch(:uniq, :U, "Only delete duplicate mails; don't download any mails")
|
99
90
|
end
|
100
91
|
|
101
92
|
def profile_config(profile, profiles, default_config)
|
102
93
|
unless config = profiles.assoc(profile)
|
103
|
-
"No such profile: #{profile}"
|
94
|
+
warn "No such profile: #{profile}"
|
104
95
|
return
|
105
96
|
end
|
106
97
|
|
data/lib/imapget/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imapget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: cyclops
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description: Download e-mails from IMAP
|
69
|
+
description: Download e-mails from IMAP servers.
|
70
70
|
email: jens.wille@gmail.com
|
71
71
|
executables:
|
72
72
|
- imapget
|
@@ -91,7 +91,7 @@ licenses:
|
|
91
91
|
metadata: {}
|
92
92
|
post_install_message: |2+
|
93
93
|
|
94
|
-
imapget-0.1.0 [
|
94
|
+
imapget-0.1.0 [2014-04-14]:
|
95
95
|
|
96
96
|
* Added options <tt>--dupes</tt> and <tt>--uniq</tt>.
|
97
97
|
* Added STARTTLS support.
|
@@ -103,7 +103,7 @@ post_install_message: |2+
|
|
103
103
|
|
104
104
|
rdoc_options:
|
105
105
|
- "--title"
|
106
|
-
- imapget Application documentation (v0.1.0
|
106
|
+
- imapget Application documentation (v0.1.0)
|
107
107
|
- "--charset"
|
108
108
|
- UTF-8
|
109
109
|
- "--line-numbers"
|
@@ -119,9 +119,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: 1.9.3
|
120
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: '0'
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project:
|
127
127
|
rubygems_version: 2.2.2
|