maildir 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -30,3 +30,8 @@ desc "Run benchmarks"
30
30
  task :bench do
31
31
  load File.join(File.dirname(__FILE__), "benchmarks", "runner")
32
32
  end
33
+
34
+ desc "Remove trailing whitespace"
35
+ task :whitespace do
36
+ sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
37
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.6.0
@@ -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
@@ -17,4 +17,4 @@ module Maildir::Serializer
17
17
  File.open(path, "w") {|file| file.write(data)}
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -10,4 +10,4 @@ class Maildir::Serializer::JSON < Maildir::Serializer::Base
10
10
  def dump(data, path)
11
11
  super(data.to_json, path)
12
12
  end
13
- end
13
+ end
@@ -5,9 +5,9 @@ class Maildir::Serializer::Mail < Maildir::Serializer::Base
5
5
  def load(path)
6
6
  ::Mail.new(super(path))
7
7
  end
8
-
8
+
9
9
  # Write data to path as a Mail message.
10
10
  def dump(data, path)
11
11
  super(data.to_s, path)
12
12
  end
13
- end
13
+ end
@@ -9,4 +9,4 @@ class Maildir::Serializer::Marshal < Maildir::Serializer::Base
9
9
  def dump(data, path)
10
10
  super(::Marshal.dump(data), path)
11
11
  end
12
- end
12
+ end
@@ -10,4 +10,4 @@ class Maildir::Serializer::YAML < Maildir::Serializer::Base
10
10
  def dump(data, path)
11
11
  super(data.to_yaml, path)
12
12
  end
13
- end
13
+ end
@@ -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
@@ -111,4 +111,4 @@ class Maildir
111
111
  end
112
112
  require 'maildir/unique_name'
113
113
  require 'maildir/serializer/base'
114
- require 'maildir/message'
114
+ require 'maildir/message'
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.5.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-24}
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 "A destroyed message" do
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
- should "be frozen" do
137
+
138
+ should "freeze it" do
139
+ @message.destroy
139
140
  assert @message.frozen?, "Message is not frozen"
140
141
  end
141
- should "have a nonexistant path" do
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
- # should "update the messages atime" do
217
- # @message = temp_maildir.add("")
218
- # time = Time.now - 60
219
- #
220
- # @message.utime(time, time)
221
- #
222
- # # Time should be within 1 second of each other
223
- # assert_in_delta time, @message.atime, 1
224
- # end
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
@@ -40,4 +40,4 @@ class TestUniqueName < Test::Unit::TestCase
40
40
  assert_equal value1+1, value2
41
41
  end
42
42
  end
43
- end
43
+ end
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.5.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-24 00:00:00 -05:00
13
+ date: 2010-01-28 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency