Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sisimai::Fact #208

Merged
merged 129 commits into from
Feb 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
08b5879
Import Pull-Request sisimai/p5-sisimai#420 only lib/ directory
azumakuniyuki Dec 9, 2020
a3a8239
Fix invalid values
azumakuniyuki Dec 9, 2020
a5d97d8
Fix loop syntax
azumakuniyuki Dec 10, 2020
99b9d74
Fix super class name < ::DateTime
azumakuniyuki Dec 10, 2020
7ae053b
"catch" is not a method, is a key name
azumakuniyuki Dec 10, 2020
21e65e4
Sisimai::Message is a Module, remove "self" from def ...
azumakuniyuki Dec 10, 2020
4337d1b
HeaderIndex constant is needed in Sisimai::RFC5322
azumakuniyuki Dec 10, 2020
aa3748b
Fix syntax to fall a method
azumakuniyuki Dec 10, 2020
20c7bc6
Use String#downcase
azumakuniyuki Dec 10, 2020
e274d1d
Fix variable name in Sisimai::Address.new
azumakuniyuki Dec 10, 2020
13fb847
A method name and a variable name fixed in Sisimai::Fact.rise
azumakuniyuki Dec 10, 2020
34ed410
The argument of String#start_with? should be a String
azumakuniyuki Dec 10, 2020
9a411a5
Comment improvement
azumakuniyuki Dec 10, 2020
0932884
"rhost" is a key, is not a method of Sisimai::Fact object
azumakuniyuki Dec 10, 2020
b80387a
Comment updated
azumakuniyuki Dec 10, 2020
12230f5
"header" is a key, is not a method name of Sisimai::Message object
azumakuniyuki Dec 10, 2020
a27783a
"header" is a key, is not a method name of Sisimai::Message object
azumakuniyuki Dec 10, 2020
9ff99d2
Cancel commit a27783a
azumakuniyuki Dec 10, 2020
03539c3
In case of the value of deliverystatus returned by Sisimai::SMTP::Sta…
azumakuniyuki Dec 10, 2020
28516ea
Comment updated
azumakuniyuki Dec 10, 2020
e03fd52
Fixed module names: Sisimai::Address, Sisimai::RFC5322
azumakuniyuki Dec 10, 2020
6341dd2
Update comment: method name
azumakuniyuki Dec 22, 2020
dfd8b20
Fix arguments for Sisimai::String.token
azumakuniyuki Dec 22, 2020
9dcb19c
"cruby-test" target uses "minitest"
azumakuniyuki Dec 22, 2020
b237810
New test code for Sisimai::Address using Minitest
azumakuniyuki Dec 23, 2020
869a7e7
New test code for Sisimai using Minitest
azumakuniyuki Dec 23, 2020
7efe51c
Remove blank lines
azumakuniyuki Dec 31, 2020
4c3f83a
Use rake and Rakefile for "make test"
azumakuniyuki Dec 31, 2020
022911a
Test code for Sisimai::RFC2045 using minitest
azumakuniyuki Jan 12, 2021
83a27d0
Sisimai::RFC2045.decodeB returns nil if the argument is not a Base64 …
azumakuniyuki Jan 12, 2021
c8f754b
Add test code for ArgumentError
azumakuniyuki Jan 12, 2021
03ac949
Add test code for ArgumentError
azumakuniyuki Jan 12, 2021
369890c
Implement test code for Sisimai::String using minitest
azumakuniyuki Jan 12, 2021
c285ff0
The 1st argument has been changed to Boolean (from Integer)
azumakuniyuki Jan 13, 2021
b1481af
Follow commit c285ff0 (false)
azumakuniyuki Jan 13, 2021
b722715
The argument should be ::Integer at Sisimai::DateTime.second2tz
azumakuniyuki Jan 13, 2021
085efb2
Test code for Sisimai::DateTime using minitest
azumakuniyuki Jan 13, 2021
9baa67d
Test code for Sisimai::Time using minitest
azumakuniyuki Jan 13, 2021
ce572c3
Sisimai::Mail::STDIN#path returns "<STDIN>" string
azumakuniyuki Jan 13, 2021
f1232f4
Test code for Sisimai::Mail using minitest
azumakuniyuki Jan 13, 2021
33f52b3
Test code for Sisimai::Mail::Mbox using minitest
azumakuniyuki Jan 14, 2021
022f178
Check the value of "offset" at the end of the test
azumakuniyuki Jan 14, 2021
c1ff392
Test code for Sisimai::Mail::Maildir using minitest
azumakuniyuki Jan 14, 2021
009b084
[WIP] Test code except "read" method for Sisimai::Mail::STDIN using m…
azumakuniyuki Jan 14, 2021
005554b
Fix class name
azumakuniyuki Jan 14, 2021
3fffcac
Remove test code to check "handle" method
azumakuniyuki Jan 14, 2021
90bc7ae
Test code for Sisimai::Mail::Memory using minitest
azumakuniyuki Jan 14, 2021
ef802a6
Test code for Sisimai::SMTP using minitest
azumakuniyuki Jan 14, 2021
fdb818b
Test code for Sisimai::SMTP::Status using minitest
azumakuniyuki Jan 14, 2021
411440a
Test code for Sisimai::SMTP::Reply using minitest
azumakuniyuki Jan 14, 2021
9546f04
Returns nil if the argument is nil
azumakuniyuki Jan 14, 2021
a00796c
Test code for Sisimai::SMTP::Error using minitest
azumakuniyuki Jan 14, 2021
d4beb67
Each value returned from Sisimai::RFC5322.LONGFIELDS is true
azumakuniyuki Jan 16, 2021
0f1ad75
Test code for Sisimai::RFC5322 using minitest
azumakuniyuki Jan 16, 2021
3cc79be
Add space characters at code for checking the argument
azumakuniyuki Jan 16, 2021
d731c2d
Test code for Sisimai::RFC1894 using minitest
azumakuniyuki Jan 16, 2021
b690f2a
Remove unused method: Sisimai::Message#void
azumakuniyuki Jan 17, 2021
1c41542
Test code for Sisimai::Message using minitest
azumakuniyuki Jan 17, 2021
2b2280d
Check the value of "agent"
azumakuniyuki Jan 17, 2021
eb25faf
Test code for Sisimai::Order using minitest
azumakuniyuki Jan 17, 2021
fe7efdf
Remove "softbounce", use "hardbounce" instead
azumakuniyuki Jan 18, 2021
a545b7c
Test code for Sisimai::Lhost using minitest
azumakuniyuki Jan 18, 2021
ad6b8de
assert_equal true, require(path) sometimes fail...?
azumakuniyuki Jan 18, 2021
93bcce0
Test code for Sisimai::MDA using minitest
azumakuniyuki Jan 18, 2021
bd468cd
Test code for CRLF or CR emails on Sisimai using minitest
azumakuniyuki Jan 18, 2021
9342e4b
Each value returned from Sisimai::Reason.retry is true
azumakuniyuki Jan 18, 2021
8dab062
Test code for Sisimai::Reason using minitest
azumakuniyuki Jan 18, 2021
c7d1fa8
Test code for Sisimai::Reason::* using minitest
azumakuniyuki Jan 19, 2021
1967bbe
Remove unused constant: Methods
azumakuniyuki Jan 19, 2021
3729186
Returns nil when the value of "rhostclass" could not get
azumakuniyuki Jan 19, 2021
9d0560f
Test code for Sisimai::Rhost using minitest
azumakuniyuki Jan 19, 2021
42da8c0
Use refute_* method instead of assert_equal(true)
azumakuniyuki Jan 22, 2021
5308c42
Fix typo: deliverd => delivered
azumakuniyuki Jan 26, 2021
17a7b5a
Loop variable changed
azumakuniyuki Jan 26, 2021
655285c
Remove redundant space character
azumakuniyuki Jan 26, 2021
09454ca
Bug fix
azumakuniyuki Jan 26, 2021
47b2a9d
Shared code for testing Sisimai::Lhost modules
azumakuniyuki Jan 26, 2021
b083a45
Wrapper code for testing Sisimai::Lhost modules (calls lhost-code.rb)
azumakuniyuki Jan 26, 2021
862e797
Test code for Sisimai::Lhost::A* using minitest
azumakuniyuki Jan 26, 2021
263f42c
Bug fix for code to decide the value of pseudo deliverystatus
azumakuniyuki Jan 27, 2021
3330192
Test code for Sisimai::Lhost::B* using minitest
azumakuniyuki Jan 27, 2021
659494b
Fix bug in code to get the value of "Diagnostic-Code:" field which is…
azumakuniyuki Jan 27, 2021
624516c
Fix the value of "Diagnostic-Code:" field
azumakuniyuki Jan 27, 2021
417f12e
Fix code for getting the value of "Diagnostic-Code:" field
azumakuniyuki Jan 27, 2021
30c5ac9
Fix code for getting the value of SMTP status code("replycode")
azumakuniyuki Jan 27, 2021
46fde17
Test code for Sisimai::Lhost::[C-E]* using minitest
azumakuniyuki Jan 27, 2021
675926b
Test code for Sisimai::Lhost::[FGIK]* using minitest
azumakuniyuki Jan 27, 2021
c298b70
Fix bug in code for detecting the beginning of error messages
azumakuniyuki Jan 27, 2021
02445fd
Test code for Sisimai::Lhost::M* using minitest
azumakuniyuki Jan 27, 2021
830d508
Test code for Sisimai::Fact.softbounce disabled, update for files to …
azumakuniyuki Jan 27, 2021
997c05c
Test code for Sisimai::Lhost::[N-R]* using minitest
azumakuniyuki Jan 27, 2021
2507bf0
Update test code for checking a sample email file to be skipped
azumakuniyuki Jan 27, 2021
e69ff6d
Test code for Sisimai::Lhost::[SV]* using minitest
azumakuniyuki Jan 27, 2021
84dbc44
Test code for Sisimai::Lhost::Barracuda using minitest
azumakuniyuki Jan 27, 2021
b24b0cc
Test code for Sisimai::Lhost::PowerMTA using minitest
azumakuniyuki Jan 27, 2021
21538d0
Test code for Sisimai::Lhost::GoogleGroups using minitest
azumakuniyuki Jan 27, 2021
15c90fd
Test code for Sisimai::Lhost::[XYZ]* using minitest
azumakuniyuki Jan 27, 2021
3ae1fba
Fix typo: vacation
azumakuniyuki Jan 27, 2021
7d4c392
Add test code for Sisimai::RFC* and Sisimai::ARF as a Lhost
azumakuniyuki Jan 27, 2021
cbb1e46
Test code for Sisimai::RFC3834 using minitest
azumakuniyuki Jan 27, 2021
55eded2
Remove "Imported from" line
azumakuniyuki Jan 28, 2021
bae7035
Fix typo: recipienet => recipient
azumakuniyuki Jan 28, 2021
fd81a06
Test code for Sisimai::RFC3464 using minitest
azumakuniyuki Jan 28, 2021
acd71b8
Test code for Sisimai::ARF using minitest
azumakuniyuki Jan 28, 2021
7fd9793
[WIP] Other sample tests (target directories do not exist)
azumakuniyuki Jan 28, 2021
0b2df41
Fix typo: set-of-emails
azumakuniyuki Jan 28, 2021
5ec2714
Sub class name has been changed: PublicChildren
azumakuniyuki Jan 28, 2021
34f341f
Fix test code for getting the path to sample email
azumakuniyuki Jan 28, 2021
00c326b
Fix code for getting the value of "Diagnosic-Code:" field which is co…
azumakuniyuki Jan 29, 2021
69d5504
Fix bug in reason Type: (String)
azumakuniyuki Jan 29, 2021
6f4a9d5
Fix code for setting the value of "Status:" field
azumakuniyuki Jan 29, 2021
16649da
Fix code to delete lines after "\n\n" at Sisimai::RFC5322
azumakuniyuki Jan 29, 2021
acb7784
Code improvement for setting the value of "Status:" field
azumakuniyuki Jan 29, 2021
30a1173
Improved code for setting the value of "rhost" which includes "@" cha…
azumakuniyuki Jan 29, 2021
624be50
Some public sample for Sisimai::Rhost emails have been renamed
azumakuniyuki Feb 1, 2021
6dd7c14
Code improvement for splitting by message/rfc822 at Sisimai::RFC5322.…
azumakuniyuki Feb 1, 2021
d09d9db
Fix typo
azumakuniyuki Feb 1, 2021
5a6f7c6
Register new public samples for Sisimai::Rhost 624be50
azumakuniyuki Feb 1, 2021
19b744f
Strictly checks the value of "smtpagent"
azumakuniyuki Feb 1, 2021
33a35d6
Update assertion message
azumakuniyuki Feb 1, 2021
a33d835
Test code for Sisimai::Rhost::* using minitest
azumakuniyuki Feb 1, 2021
3b71504
Test for each file in set-of-emails/ directory using minitest
azumakuniyuki Feb 1, 2021
ee5830e
Test code for Sisimai::Lhost::* using minitest
azumakuniyuki Feb 1, 2021
560f3ff
Goodbye RSpec
azumakuniyuki Feb 1, 2021
8cd0c34
Remove Ruby 2.1-2.3, Add Ruby 2.7.0
azumakuniyuki Feb 2, 2021
a19df58
Update dependencies defined in gemspec files
azumakuniyuki Feb 6, 2021
c03aca6
Update each version of Ruby on Travis CI
azumakuniyuki Feb 6, 2021
d56ed7b
Require Ruby 2.2.0 or later
azumakuniyuki Feb 6, 2021
ce206ac
Require Ruby 2.4.0 or later
azumakuniyuki Feb 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 0 additions & 2 deletions .rspec

This file was deleted.

11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
language: ruby
rvm:
# See http://rubies.travis-ci.org for Precompiled Ruby Versions
- 2.1.1
- 2.2.4
# - 2.1.1
# - 2.2.10
# - 2.3.0
# - 2.4.0
- 2.4.9
# - 2.5.0
- 2.6.0
- 2.6.6
# - 2.7.0
# - jruby-9.0.5.0
# - jruby-9.1.9.0
before_install:
script:
- rake spec
- make user-test
sudo: false
notifications:
recipients:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ gemspec name: 'sisimai'

group :development, :test do
gem 'rake', :require => false
gem 'rspec', :require => false
gem 'minitest', :require => false
gem 'coveralls', :require => false
end

15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ RUBY ?= ruby
JRUBY ?= /usr/local/jr
RAKE ?= rake
MKDIR := mkdir -p
RSPEC := rspec -Ilib -f progress
CP := cp
RM := rm -f

DEPENDENCIES = bundle rake rspec
DEPENDENCIES = bundle rake minitest
.DEFAULT_GOAL = git-status
REPOS_TARGETS = git-status git-push git-commit-amend git-tag-list git-diff \
git-reset-soft git-rm-cached git-branch
Expand Down Expand Up @@ -57,18 +56,20 @@ release:
PATH="$(JRUBY)/bin:$$PATH" $(JRUBY)/bin/rake release; \
fi

test: cruby-test
test: user-test author-test
user-test:
rake publictest

author-test:
rake privatetest

check:
find lib -type f -exec grep --color -E ' $$' {} /dev/null \;
find lib -type f -exec grep --color -E '[;][ ]*$$' {} /dev/null \;

cruby-test:
$(RAKE) spec

jruby-test:
if [ -d "$(JRUBY)" ]; then \
PATH="$(JRUBY)/bin:$$PATH" LS_HEAP_SIZE='1024m' $(JRUBY)/bin/rake spec; \
PATH="$(JRUBY)/bin:$$PATH" LS_HEAP_SIZE='1024m' $(JRUBY)/bin/rake publictest; \
fi

patrol:
Expand Down
2 changes: 1 addition & 1 deletion README-JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ $ cd /usr/local/src
$ git clone https://github.com/sisimai/rb-sisimai.git
$ cd ./rb-sisimai
$ sudo make depend install-from-local
gem install bundle rake rspec coveralls
gem install bundle rake minitest coveralls
...
4 gems installed
bundle exec rake install
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ $ cd /usr/local/src
$ git clone https://github.com/sisimai/rb-sisimai.git
$ cd ./rb-sisimai
$ sudo make depend install-from-local
gem install bundle rake rspec coveralls
gem install bundle rake minitest coveralls
...
4 gems installed
bundle exec rake install
Expand Down
12 changes: 9 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
require 'rspec/core/rake_task'
require 'bundler/gem_helper'

if RUBY_PLATFORM =~ /java/
filename = 'sisimai-java'
else
filename = 'sisimai'
end
Bundler::GemHelper.install_tasks :name => filename
RSpec::Core::RakeTask.new(:spec)

task :default => :spec
task :default => :test
task :test => [:publictest, :privatetest]
task :publictest do
Dir.glob('./test/public/*-test.rb').each { |cf| require cf }
end
task :privatetest do
Dir.glob('./test/private/*-test.rb').each { |cf| require cf }
end

39 changes: 18 additions & 21 deletions lib/sisimai.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
# results. Sisimai is the system formerly known as bounceHammer 4, is the successor to bounceHammer.
require 'sisimai/version'
module Sisimai
# Imported from p5-Sisimail/lib/Sisimai.pm
class << self
def version(); return Sisimai::VERSION; end
def libname(); return 'Sisimai'; end

# Emulate "rise" method for the backward compatible
def make(argv0, **argv1)
warn ' ***warning: Sisimai.make will be removed at v5.1.0. Use Sisimai.rise instead';
return Sisimai.rise(argv0, **argv1)
end

# Wrapper method for parsing mailbox/maidir
# @param [String] argv0 Path to mbox or Maildir/
# @param [Hash] argv0 or Hash (decoded JSON)
Expand All @@ -16,46 +21,38 @@ def libname(); return 'Sisimai'; end
# @options argv1 [Array] c___ Proc object to a callback method for the message and each file
# @return [Array] Parsed objects
# @return [nil] nil if the argument was wrong or an empty array
def make(argv0, **argv1)
def rise(argv0, **argv1)
return nil unless argv0
require 'sisimai/data'
require 'sisimai/message'
require 'sisimai/mail'
require 'sisimai/fact'

list = []
return nil unless mail = Sisimai::Mail.new(argv0)
kind = mail.kind
c___ = argv1[:c___].is_a?(Array) ? argv1[:c___] : [nil, nil]
sisi = []

while r = mail.data.read do
# Read and parse each email file
args = { data: r, hook: c___[0] }
path = mail.data.path
sisi = []

mesg = Sisimai::Message.new(args)
unless mesg.void
# Sisimai::Message object was created successfully
args = { data: mesg, delivered: argv1[:delivered], origin: path }
sisi = Sisimai::Data.make(args)
end
args = { data: r, hook: c___[0], origin: path, delivered: argv1[:delivered] }
fact = Sisimai::Fact.rise(args) || []

if c___[1]
# Run the callback function specified with "c___" parameter of Sisimai.make
# after reading each email file in Maildir/ every time
args = { 'kind' => kind, 'mail' => r, 'path' => path, 'sisi' => sisi }
# Run the callback function specified with "c___" parameter of Sisimai.rise after reading
# each email file in Maildir/ every time
args = { 'kind' => kind, 'mail' => r, 'path' => path, 'fact' => fact }
begin
c___[1].call(args) if c___[1].is_a?(Proc)
rescue StandardError => ce
warn ' ***warning: Something is wrong in the second element of the ":c___":' << ce.to_s
end
end

list += sisi unless sisi.empty?
sisi += fact unless fact.empty?
end

return nil if list.empty?
return list
return nil if sisi.empty?
return sisi
end

# Wrapper method to parse mailbox/Maildir and dump as JSON
Expand All @@ -69,7 +66,7 @@ def make(argv0, **argv1)
def dump(argv0, **argv1)
return nil unless argv0

nyaan = Sisimai.make(argv0, argv1) || []
nyaan = Sisimai.rise(argv0, argv1) || []
if RUBY_PLATFORM.start_with?('java')
# java-based ruby environment like JRuby.
require 'jrjackson'
Expand Down