tmail 1.2.0 → 1.2.1

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.
Files changed (51) hide show
  1. data/CHANGES +11 -0
  2. data/NOTES +48 -38
  3. data/README +3 -2
  4. data/Rakefile +11 -0
  5. data/ext/Makefile +8 -8
  6. data/ext/{mailscanner → tmailscanner}/tmail/MANIFEST +1 -1
  7. data/ext/tmailscanner/tmail/depend +1 -0
  8. data/ext/{mailscanner → tmailscanner}/tmail/extconf.rb +1 -1
  9. data/ext/{mailscanner/tmail/mailscanner.c → tmailscanner/tmail/tmailscanner.c} +10 -10
  10. data/lib/tmail/address.rb +9 -1
  11. data/lib/tmail/encode.rb +1 -0
  12. data/lib/tmail/header.rb +34 -2
  13. data/lib/tmail/mailbox.rb +3 -3
  14. data/lib/tmail/quoting.rb +0 -24
  15. data/lib/tmail/scanner.rb +4 -4
  16. data/lib/tmail/scanner_r.rb +1 -1
  17. data/lib/tmail/utils.rb +2 -3
  18. data/lib/tmail/version.rb +1 -1
  19. data/log/ChangeLog.txt +22 -0
  20. data/log/History.txt +1 -1
  21. data/meta/MANIFEST +18 -8
  22. data/{script → meta}/config.yaml +1 -1
  23. data/meta/tmail.roll +3 -0
  24. data/script/clobber/distclean +1 -1
  25. data/script/compile +2 -2
  26. data/script/pack/gem +93 -0
  27. data/script/pack/tgz +41 -0
  28. data/script/pack/zip +41 -0
  29. data/script/prepare +6 -1
  30. data/script/publish +2 -2
  31. data/script/rdoc +42 -0
  32. data/script/release +1 -3
  33. data/script/stamp +33 -0
  34. data/script/test +1 -1
  35. data/test/fixtures/mailbox +13 -0
  36. data/test/fixtures/mailbox_without_any_from_or_sender +10 -0
  37. data/test/fixtures/mailbox_without_from +11 -0
  38. data/test/fixtures/mailbox_without_return_path +12 -0
  39. data/test/fixtures/raw_email11 +2 -2
  40. data/test/fixtures/raw_email_with_bad_date +5 -5
  41. data/test/test_address.rb +32 -2
  42. data/test/test_attachments.rb +15 -0
  43. data/test/test_encode.rb +54 -52
  44. data/test/test_header.rb +57 -0
  45. data/test/test_helper.rb +1 -0
  46. data/test/test_mail.rb +49 -1
  47. data/test/test_mbox.rb +21 -0
  48. data/test/test_quote.rb +71 -0
  49. metadata +173 -153
  50. data/ext/mailscanner/tmail/depend +0 -1
  51. data/meta/ROLLRC +0 -3
@@ -8,7 +8,7 @@
8
8
  * Closed 16025 - TMail scanner.rb would not parse ATOM chars correctly making it fail tests where the C version passed them. Fixed this by updating the Scanner.rb version to be in step with the C version (there was an extra @ symbol in the ATOM CHARS definition that was not in the C version.) (mikel)
9
9
  * Fixed scanner.rb so that it would pass the same tests that the C version does - had a sundry @ symbol inside of the ATOM CHARS
10
10
  * 3 minor enhancements:
11
- * Renamed scanner_c.c to mailscanner.c (trans)
11
+ * Renamed scanner_c.c to tmailscanner.c (trans)
12
12
  * Changed TMail::Mail#sender to have a default "default" value of nil to be in alignment with all the other interface methods (mikel)
13
13
  * Made base64_decode and base64_encode into ! versions as they are destructive on the mail body (encodes the body to base64 or decodes it), made aliases for base64_decode and base64_encode to point back to the bang versions. Doing this with a view to change base64_encode to a non destructive version (returns the encoded body) in future versions. (mikel)
14
14
 
@@ -5,12 +5,12 @@ NOTES
5
5
  README
6
6
  ext
7
7
  ext/Makefile
8
- ext/mailscanner
9
- ext/mailscanner/tmail
10
- ext/mailscanner/tmail/MANIFEST
11
- ext/mailscanner/tmail/depend
12
- ext/mailscanner/tmail/extconf.rb
13
- ext/mailscanner/tmail/mailscanner.c
8
+ ext/tmailscanner
9
+ ext/tmailscanner/tmail
10
+ ext/tmailscanner/tmail/MANIFEST
11
+ ext/tmailscanner/tmail/depend
12
+ ext/tmailscanner/tmail/extconf.rb
13
+ ext/tmailscanner/tmail/tmailscanner.c
14
14
  lib
15
15
  lib/tmail
16
16
  lib/tmail/Makefile
@@ -44,9 +44,10 @@ lib/tmail/version.rb
44
44
  lib/tmail.rb
45
45
  meta
46
46
  meta/MANIFEST
47
- meta/ROLLRC
47
+ meta/config.yaml
48
48
  meta/icli.yaml
49
49
  meta/project.yaml
50
+ meta/tmail.roll
50
51
  sample
51
52
  sample/bench_base64.rb
52
53
  sample/data
@@ -67,18 +68,26 @@ script/clobber
67
68
  script/clobber/distclean
68
69
  script/clobber/package
69
70
  script/compile
70
- script/config.yaml
71
+ script/pack
72
+ script/pack/gem
73
+ script/pack/tgz
74
+ script/pack/zip
71
75
  script/prepare
72
76
  script/publish
73
77
  script/rdoc
74
78
  script/release
75
79
  script/setup
80
+ script/stamp
76
81
  script/stats
77
82
  script/tag
78
83
  script/test
79
84
  test
80
85
  test/extctrl.rb
81
86
  test/fixtures
87
+ test/fixtures/mailbox
88
+ test/fixtures/mailbox_without_any_from_or_sender
89
+ test/fixtures/mailbox_without_from
90
+ test/fixtures/mailbox_without_return_path
82
91
  test/fixtures/raw_base64_decoded_string
83
92
  test/fixtures/raw_base64_email
84
93
  test/fixtures/raw_base64_encoded_string
@@ -114,5 +123,6 @@ test/test_helper.rb
114
123
  test/test_mail.rb
115
124
  test/test_mbox.rb
116
125
  test/test_port.rb
126
+ test/test_quote.rb
117
127
  test/test_scanner.rb
118
128
  test/test_utils.rb
@@ -4,5 +4,5 @@ publish:
4
4
 
5
5
  rdoc:
6
6
  output: doc/rdoc
7
- main: README.txt
7
+ main: README
8
8
 
@@ -0,0 +1,3 @@
1
+ tmail 1.2.1 stable 2007-12-25
2
+ lib/tmail
3
+ ext/tmailscanner/tmail
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ratch
2
2
 
3
3
  main :distclean do
4
- cd 'ext/mailscanner/tmail' do
4
+ cd 'ext/tmailscanner/tmail' do
5
5
  make 'distclean'
6
6
  end
7
7
  end
@@ -8,11 +8,11 @@ end
8
8
 
9
9
  task :compile_scanner do
10
10
  file = nil
11
- cd("ext/mailscanner/tmail") do
11
+ cd("ext/tmailscanner/tmail") do
12
12
  ruby "extconf.rb"
13
13
  make
14
14
 
15
- #file = glob("mailscanner.#{dlext}").first
15
+ #file = glob("tmailscanner.#{dlext}").first
16
16
  #file = File.expand_path(file) if file
17
17
  end
18
18
 
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env ratch
2
+
3
+ # generate gem package
4
+
5
+ # TODO: Should this use staging too, like zip/tgz?
6
+
7
+ begin
8
+ require 'rubygems/specification'
9
+ Gem::manage_gems
10
+ rescue LoadError
11
+ raise LoadError, "RubyGems is not installed?"
12
+ end
13
+
14
+ # Create a Gem package.
15
+
16
+ main 'pack/gem' do
17
+ status "Creating .gem package"
18
+
19
+ config = configuration['pack'] || {}
20
+ config = config['gem'] || {}
21
+
22
+ package = package().clone
23
+ package.update(config)
24
+
25
+ store = config[:store] || 'pkg'
26
+
27
+ #dir = Dir.pwd
28
+
29
+ file = nil
30
+ #cd(dir) do
31
+ #status "vi #{metadata.name}.gemspec"
32
+ builder = ::Gem::Builder.new(gemspec(package))
33
+ status "gem build #{package.name}"
34
+ unless dryrun?
35
+ file = builder.build
36
+ file = File.expand_path(file)
37
+ end
38
+ #end
39
+
40
+ transfer(file, store)
41
+ end
42
+
43
+ # Transfer package file to storage location.
44
+
45
+ def transfer(file, store)
46
+ dest = File.join(store, File.basename(file)) # move to store, unless already there
47
+ dest = File.expand_path(dest)
48
+ mv(file, store) unless file == dest
49
+ end
50
+
51
+ # Create Gem::Specification.
52
+
53
+ def gemspec(package)
54
+ distribute = package.filelist
55
+ #distribute = Dir.multiglob_with_default( '**/*', distribute )
56
+
57
+ ::Gem::Specification.new do |spec|
58
+ spec.name = package.name
59
+ spec.version = package.version
60
+ spec.summary = package.brief
61
+ spec.description = package.description
62
+ spec.author = [package.author].flatten
63
+ spec.email = package.email
64
+ spec.rubyforge_project = package.development if /rubyforge.org/ =~ package.development
65
+ spec.homepage = package.homepage
66
+
67
+ # Platform: ruby, mswin32, i586-linux, powerpc-darwin, current
68
+ spec.platform = 'ruby' # TODO current support!
69
+
70
+ spec.require_paths = [package.gem_path].flatten.reverse
71
+
72
+ #if package.platform != 'ruby'
73
+ # spec.require_paths.concat(spec.require_paths.collect{ |d| File.join(d, platform) })
74
+ #end
75
+
76
+ spec.bindir = "bin"
77
+ spec.executables = package.executables
78
+ spec.requirements = package.requirements
79
+ spec.has_rdoc = package.document
80
+
81
+ if package.dependencies
82
+ package.dependencies.each do |d,v|
83
+ spec.add_dependency(*[d,v].compact)
84
+ end
85
+ end
86
+
87
+ spec.extensions = package.compile
88
+
89
+ spec.files = distribute
90
+
91
+ spec.test_files = distribute.select{ |f| f =~ /^test\// } # TODO make test_files configurable
92
+ end
93
+ end
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ratch
2
+
3
+ # generate tar gzip package
4
+
5
+ main 'pack/tgz' do
6
+ status "Creating .tgz package"
7
+
8
+ config = configuration['pack'] || {}
9
+ config = config['tgz'] || {}
10
+
11
+ package = package().clone
12
+ package.update(config)
13
+
14
+ store = config[:store] || 'pkg'
15
+ templ = config[:template]
16
+
17
+ name = package.stage_name(templ)
18
+ stage = File.join(store, name)
19
+ files = package.filelist
20
+
21
+ stage(stage, files)
22
+
23
+ if dryrun?
24
+ status "tar -cxf #{name}.tgz"
25
+ else
26
+ file = nil
27
+ cd(store) do
28
+ file = tgz(name)
29
+ end
30
+ transfer(file, store)
31
+ end
32
+ end
33
+
34
+ # Transfer package file to storage location.
35
+
36
+ def transfer(file, store)
37
+ # move to store, unless already there
38
+ dest = File.join(store, File.basename(file))
39
+ dest = File.expand_path(dest)
40
+ mv(file, store) unless file == dest
41
+ end
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ratch
2
+
3
+ # generate zip package
4
+
5
+ main 'pack/zip' do
6
+ status "Creating .zip package"
7
+
8
+ config = configuration['pack'] || {}
9
+ config = config['zip'] || {}
10
+
11
+ package = package().clone
12
+ package.update(config)
13
+
14
+ store = config[:store] || 'pkg'
15
+ templ = config[:template]
16
+
17
+ name = package.stage_name(templ)
18
+ stage = File.join(store, name)
19
+ files = package.filelist
20
+
21
+ stage(stage, files)
22
+
23
+ if dryrun?
24
+ status "tar -cxf #{name}.zip"
25
+ else
26
+ file = nil
27
+ cd(store) do
28
+ file = zip(name)
29
+ end
30
+ transfer(file, store)
31
+ end
32
+ end
33
+
34
+ # Transfer package file to storage location.
35
+
36
+ def transfer(file, store)
37
+ # move to store, unless already there
38
+ dest = File.join(store, File.basename(file))
39
+ dest = File.expand_path(dest)
40
+ mv(file, store) unless file == dest
41
+ end
@@ -1,10 +1,15 @@
1
+ #!/usr/bin/env ratch
2
+
1
3
  # prepare for release
2
4
  #
3
5
  # This updates the manifest file
4
6
  # and generates the packages.
5
7
 
6
8
  main :prepare do
9
+ stamp
7
10
  manifest "up"
8
- box "up"
11
+ pack.gem
12
+ pack.zip
13
+ pack.tgz
9
14
  end
10
15
 
@@ -16,7 +16,7 @@ main :publish do
16
16
  exclude = %w{.svn}
17
17
 
18
18
  abort "no project" unless project
19
- abort "no username" unless username
19
+ abort "no username (you can also set RUBYFORGE_USERNAME evironament variable)" unless username
20
20
 
21
21
  if subdir
22
22
  destination = File.join(project, subdir)
@@ -27,7 +27,7 @@ main :publish do
27
27
  dir = source.chomp('/') + '/'
28
28
  url = "#{username}@rubyforge.org:/var/www/gforge-projects/#{destination}"
29
29
 
30
- op = ['-rLvz', '--delete'] # maybe -p ?
30
+ op = ['-rLvz', '--delete-after'] # maybe -p ?
31
31
 
32
32
  # add filter options. The commandline version didn't seem
33
33
  # to work, so I opted for creating an .rsync_filter file for
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ratch
2
+
3
+ # generate rdocs
4
+ #
5
+ # Generate Rdoc documentation. Settings are
6
+ # the same as the rdoc command's options.
7
+
8
+ main :rdoc do
9
+ # Load rdoc configuration.
10
+
11
+ config = configuration['rdoc']
12
+
13
+ config['op'] = config.delete('output') if config['output']
14
+
15
+ config = {
16
+ 'template' => 'html',
17
+ 'op' => 'doc/rdoc',
18
+ 'merge' => true,
19
+ 'inline-source' => true,
20
+ 'exclude' => %w{MANIFEST, Manifest.txt},
21
+ 'include' => %w{[A-Z]* lib ext}
22
+ }.update(config)
23
+
24
+ output = config['op']
25
+
26
+ # Check for parent directory.
27
+ # (Helps to ensure we're in the right place.)
28
+
29
+ dir!(File.dirname(output))
30
+
31
+ # Prepare command arguments.
32
+
33
+ vector = config.command_vector('include')
34
+
35
+ # Remove old rdocs, if any.
36
+
37
+ rm_r(output) if File.exist?(output)
38
+
39
+ # Document.
40
+
41
+ rdoc(*vector)
42
+ end
@@ -3,9 +3,7 @@
3
3
  # release packages
4
4
 
5
5
  main :release do
6
- fname = Dir.glob('meta/*.roll').first
7
- pname = File.basename(fname).chomp('.roll')
8
- name, version = *pname.split('-')
6
+ version = rollrc.version
9
7
 
10
8
  icli "rubyforge release --version=#{version}"
11
9
  end
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ratch
2
+
3
+ # update version stamps
4
+
5
+ # You can change these via the command line.
6
+ version = commandline['version'] || release.version
7
+ status = commandline['status'] || release.status
8
+
9
+ # Update ROLLRC file.
10
+
11
+ main :stamp do
12
+ if version != release.version or status != release.status
13
+ build release.file
14
+ end
15
+ end
16
+
17
+ #
18
+
19
+ file release.file do
20
+ w = ''
21
+ w << "#{release.name} #{version} #{status} #{Time.now.strftime('%Y-%m-%d')}"
22
+ w << " #{release.default}" if release.default
23
+ w << "\n"
24
+ w << release.libpath.join("\n")
25
+
26
+ if dryrun?
27
+ puts release.file + ":"
28
+ puts w
29
+ else
30
+ File.open(release.file, 'w'){|f| f << w}
31
+ puts "#{release.file} updated."
32
+ end
33
+ end
@@ -13,7 +13,7 @@ main :test do
13
13
 
14
14
  unless live
15
15
  $LOAD_PATH.unshift(File.expand_path('lib'))
16
- $LOAD_PATH.unshift(File.expand_path('ext/mailscanner')) unless pure
16
+ $LOAD_PATH.unshift(File.expand_path('ext/tmailscanner')) unless pure
17
17
  end
18
18
 
19
19
  if find
@@ -0,0 +1,13 @@
1
+ From mike@envelope_sender.com.au
2
+ Return-Path: <mikel@return_path.com>
3
+ Received: from mikel091a by oaamta05sl.mx.bigpond.com with SMTP id
4
+ <20071021093820.JFMT24025.oaamta05sl.mx.bigpond.com@mikel091a> for
5
+ <mikel@nowhere.com.else>; Sun, 21 Oct 2007 19:38:20 +1000
6
+ Date: Sun, 21 Oct 2007 19:38:13 +1000
7
+ From: Mikel Lindsaar <mikel@from_address.com>
8
+ To: Mikel <mikel@somewhere.com>
9
+ Message-Id: <009601c813c6$19df3510$0437d30a@mikel091a>
10
+ Subject: Testing outlook
11
+
12
+ Hello Mikel
13
+
@@ -0,0 +1,10 @@
1
+ Received: from mikel091a by oaamta05sl.mx.bigpond.com with SMTP id
2
+ <20071021093820.JFMT24025.oaamta05sl.mx.bigpond.com@mikel091a> for
3
+ <mikel@nowhere.com.else>; Sun, 21 Oct 2007 19:38:20 +1000
4
+ Date: Sun, 21 Oct 2007 19:38:13 +1000
5
+ To: Mikel <mikel@somewhere.com>
6
+ Message-Id: <009601c813c6$19df3510$0437d30a@mikel091a>
7
+ Subject: Testing outlook
8
+
9
+ Hello Mikel
10
+