imapget 0.1.0.pre1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf0abd8585721204d2c457a24b593605dd1cd4fb
4
- data.tar.gz: a7de9a98f18771603df466c0b055de8a83a704a3
3
+ metadata.gz: 24c3643da9e9ab040c44f280b07e4f8e9f654ce5
4
+ data.tar.gz: 99b0c5f0416b2a32ed7cafce338a31155d568a79
5
5
  SHA512:
6
- metadata.gz: 76671c4d3a6c52713650c08ac824f208dcb66fbc1026c7fe2791ec2d9a52ce9ace41eed80aa9edcd96a2f223f080cb2c6ce7daa25aac2cb9662138951d45f777
7
- data.tar.gz: 89c22c6aa52da221f20712b598adbac58eaf320daa3ec60129639d465fd483b2b86b48ac3ae30760c42ad2096da8b3595580fdfde81115c62f75746d5cf848e6
6
+ metadata.gz: b16c28b4d1b57ead67cdc88caaff2de8fad7e687ba3f98e72ae124cefb0e3d981ff152f04c0e9e142314ac3e58073306f57c39998ba6648e295df150a30e1400
7
+ data.tar.gz: 357e07e15487f26cea34867070bae2bc505e416c736a1e8ee842c6e89da80cde11386cdc2c192dc1dcb2e400666f86836817600f2af56401ce7b761b4b098260
data/ChangeLog CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  = Revision history for imapget
4
4
 
5
- == 0.1.0 [unreleased]
5
+ == 0.1.0 [2014-04-14]
6
6
 
7
7
  * Added options <tt>--dupes</tt> and <tt>--uniq</tt>.
8
8
  * Added STARTTLS support.
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 server.},
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[highline] << ['ruby-nuggets', '>= 0.9.8'],
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('', '*').sort
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.new { |h, k| h[k] = [] }
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 'nuggets/cli'
28
-
27
+ require 'cyclops'
29
28
  require 'imapget'
30
29
 
31
30
  class IMAPGet
32
31
 
33
- class CLI < Nuggets::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
- next unless profile_config = profile_config(profiles.assoc(profile))
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[:dupe]
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.on('-d', '--directory PATH', "Path to directory to store mails in [Default: BASE_DIR/<profile>]") { |d|
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.on('-C', '--check', "Only check include/exclude statements; don't download any mails") {
89
- options[:check] = true
90
- }
85
+ opts.switch(:check, :C, "Only check include/exclude statements; don't download any mails")
91
86
 
92
- opts.on('-D', '--dupes', "Only check for duplicate mails; don't download any mails") {
93
- options[:dupe] = true
94
- }
87
+ opts.switch(:dupes, :D, "Only check for duplicate mails; don't download any mails")
95
88
 
96
- opts.on('-U', '--uniq', "Only delete duplicate mails; don't download any mails") {
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
 
@@ -10,7 +10,7 @@ class IMAPGet
10
10
 
11
11
  # Returns array representation.
12
12
  def to_a
13
- [MAJOR, MINOR, TINY] << 'pre1'
13
+ [MAJOR, MINOR, TINY]
14
14
  end
15
15
 
16
16
  # Short-cut for version string.
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.pre1
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-10 00:00:00.000000000 Z
11
+ date: 2014-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: highline
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 server.
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 [unreleased]:
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.pre1)
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: 1.3.1
124
+ version: '0'
125
125
  requirements: []
126
126
  rubyforge_project:
127
127
  rubygems_version: 2.2.2