Skip to content

Commit

Permalink
Merge pull request #300 from sisimai/goodbye-v4-compatible-features
Browse files Browse the repository at this point in the history
Goodbye v4 compatible features
  • Loading branch information
azumakuniyuki authored Jun 28, 2024
2 parents 1dd03ad + 4b90a08 commit 1e144da
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 47 deletions.
5 changes: 4 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ RELEASE NOTES for Ruby version of Sisimai
- releases: "https://github.com/sisimai/rb-sisimai/releases"
- download: "https://rubygems.org/gems/sisimai"

v5.0.3p4
v5.0.3p5
---------------------------------------------------------------------------------------------------
- release: ""
- version: ""
- changes:
- #297 #300 Remove v4 compatible features
- `Sisimai.make()`
- `Sisimai::Fact.softbounce()`
- #292 #293 Implement `Sisimai::Lhost::DragonFly`
- Add 30 sample emails generated by DMA: DrangonFly Mail Agent (lhost-dragonfly-*.eml)
- #288 Consolidate error messages scattered under `Sisimai::Reason::*` into `Sisimai::Rhost::*`
Expand Down
6 changes: 0 additions & 6 deletions lib/sisimai.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ 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 decoding mailbox/maidir
# @param [String] argv0 Path to mbox or Maildir/
# @param [Hash] argv0 or Hash (decoded JSON)
Expand Down
9 changes: 0 additions & 9 deletions lib/sisimai/fact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,6 @@ def self.rise(**argvs)
return listoffact
end

# Emulate "softbounce" accessor for the backward compatible
# @return [Integer]
def softbounce
warn ' ***warning: Sisimai::Fact.softbounce will be removed at v5.1.0. Use Sisimai::Fact.hardbounce instead'
return 0 if self.hardbounce
return -1 if self.reason == 'delivered' || self.reason == 'feedback' || self.reason == 'vacation'
return 1
end

# Convert from Sisimai::Fact object to a Hash
# @return [Hash] Hashed data
def damn
Expand Down
17 changes: 0 additions & 17 deletions test/public/lhost-code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -499,23 +499,6 @@ def enginetest(enginename = nil, isexpected = {}, privateset = false, onlydebugs
assert_equal cy['timestamp'], rr.timestamp.to_json, sprintf("%s %s", ct, cy['timestamp'])
end

# ---------------------------------------------------------------------------------------
# SOFTBOUNCE
if false
cv = rr.softbounce
cr = %r/\A[-]?[01]\z/
ct = sprintf("%s [%s-%02d] #softbounce =", ce, e, errorindex)

assert_instance_of Integer, cv
refute_empty cv.to_s, sprintf("%s %s", ct, cv)
if %w[delivered feedback vacation].include?(rr.reason)
assert_equal -1, cv, sprintf("%s %s", ct, cv)
else
assert_equal 0, cv, sprintf("%s %s", ct, cv) if rr.hardbounce == true
assert_equal 1, cv, sprintf("%s %s", ct, cv) if rr.hardbounce == false
end
end

end # END OF Sisimai::Fact LIST
emailindex += 1
assert_equal true, errorindex > 0, sprintf("%s is including %d bounces", mailobject.data.path, errorindex)
Expand Down
15 changes: 1 addition & 14 deletions test/public/sisimai-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'json'

class SisimaiTest < Minitest::Test
Methods = { class: %w[version libname rise dump engine reason match make] }
Methods = { class: %w[version libname rise dump engine reason match] }
Samples = {
mailbox: './set-of-emails/mailbox/mbox-0',
maildir: './set-of-emails/maildir/bsd',
Expand Down Expand Up @@ -63,8 +63,6 @@ def test_rise
else
assert_instance_of Sisimai::Time, ee.timestamp
end

assert_respond_to ee, 'softbounce'
assert_respond_to ee, 'damn'

refute_empty ee.addresser.address
Expand Down Expand Up @@ -165,17 +163,6 @@ def test_rise
end
end

def test_make
# For the backward compatible
ce = assert_raises ArgumentError do
Sisimai.make()
Sisimai.make('/path/to/email', 1)
end
assert_match %r/wrong number of arguments/, ce.to_s
assert_nil Sisimai.make(nil)
assert_nil Sisimai.make(false)
end

def test_dump
ce = assert_raises ArgumentError do
Sisimai.dump()
Expand Down

0 comments on commit 1e144da

Please sign in to comment.