maildir 2.0.0 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: efbd522270f3b5117699a34ecc2770d7b8ae99adfef53f5b4583d44751a793f8
4
+ data.tar.gz: '08fe926a74261382c5ab07b2f870d0a90e26743f14c2038b4f05a03b9cf939dc'
5
+ SHA512:
6
+ metadata.gz: 44229a540b0c1397fed9787375608798ad5420fb76bee795ede3b8920d28695eea18a25451c963dc96bbcdd58e6b1345a7395188e760b431fe93a383247325b4
7
+ data.tar.gz: dccdb7449eb51f0a4fc9de41f522a57fc6f08a0811481a980d355295e0da051fef8b6f2978a511165b78097e7ad8301ab63e2399c27a4ff8e81cc22815e56a32
@@ -6,7 +6,7 @@ A ruby library for reading and writing messages in the maildir format.
6
6
 
7
7
  See http://cr.yp.to/proto/maildir.html and http://en.wikipedia.org/wiki/Maildir
8
8
 
9
- "Two words: no locks." -- Daniel J. Berstein
9
+ "Two words: no locks." -- Daniel J. Bernstein
10
10
 
11
11
  The maildir format allows multiple processes to read and write arbitrary messages without file locks.
12
12
 
@@ -14,6 +14,10 @@ New messages are initially written to a "tmp" directory with an automatically-ge
14
14
 
15
15
  While the maildir format was created for email, it works well for arbitrary data. This library can read & write email messages or arbitrary data. See Pluggable serializers for more.
16
16
 
17
+ {<img src="https://secure.travis-ci.org/ktheory/maildir.png" />}[http://travis-ci.org/ktheory/maildir]
18
+ {<img src="https://codeclimate.com/github/ktheory/maildir.png" />}[https://codeclimate.com/github/ktheory/maildir]
19
+
20
+
17
21
  == Install
18
22
 
19
23
  gem install maildir
@@ -50,6 +54,12 @@ Add some flags to the message to indicate state. See "What can I put in info" at
50
54
  message.remove_flag("F") # unflag the message
51
55
  message.add_flag("T") # Mark the message as "trashed"
52
56
 
57
+ List :cur messages based on flags.
58
+
59
+ maildir.list(:cur, :flags => 'F') # => lists all messages with flag 'F
60
+ maildir.list(:cur, :flags => 'FS') # => lists all messages with flag 'F' and 'S'; Flags must be specified in acending ASCII order ('FS' and not 'SF')
61
+ maildir.list(:cur, :flags => '') # => lists all messages without any flags
62
+
53
63
  Get a key to uniquely identify the message
54
64
 
55
65
  key = message.key
@@ -110,8 +120,11 @@ As of version 1.0.0, the Maildir::Serializer::Base can write IO streams as well
110
120
 
111
121
  message.add(STDIN)
112
122
 
113
- This will use Ruby 1.9's more efficient IO.copy_stream method if available,
114
- and degrade gracefully in Ruby 1.8.
123
+ This will use the more efficient IO.copy_stream method from Ruby 1.9+ if
124
+ available, and degrade gracefully in Ruby 1.8. (Important note: Please be aware
125
+ that Ruby 1.8.x is no longer officially supported by the maildir gem; see
126
+ [.travis.yml](https://github.com/ktheory/maildir/blob/master/.travis.yml) for a
127
+ list of currently-supported Ruby versions.)
115
128
 
116
129
  As of version 1.0.2, serializers are autoloaded. Thus it is no longer necessary to manually require them.
117
130
 
@@ -138,6 +151,10 @@ It's trivial to create a custom serializer. Implement the following two methods:
138
151
 
139
152
  * Aaron Suggs (github[http://github.com/ktheory])
140
153
 
154
+ == Maintainer
155
+
156
+ * Todd A. Jacobs (github[http://github.com/codegnome])
157
+
141
158
  == Contributors
142
159
 
143
160
  * Niklas E. Cathor (github[http://github.com/nilclass])
@@ -147,4 +164,4 @@ It's trivial to create a custom serializer. Implement the following two methods:
147
164
 
148
165
  == Copyright
149
166
 
150
- Copyright (c) 2010 Aaron Suggs. See LICENSE for details.
167
+ Copyright (c) 2010-2014 Aaron Suggs. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,7 +1,9 @@
1
+ require 'bundler/setup'
1
2
  require 'rake/testtask'
3
+ require 'bundler/gem_tasks'
4
+
2
5
  Rake::TestTask.new do |t|
3
- t.libs << "test"
4
- t.test_files = FileList['test/test*.rb']
6
+ t.pattern = "test/test_*.rb"
5
7
  t.verbose = true
6
8
  end
7
9
 
@@ -14,10 +14,11 @@ class Maildir
14
14
  include Comparable
15
15
 
16
16
  attr_reader :path
17
- attr_accessor :serializer
17
+ attr_writer :serializer
18
18
 
19
19
  # Default serializer.
20
- @@serializer = Maildir::Serializer::Base.new
20
+ DEFAULT_SERIALIZER = Maildir::Serializer::Base.new.freeze
21
+ @@serializer = DEFAULT_SERIALIZER
21
22
 
22
23
  # Gets the default serializer.
23
24
  def self.serializer
@@ -40,7 +41,7 @@ class Maildir
40
41
 
41
42
  # Returns own serializer or falls back to default.
42
43
  def serializer
43
- @serializer || @@serializer
44
+ @serializer ||= @@serializer
44
45
  end
45
46
 
46
47
  # Compare maildirs by their paths.
@@ -76,6 +77,14 @@ class Maildir
76
77
  end
77
78
 
78
79
  # Returns an arry of messages from :new or :cur directory, sorted by key.
80
+ # If options[:flags] is specified and directory is :cur, returns messages with flags specified
81
+ #
82
+ # E.g.
83
+ # maildir.list(:cur, :flags => 'F') # => lists all messages with flag 'F'
84
+ # maildir.list(:cur, :flags => 'FS') # => lists all messages with flag 'F' and 'S'; Flags must be specified in acending ASCII order ('FS' and not 'SF')
85
+ # maildir.list(:cur, :flags => '') # => lists all messages without any flags
86
+ # This option does not work for :new directory
87
+ #
79
88
  # If options[:limit] is specified, returns only so many keys.
80
89
  #
81
90
  # E.g.
@@ -86,7 +95,10 @@ class Maildir
86
95
  raise ArgumentError, "dir must be :new, :cur, or :tmp"
87
96
  end
88
97
 
89
- keys = get_dir_listing(dir)
98
+ # Set flags to filter messages
99
+ # Silently ignored if dir is :new
100
+ flags = (dir.to_sym == :cur) ? options[:flags] : nil
101
+ keys = get_dir_listing(dir, :flags => flags)
90
102
 
91
103
  # Sort the keys (chronological order)
92
104
  # TODO: make sorting configurable
@@ -127,8 +139,10 @@ class Maildir
127
139
 
128
140
  protected
129
141
  # Returns an array of keys in dir
130
- def get_dir_listing(dir)
131
- search_path = File.join(self.path, dir.to_s, '*')
142
+ def get_dir_listing(dir, options={})
143
+ filter = "*"
144
+ filter = "#{filter}:2,#{options[:flags]}" if options[:flags]
145
+ search_path = File.join(self.path, dir.to_s, filter)
132
146
  keys = Dir.glob(search_path)
133
147
  # Remove the maildir's path from the keys
134
148
  keys.each do |key|
@@ -41,7 +41,8 @@ class Maildir::Message
41
41
  def initialize(maildir, key=nil)
42
42
  @maildir = maildir
43
43
  if key.nil?
44
- @dir = :tmp
44
+ @dir = :tmp
45
+ @info = nil
45
46
  @unique_name = Maildir::UniqueName.create
46
47
  else
47
48
  parse_key(key)
@@ -119,7 +120,7 @@ class Maildir::Message
119
120
 
120
121
  # Returns an array of single letter flags applied to the message
121
122
  def flags
122
- @info.sub(INFO,'').split(//)
123
+ @info.to_s.sub(INFO,'').split(//)
123
124
  end
124
125
 
125
126
  # Sets the flags on a message.
@@ -134,10 +135,13 @@ class Maildir::Message
134
135
  self.flags = (flags << flag.upcase)
135
136
  end
136
137
 
137
- # Removes a flag from a message.
138
+ # Removes flags from a message.
138
139
  # Returns the message's key if successful, false otherwise.
139
- def remove_flag(flag)
140
- self.flags = flags.delete_if{|f| f == flag.upcase}
140
+ #
141
+ # flags:: String or Array
142
+ def remove_flag(flags)
143
+ return self.flags if !flags || flags.empty?
144
+ self.flags = self.flags.reject { |f| f =~ /[#{Array(flags).join}]/i }
141
145
  end
142
146
 
143
147
  # Returns the filename of the message
@@ -10,7 +10,9 @@ class Maildir
10
10
  class Base
11
11
  # Reads the file at path. Returns the contents of path.
12
12
  def load(path)
13
- File.read(path)
13
+ File.open(path,'rb') do |f|
14
+ f.read
15
+ end
14
16
  end
15
17
 
16
18
  # Writes data to path. Returns number of bytes written.
@@ -2,12 +2,15 @@
2
2
  class Maildir::UniqueName
3
3
  require 'thread' # For mutex support
4
4
  require 'socket' # For getting the hostname
5
+
6
+ COUNTER_MUTEX = Mutex.new
7
+
5
8
  class << self
6
9
  # Return a thread-safe increasing counter
7
10
  def counter
8
- @counter_mutex ||= Mutex.new
9
- @counter_mutex.synchronize do
10
- @counter = @counter.to_i + 1
11
+ COUNTER_MUTEX.synchronize do
12
+ @counter ||= 0
13
+ @counter = @counter.to_i.succ
11
14
  end
12
15
  end
13
16
 
@@ -37,7 +40,7 @@ class Maildir::UniqueName
37
40
  # The middle part contains the microsecond, the process id, and a
38
41
  # per-process incrementing counter
39
42
  def middle
40
- "M#{microsecond}P#{process_id}Q#{delivery_count}"
43
+ "M#{'%06d' % microsecond}P#{process_id}Q#{delivery_count}"
41
44
  end
42
45
 
43
46
  # The right part is the hostname
@@ -1,3 +1,3 @@
1
1
  class Maildir
2
- VERSION = '2.0.0'
2
+ VERSION = '2.2.3'
3
3
  end
@@ -0,0 +1,40 @@
1
+ require 'bundler/setup'
2
+ require 'minitest/autorun'
3
+ require 'minitest/pride'
4
+ require 'shoulda'
5
+ require 'maildir'
6
+
7
+ # Require all the serializers
8
+ serializers = File.expand_path('../../lib/maildir/serializer/*.rb', __FILE__)
9
+ Dir.glob(serializers).each do |serializer|
10
+ require serializer
11
+ end
12
+
13
+ class Minitest::Test
14
+ # Create a reusable maildir that's cleaned up when the tests are done
15
+ def temp_maildir
16
+ Maildir.new("/tmp/maildir_test")
17
+ end
18
+
19
+ def setup
20
+ # Wait until everything's loaded and tests are running to require FakeFS
21
+ require 'fakefs'
22
+ end
23
+
24
+ # create the subdir tree:
25
+ # | INBOX
26
+ # |-- a
27
+ # | |-- x
28
+ # | |-- y
29
+ # |-- b
30
+ def setup_subdirs(maildir)
31
+ %w(a b a.x a.y).each do |x|
32
+ Maildir.new(File.join(maildir.path, ".#{x}"))
33
+ end
34
+ end
35
+
36
+ # Test that objects are neither nil nor empty
37
+ def assert_not_empty(obj, msg='')
38
+ assert !obj.nil? && !obj.empty?, msg
39
+ end
40
+ end
@@ -1,5 +1,5 @@
1
- require 'test_helper'
2
- class TestMaildir < Test::Unit::TestCase
1
+ require_relative 'helper'
2
+ class TestMaildir < Minitest::Test
3
3
 
4
4
  context "A maildir" do
5
5
  setup do
@@ -53,12 +53,78 @@ class TestMaildir < Test::Unit::TestCase
53
53
  messages = temp_maildir.list(:new)
54
54
  assert_equal messages, [@message]
55
55
  end
56
+
57
+ context "cur message" do
58
+ should "list a cur message" do
59
+ @message = temp_maildir.add("")
60
+ @message.process
61
+ messages = temp_maildir.list(:cur)
62
+ assert_equal messages, [@message]
63
+ end
64
+
65
+ should "list and filter cur messages based on flags" do
66
+ @message = temp_maildir.add("")
67
+ @message.process
68
+
69
+ @flagged_message = temp_maildir.add("")
70
+ @flagged_message.process
71
+ @flagged_message.add_flag('F')
72
+
73
+ messages = temp_maildir.list(:cur, :flags => 'F')
74
+ assert_equal messages, [@flagged_message]
75
+ end
76
+
77
+ should "list and filter cur messages based on multiple flags" do
78
+ @message = temp_maildir.add("")
79
+ @message.process
80
+
81
+ @flagged_message = temp_maildir.add("")
82
+ @flagged_message.process
83
+ @flagged_message.add_flag('F')
84
+ @flagged_message.add_flag('S')
85
+
86
+ messages = temp_maildir.list(:cur, :flags => 'FS')
87
+ assert_equal messages, [@flagged_message]
88
+ end
89
+
90
+ should "list and filter cur messages without any flags" do
91
+ @message = temp_maildir.add("")
92
+ @message.process
93
+
94
+ @flagged_message = temp_maildir.add("")
95
+ @flagged_message.process
96
+ @flagged_message.add_flag('F')
97
+
98
+ messages = temp_maildir.list(:cur, :flags => '')
99
+ assert_equal messages, [@message]
100
+ end
101
+ end
102
+ end
103
+
104
+ context "multiple flags" do
105
+ should "be added in sorted order" do
106
+ sorted_flags = 'FS'
107
+ unsorted_flags = 'SF'
56
108
 
57
- should "list a cur message" do
58
109
  @message = temp_maildir.add("")
59
110
  @message.process
60
- messages = temp_maildir.list(:cur)
61
- assert_equal messages, [@message]
111
+ @message.add_flag(unsorted_flags)
112
+
113
+ assert_equal sorted_flags.split(''), @message.flags
114
+ end
115
+
116
+ should "be removed from flag list" do
117
+ flags_to_add = 'FSXYZ'
118
+ flags_to_remove = 'XYZ'
119
+ flags_remaining = 'FS'
120
+
121
+ @message = temp_maildir.add("")
122
+ @message.process
123
+ @message.add_flag(flags_to_add)
124
+ assert_equal flags_to_add.split(''), @message.flags
125
+
126
+ @message.remove_flag(flags_to_remove)
127
+ assert_equal flags_remaining.split(''), @message.flags
62
128
  end
63
129
  end
64
130
 
@@ -1,5 +1,5 @@
1
- require 'test_helper'
2
- class TestMessage < Test::Unit::TestCase
1
+ require_relative 'helper'
2
+ class TestMessage < Minitest::Test
3
3
 
4
4
  context "A message" do
5
5
  setup do
@@ -53,7 +53,7 @@ class TestMessage < Test::Unit::TestCase
53
53
  end
54
54
 
55
55
  should "not be writable" do
56
- assert_raise RuntimeError do
56
+ assert_raises RuntimeError do
57
57
  @message.write("nope!")
58
58
  end
59
59
  end
@@ -77,9 +77,18 @@ class TestMessage < Test::Unit::TestCase
77
77
  assert File.exists?(@message.path)
78
78
  end
79
79
 
80
+ # Detect order-dependent regressions when SEED=48094.
81
+ should "use the Base serializer" do
82
+ assert_equal Maildir::Serializer::Base, Maildir.serializer.class
83
+ end
84
+
80
85
  should "have the correct data" do
81
86
  assert_equal @data, @message.data
82
87
  end
88
+
89
+ should "have empty flags" do
90
+ assert_equal [], @message.flags
91
+ end
83
92
  end
84
93
 
85
94
  context "A processed message" do
@@ -91,7 +100,7 @@ class TestMessage < Test::Unit::TestCase
91
100
  end
92
101
 
93
102
  should "not be writable" do
94
- assert_raise RuntimeError do
103
+ assert_raises RuntimeError do
95
104
  @message.write("nope!")
96
105
  end
97
106
  end
@@ -108,7 +117,7 @@ class TestMessage < Test::Unit::TestCase
108
117
  info = "2,FRS"
109
118
  @message.info = "2,FRS"
110
119
  assert_equal @message.info, info
111
- assert_match /#{info}$/, @message.path
120
+ assert_match(/#{info}$/, @message.path)
112
121
  end
113
122
 
114
123
  should "add and remove flags" do
@@ -137,7 +146,7 @@ class TestMessage < Test::Unit::TestCase
137
146
  @message.flags = arg
138
147
  assert_equal results, @message.flags
139
148
  path_suffix = "#{Maildir::Message::INFO}#{results.join('')}"
140
- assert_match /#{path_suffix}$/, @message.path
149
+ assert_match(/#{path_suffix}$/, @message.path)
141
150
  end
142
151
  end
143
152
  end
@@ -176,14 +185,13 @@ class TestMessage < Test::Unit::TestCase
176
185
  end
177
186
 
178
187
  should "raise error for data" do
179
- assert_raise Errno::ENOENT do
188
+ assert_raises Errno::ENOENT do
180
189
  @message.data
181
190
  end
182
191
  assert @message.frozen?
183
192
  end
184
193
 
185
194
  should "not be processed" do
186
- old_key = @message.key
187
195
  assert_equal false, @message.process
188
196
  assert @message.frozen?
189
197
  end
@@ -204,9 +212,9 @@ class TestMessage < Test::Unit::TestCase
204
212
  should "differ" do
205
213
  @message1 = temp_maildir.add("")
206
214
  @message2 = temp_maildir.add("")
207
- assert_equal -1, @message1 <=> @message2
215
+ assert_equal(-1, @message1 <=> @message2)
208
216
  assert_equal 1, @message2 <=> @message1
209
- assert_not_equal @message1, @message2
217
+ refute_equal @message1, @message2
210
218
  end
211
219
  end
212
220
 
@@ -1,6 +1,5 @@
1
- require 'test_helper'
2
- class TestSerializers < Test::Unit::TestCase
3
-
1
+ require_relative 'helper'
2
+ class TestSerializers < Minitest::Test
4
3
 
5
4
  serializers = [
6
5
  # Test the base serializer with a string
@@ -35,6 +34,10 @@ class TestSerializers < Test::Unit::TestCase
35
34
  @message = temp_maildir.add(@data)
36
35
  end
37
36
 
37
+ teardown do
38
+ Maildir.serializer = Maildir::DEFAULT_SERIALIZER
39
+ end
40
+
38
41
  should "have the correct data" do
39
42
  assert_equal @data, @message.data
40
43
  end
@@ -1,5 +1,5 @@
1
- require 'test_helper'
2
- class TestUniqueName < Test::Unit::TestCase
1
+ require_relative 'helper'
2
+ class TestUniqueName < Minitest::Test
3
3
 
4
4
  context "A UniqueName" do
5
5
  setup do
@@ -17,18 +17,28 @@ class TestUniqueName < Test::Unit::TestCase
17
17
  end
18
18
 
19
19
  should "begin with timestamp" do
20
- assert_match /^#{@now.to_i}/, @name
20
+ assert_match(/^#{@now.to_i}/, @name)
21
21
  end
22
22
 
23
23
  should "end with hostname" do
24
- assert_match /#{Socket.gethostname}$/, @name
24
+ assert_match(/#{Socket.gethostname}$/, @name)
25
25
  end
26
26
 
27
27
  should "be unique when created in the same microsecond" do
28
28
  @new_name = Maildir::UniqueName.new
29
29
  # Set @now be identical in both UniqueName instances
30
30
  @new_name.send(:instance_variable_set, :@now, @now)
31
- assert_not_equal @name, @new_name.to_s
31
+ refute_equal @name, @new_name.to_s
32
+ end
33
+
34
+ should "be chronological" do
35
+ @name1 = Maildir::UniqueName.new
36
+ @name1.send(:instance_variable_set, :@now, Time.at(0.000009))
37
+
38
+ @name2 = Maildir::UniqueName.new
39
+ @name2.send(:instance_variable_set, :@now, Time.at(0.100000))
40
+
41
+ assert_operator @name2.to_s, :>, @name1.to_s
32
42
  end
33
43
 
34
44
  end
metadata CHANGED
@@ -1,123 +1,135 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maildir
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
5
- prerelease:
4
+ version: 2.2.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Aaron Suggs
9
- autorequire:
8
+ - Todd A. Jacobs
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-09 00:00:00.000000000Z
12
+ date:
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70101941878220 !ruby/object:Gem::Requirement
17
- none: false
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  requirements:
19
- - - ! '>='
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
20
  version: '0'
22
21
  type: :development
23
22
  prerelease: false
24
- version_requirements: *70101941878220
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
25
28
  - !ruby/object:Gem::Dependency
26
29
  name: shoulda
27
- requirement: &70101941877660 !ruby/object:Gem::Requirement
28
- none: false
30
+ requirement: !ruby/object:Gem::Requirement
29
31
  requirements:
30
- - - ! '>='
32
+ - - ">="
31
33
  - !ruby/object:Gem::Version
32
34
  version: '0'
33
35
  type: :development
34
36
  prerelease: false
35
- version_requirements: *70101941877660
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
36
42
  - !ruby/object:Gem::Dependency
37
43
  name: mail
38
- requirement: &70101941877140 !ruby/object:Gem::Requirement
39
- none: false
44
+ requirement: !ruby/object:Gem::Requirement
40
45
  requirements:
41
- - - ! '>='
46
+ - - ">="
42
47
  - !ruby/object:Gem::Version
43
48
  version: '0'
44
49
  type: :development
45
50
  prerelease: false
46
- version_requirements: *70101941877140
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
47
56
  - !ruby/object:Gem::Dependency
48
57
  name: json
49
- requirement: &70101941876660 !ruby/object:Gem::Requirement
50
- none: false
58
+ requirement: !ruby/object:Gem::Requirement
51
59
  requirements:
52
- - - ! '>='
60
+ - - ">="
53
61
  - !ruby/object:Gem::Version
54
62
  version: '0'
55
63
  type: :development
56
64
  prerelease: false
57
- version_requirements: *70101941876660
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
58
70
  - !ruby/object:Gem::Dependency
59
71
  name: fakefs
60
- requirement: &70101941876060 !ruby/object:Gem::Requirement
61
- none: false
72
+ requirement: !ruby/object:Gem::Requirement
62
73
  requirements:
63
- - - ! '>='
74
+ - - ">="
64
75
  - !ruby/object:Gem::Version
65
76
  version: 0.3.2
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *70101941876060
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 0.3.2
69
84
  description: A ruby library for reading and writing arbitrary messages in DJB's maildir
70
85
  format
71
- email: aaron@ktheory.com
86
+ email:
87
+ - aaron@ktheory.com
88
+ - spamivore+maildir.gem@codegnome.org
72
89
  executables: []
73
90
  extensions: []
74
91
  extra_rdoc_files: []
75
92
  files:
76
- - lib/maildir/message.rb
93
+ - lib/maildir.rb
94
+ - lib/maildir
95
+ - lib/maildir/serializer
77
96
  - lib/maildir/serializer/base.rb
78
97
  - lib/maildir/serializer/json.rb
79
- - lib/maildir/serializer/mail.rb
80
- - lib/maildir/serializer/marshal.rb
81
98
  - lib/maildir/serializer/yaml.rb
99
+ - lib/maildir/serializer/marshal.rb
100
+ - lib/maildir/serializer/mail.rb
101
+ - lib/maildir/message.rb
82
102
  - lib/maildir/unique_name.rb
83
103
  - lib/maildir/version.rb
84
- - lib/maildir.rb
85
104
  - LICENSE
86
105
  - README.rdoc
87
106
  - Rakefile
88
- - test/test_helper.rb
89
- - test/test_maildir.rb
90
- - test/test_message.rb
91
- - test/test_serializers.rb
92
- - test/test_unique_name.rb
93
107
  homepage: http://github.com/ktheory/maildir
94
108
  licenses: []
95
- post_install_message:
109
+ metadata: {}
110
+ post_install_message:
96
111
  rdoc_options:
97
- - --charset=UTF-8
112
+ - "--charset=UTF-8"
98
113
  require_paths:
99
114
  - lib
100
115
  required_ruby_version: !ruby/object:Gem::Requirement
101
- none: false
102
116
  requirements:
103
- - - ! '>='
117
+ - - ">="
104
118
  - !ruby/object:Gem::Version
105
- version: '0'
119
+ version: 2.0.0
106
120
  required_rubygems_version: !ruby/object:Gem::Requirement
107
- none: false
108
121
  requirements:
109
- - - ! '>='
122
+ - - ">="
110
123
  - !ruby/object:Gem::Version
111
124
  version: 1.3.5
112
125
  requirements: []
113
- rubyforge_project:
114
- rubygems_version: 1.8.7
115
- signing_key:
116
- specification_version: 3
126
+ rubygems_version: 3.1.2
127
+ signing_key:
128
+ specification_version: 4
117
129
  summary: Read & write messages in the maildir format
118
130
  test_files:
119
- - test/test_helper.rb
131
+ - test/helper.rb
120
132
  - test/test_maildir.rb
121
133
  - test/test_message.rb
122
- - test/test_serializers.rb
123
134
  - test/test_unique_name.rb
135
+ - test/test_serializers.rb
@@ -1,33 +0,0 @@
1
- require 'test/unit'
2
- require 'shoulda'
3
- require 'maildir'
4
-
5
- # Require all the serializers
6
- serializers = File.expand_path('../../lib/maildir/serializer/*.rb', __FILE__)
7
- Dir.glob(serializers).each do |serializer|
8
- require serializer
9
- end
10
-
11
- require 'fakefs'
12
-
13
- # Create a reusable maildir that's cleaned up when the tests are done
14
- def temp_maildir
15
- Maildir.new("/tmp/maildir_test")
16
- end
17
-
18
- # create the subdir tree:
19
- # | INBOX
20
- # |-- a
21
- # | |-- x
22
- # | |-- y
23
- # |-- b
24
- def setup_subdirs(maildir)
25
- %w(a b a.x a.y).each do |x|
26
- Maildir.new(File.join(maildir.path, ".#{x}"))
27
- end
28
- end
29
-
30
- # Test that objects are neither nil nor empty
31
- def assert_not_empty(obj, msg='')
32
- assert !obj.nil? && !obj.empty?, msg
33
- end