imapget 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24c3643da9e9ab040c44f280b07e4f8e9f654ce5
4
- data.tar.gz: 99b0c5f0416b2a32ed7cafce338a31155d568a79
3
+ metadata.gz: c8fc37159315d08af42a847d81b4197f51ed1a00
4
+ data.tar.gz: 1b3aa67a103fa31d0433d7e40734ae3d40b30c1b
5
5
  SHA512:
6
- metadata.gz: b16c28b4d1b57ead67cdc88caaff2de8fad7e687ba3f98e72ae124cefb0e3d981ff152f04c0e9e142314ac3e58073306f57c39998ba6648e295df150a30e1400
7
- data.tar.gz: 357e07e15487f26cea34867070bae2bc505e416c736a1e8ee842c6e89da80cde11386cdc2c192dc1dcb2e400666f86836817600f2af56401ce7b761b4b098260
6
+ metadata.gz: bac7a8935583abeb47dfed8ab5cf347c15f3bc700025b1cf3c7cb8aa463072b35e0a3ce34ac1debe38aab9d609e1b2bbf1dbd5dda1515bb169db873d43031c15
7
+ data.tar.gz: 5455938ccba4d8d81a354ed14797a75ece5353075fd7eabb092bcf543cdf068b9f464314ddac9f6d05d5bb02725408ca0b3f474fcc8e3f3260b00df8cb0ac201
data/ChangeLog CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  = Revision history for imapget
4
4
 
5
+ == 0.2.0 [2016-02-13]
6
+
7
+ * Fixed batch fetching.
8
+ * Internal refactoring.
9
+
5
10
  == 0.1.0 [2014-04-14]
6
11
 
7
12
  * Added options <tt>--dupes</tt> and <tt>--uniq</tt>.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to imapget version 0.1.0
5
+ This documentation refers to imapget version 0.2.0
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -14,7 +14,7 @@ server! Thus, it's different from your typical *sync* tool.
14
14
 
15
15
  == LINKS
16
16
 
17
- Documentation:: https://blackwinter.github.io/imapget/
17
+ Documentation:: https://blackwinter.github.com/imapget
18
18
  Source code:: https://github.com/blackwinter/imapget
19
19
  RubyGem:: https://rubygems.org/gems/imapget
20
20
 
@@ -26,7 +26,7 @@ RubyGem:: https://rubygems.org/gems/imapget
26
26
 
27
27
  == LICENSE AND COPYRIGHT
28
28
 
29
- Copyright (C) 2009-2014 Jens Wille
29
+ Copyright (C) 2009-2016 Jens Wille
30
30
 
31
31
  imapget is free software: you can redistribute it and/or modify it under
32
32
  the terms of the GNU Affero General Public License as published by the Free
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- require File.expand_path(%q{../lib/imapget/version}, __FILE__)
1
+ require_relative 'lib/imapget/version'
2
2
 
3
3
  begin
4
4
  require 'hen'
@@ -13,7 +13,7 @@ begin
13
13
  email: %q{jens.wille@gmail.com},
14
14
  license: %q{AGPL-3.0},
15
15
  homepage: :blackwinter,
16
- dependencies: %w[cyclops] << ['ruby-nuggets', '>= 0.9.8'],
16
+ dependencies: { cyclops: '~> 0.2', nuggets: '~> 1.4' },
17
17
 
18
18
  required_ruby_version: '>= 1.9.3'
19
19
  }
data/lib/imapget.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  # #
4
4
  # imapget -- Download IMAP mails #
5
5
  # #
6
- # Copyright (C) 2009-2014 Jens Wille #
6
+ # Copyright (C) 2009-2016 Jens Wille #
7
7
  # #
8
8
  # Authors: #
9
9
  # Jens Wille <jens.wille@gmail.com> #
@@ -90,9 +90,12 @@ class IMAPGet
90
90
  else raise TypeError, "MailboxList or String expected, got #{mailbox.class}"
91
91
  end
92
92
 
93
+ excl &&= name =~ excl
94
+ incl &&= name =~ incl
95
+
93
96
  case strategy
94
- when :include then (excl && name =~ excl) || !(incl && name =~ incl)
95
- when :exclude then (excl && name =~ excl) && !(incl && name =~ incl)
97
+ when :include then excl || !incl
98
+ when :exclude then excl && !incl
96
99
  end
97
100
  end
98
101
 
@@ -130,26 +133,23 @@ class IMAPGet
130
133
  }
131
134
  }
132
135
 
133
- dupes = hash.flat_map { |_, uids| uids.drop(1) if uids.size > 1 }.compact
134
-
135
- log "#{name}: #{dupes.size}" unless quiet
136
-
137
- dupes
136
+ hash.flat_map { |_, uids| uids.drop(1) if uids.size > 1 }.tap { |dupes|
137
+ dupes.compact!; log "#{name}: #{dupes.size}" unless quiet
138
+ }
138
139
  end
139
140
 
140
141
  def delete!(name, uids)
141
- unless uids.empty?
142
- log "#{name}: #{uids.size}"
142
+ return if uids.empty?
143
143
 
144
- yield if block_given?
144
+ log "#{name}: #{uids.size}"
145
145
 
146
- imap.select(name)
147
- count = imap.store(uids, '+FLAGS', [Net::IMAP::DELETED]).size
146
+ yield if block_given?
148
147
 
149
- log "#{count} DELETED!"
148
+ imap.select(name)
150
149
 
151
- count
152
- end
150
+ imap.store(uids, '+FLAGS', [Net::IMAP::DELETED]).size.tap { |count|
151
+ log "#{count} DELETED!"
152
+ }
153
153
  end
154
154
 
155
155
  def uniq!(name, &block)
@@ -169,16 +169,15 @@ class IMAPGet
169
169
  end
170
170
 
171
171
  def fetch_batch(batch, fetch_attr = FETCH_ATTR, &block)
172
- if batch.size == 1
173
- case set = batch.first
174
- when Array
175
- batch = set.first .. (set.first + set.last - 1)
176
- when Range
177
- batch = set.first .. (set.last - 1) if set.exclude_end?
178
- end
179
- end
180
-
181
- imap.uid_fetch(batch, fetch_attr).each(&block)
172
+ case set = batch.first
173
+ when Array
174
+ batch = set.first .. (set.first + set.last - 1)
175
+ when Range
176
+ batch = set.first .. (set.last - 1) if set.exclude_end?
177
+ end if batch.size == 1
178
+
179
+ mails = imap.uid_fetch(batch, fetch_attr)
180
+ mails.each(&block) if mails
182
181
  end
183
182
 
184
183
  def fetch(mail, dir, name)
@@ -3,7 +3,7 @@ class IMAPGet
3
3
  module Version
4
4
 
5
5
  MAJOR = 0
6
- MINOR = 1
6
+ MINOR = 2
7
7
  TINY = 0
8
8
 
9
9
  class << self
metadata CHANGED
@@ -1,57 +1,84 @@
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.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2014-04-14 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDMDCCAhigAwIBAgIBADANBgkqhkiG9w0BAQUFADA+MQswCQYDVQQDDAJ3dzEb
14
+ MBkGCgmSJomT8ixkARkWC2JsYWNrd2ludGVyMRIwEAYKCZImiZPyLGQBGRYCZGUw
15
+ HhcNMTMwMTMxMDkyMjIyWhcNMTQwMTMxMDkyMjIyWjA+MQswCQYDVQQDDAJ3dzEb
16
+ MBkGCgmSJomT8ixkARkWC2JsYWNrd2ludGVyMRIwEAYKCZImiZPyLGQBGRYCZGUw
17
+ ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDVXmfa6rbTwKOvtuGoROc1
18
+ I4qZjgLX0BA4WecYB97PjwLJmJ1hRvf9JulVCJYYmt5ZEPPXbgi9xLbcp6ofGmnC
19
+ i68/kbhcz20/fRUtIJ2phU3ypQTEd2pFddpL7SR2FxLkzvvg5E6nslGn7o2erDpO
20
+ 8sm610A3xsgT/eNIr9QA7k4pHh18X1KvZKmmQR4/AjVyKmKawzauKUoHHepjvjVs
21
+ s0pVoM7UmOmrS4SafQ3OwUo37f19CVdN2/FW7z3e5+iYhKxdIFdhniX9iDWtA3Jn
22
+ 7oUOtiolhCRK4P/c30UjTCDkRkOldsWciFUasROJ5VAV2SVv7FtGHoQLDZ/++tRr
23
+ AgMBAAGjOTA3MAkGA1UdEwQCMAAwHQYDVR0OBBYEFIAPWU4BEoYUe82hY/0EkoGd
24
+ Oo/WMAsGA1UdDwQEAwIEsDANBgkqhkiG9w0BAQUFAAOCAQEAf2YnB0mj42of22dA
25
+ MimgJCAEgB3H5aHbZ6B5WVnFvrC2UUnhP+/kLj/6UgOfqcasy4Xh62NVGuNrf7rF
26
+ 7NMN87XwexGuU2GCpIMUd6VCTA7zMP2OWuXEcba7jT5OtiI55buO0J4CRtyeX1XF
27
+ qwlGgx4ItcGhMTlDFXj3IkpeVtjD8O7yWE21bHf9lLURmqK/r9KjoxrrVi7+cESJ
28
+ H19TDW3R9p594jCl1ykPs3dz/0Bk+r1HTd35Yw+yBbyprSJb4S7OcRRHCryuo09l
29
+ NBGyZvOBuqUp0xostWSk0dfxyn/YQ7eqvQRGBhK1VGa7Tg/KYqnemDE57+VOXrua
30
+ 59wzaA==
31
+ -----END CERTIFICATE-----
32
+ date: 2016-02-13 00:00:00.000000000 Z
12
33
  dependencies:
13
34
  - !ruby/object:Gem::Dependency
14
35
  name: cyclops
15
36
  requirement: !ruby/object:Gem::Requirement
16
37
  requirements:
17
- - - ">="
38
+ - - "~>"
18
39
  - !ruby/object:Gem::Version
19
- version: '0'
40
+ version: '0.2'
20
41
  type: :runtime
21
42
  prerelease: false
22
43
  version_requirements: !ruby/object:Gem::Requirement
23
44
  requirements:
24
- - - ">="
45
+ - - "~>"
25
46
  - !ruby/object:Gem::Version
26
- version: '0'
47
+ version: '0.2'
27
48
  - !ruby/object:Gem::Dependency
28
- name: ruby-nuggets
49
+ name: nuggets
29
50
  requirement: !ruby/object:Gem::Requirement
30
51
  requirements:
31
- - - ">="
52
+ - - "~>"
32
53
  - !ruby/object:Gem::Version
33
- version: 0.9.8
54
+ version: '1.4'
34
55
  type: :runtime
35
56
  prerelease: false
36
57
  version_requirements: !ruby/object:Gem::Requirement
37
58
  requirements:
38
- - - ">="
59
+ - - "~>"
39
60
  - !ruby/object:Gem::Version
40
- version: 0.9.8
61
+ version: '1.4'
41
62
  - !ruby/object:Gem::Dependency
42
63
  name: hen
43
64
  requirement: !ruby/object:Gem::Requirement
44
65
  requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.8'
45
69
  - - ">="
46
70
  - !ruby/object:Gem::Version
47
- version: '0'
71
+ version: 0.8.3
48
72
  type: :development
49
73
  prerelease: false
50
74
  version_requirements: !ruby/object:Gem::Requirement
51
75
  requirements:
76
+ - - "~>"
77
+ - !ruby/object:Gem::Version
78
+ version: '0.8'
52
79
  - - ">="
53
80
  - !ruby/object:Gem::Version
54
- version: '0'
81
+ version: 0.8.3
55
82
  - !ruby/object:Gem::Dependency
56
83
  name: rake
57
84
  requirement: !ruby/object:Gem::Requirement
@@ -91,19 +118,14 @@ licenses:
91
118
  metadata: {}
92
119
  post_install_message: |2+
93
120
 
94
- imapget-0.1.0 [2014-04-14]:
121
+ imapget-0.2.0 [2016-02-13]:
95
122
 
96
- * Added options <tt>--dupes</tt> and <tt>--uniq</tt>.
97
- * Added STARTTLS support.
98
- * Added LOGIN as fallback for AUTHENTICATE.
99
- * Added +batch_size+ option.
100
- * Dropped +use_ssl+ options; use +ssl+ instead.
101
- * Dropped support for Ruby 1.8.
123
+ * Fixed batch fetching.
102
124
  * Internal refactoring.
103
125
 
104
126
  rdoc_options:
105
127
  - "--title"
106
- - imapget Application documentation (v0.1.0)
128
+ - imapget Application documentation (v0.2.0)
107
129
  - "--charset"
108
130
  - UTF-8
109
131
  - "--line-numbers"
@@ -124,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
146
  version: '0'
125
147
  requirements: []
126
148
  rubyforge_project:
127
- rubygems_version: 2.2.2
149
+ rubygems_version: 2.5.2
128
150
  signing_key:
129
151
  specification_version: 4
130
152
  summary: Get IMAP mails.