maildir 0.5.0 → 0.6.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.
- data/Rakefile +5 -0
- data/VERSION +1 -1
- data/lib/maildir/message.rb +4 -3
- data/lib/maildir/serializer/base.rb +1 -1
- data/lib/maildir/serializer/json.rb +1 -1
- data/lib/maildir/serializer/mail.rb +2 -2
- data/lib/maildir/serializer/marshal.rb +1 -1
- data/lib/maildir/serializer/yaml.rb +1 -1
- data/lib/maildir/subdirs.rb +2 -2
- data/lib/maildir.rb +1 -1
- data/maildir.gemspec +2 -2
- data/test/test_message.rb +26 -14
- data/test/test_unique_name.rb +1 -1
- metadata +2 -2
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/lib/maildir/message.rb
CHANGED
@@ -122,7 +122,7 @@ class Maildir::Message
|
|
122
122
|
|
123
123
|
# Returns an array of single letter flags applied to the message
|
124
124
|
def flags
|
125
|
-
@info.sub(INFO,'').split(
|
125
|
+
@info.sub(INFO,'').split(//)
|
126
126
|
end
|
127
127
|
|
128
128
|
# Sets the flags on a message.
|
@@ -180,10 +180,11 @@ class Maildir::Message
|
|
180
180
|
guard { File.mtime(path) }
|
181
181
|
end
|
182
182
|
|
183
|
-
# Deletes the message path and freezes the message object
|
183
|
+
# Deletes the message path and freezes the message object.
|
184
|
+
# Returns 1 if the file was destroyed, false if the file was missings.
|
184
185
|
def destroy
|
185
|
-
guard { File.delete(path) }
|
186
186
|
freeze
|
187
|
+
guard { File.delete(path) }
|
187
188
|
end
|
188
189
|
|
189
190
|
protected
|
data/lib/maildir/subdirs.rb
CHANGED
@@ -5,7 +5,7 @@ module Maildir::Subdirs
|
|
5
5
|
DELIM = '.'
|
6
6
|
|
7
7
|
def self.included(base)
|
8
|
-
base.instance_eval do
|
8
|
+
base.instance_eval do
|
9
9
|
alias_method :inspect_without_subdirs, :inspect
|
10
10
|
alias_method :inspect, :inspect_with_subdirs
|
11
11
|
end
|
@@ -39,7 +39,7 @@ module Maildir::Subdirs
|
|
39
39
|
@subdirs ||= root.subdirs(false).select { |md| subdir_parts(File.basename(md.path))[0..-2] == my_parts }
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
# Friendly inspect method
|
44
44
|
def inspect_with_subdirs
|
45
45
|
"#<#{self.class} path=#{@path} mailbox_path=#{mailbox_path}>"
|
data/lib/maildir.rb
CHANGED
data/maildir.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{maildir}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Aaron Suggs", "Niklas E. Cathor"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-28}
|
13
13
|
s.description = %q{A ruby library for reading and writing arbitrary messages in DJB's maildir format}
|
14
14
|
s.email = %q{aaron@ktheory.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/test/test_message.rb
CHANGED
@@ -129,18 +129,30 @@ class TestMessage < Test::Unit::TestCase
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
context "
|
132
|
+
context "Destroying a message" do
|
133
133
|
setup do
|
134
134
|
FakeFS::FileSystem.clear
|
135
135
|
@message = Maildir::Message.create(temp_maildir, "foo")
|
136
|
-
@message.destroy
|
137
136
|
end
|
138
|
-
|
137
|
+
|
138
|
+
should "freeze it" do
|
139
|
+
@message.destroy
|
139
140
|
assert @message.frozen?, "Message is not frozen"
|
140
141
|
end
|
141
|
-
|
142
|
+
|
143
|
+
should "delete the path" do
|
144
|
+
@message.destroy
|
142
145
|
assert !File.exists?(@message.path), "Message path exists"
|
143
146
|
end
|
147
|
+
|
148
|
+
should "return 1" do
|
149
|
+
assert_equal 1, @message.destroy
|
150
|
+
end
|
151
|
+
|
152
|
+
should "return false if the path doesn't exist" do
|
153
|
+
File.delete(@message.path)
|
154
|
+
assert_equal false, @message.destroy
|
155
|
+
end
|
144
156
|
end
|
145
157
|
|
146
158
|
context "A message with a bad path" do
|
@@ -213,14 +225,14 @@ class TestMessage < Test::Unit::TestCase
|
|
213
225
|
end
|
214
226
|
|
215
227
|
# atime not currently supported in FakeFS
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
228
|
+
should_eventually "update the messages atime" do
|
229
|
+
@message = temp_maildir.add("")
|
230
|
+
time = Time.now - 60
|
231
|
+
|
232
|
+
@message.utime(time, time)
|
233
|
+
|
234
|
+
# Time should be within 1 second of each other
|
235
|
+
assert_in_delta time, @message.atime, 1
|
236
|
+
end
|
225
237
|
end
|
226
|
-
end
|
238
|
+
end
|
data/test/test_unique_name.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maildir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Suggs
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-01-
|
13
|
+
date: 2010-01-28 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|