msgthr 1.2.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56db4fab8d4e41d33e1ed27c204951ef6cecda14043fcb63d6e6b801d587935d
4
- data.tar.gz: e221116c16f9eb8afbfaaa2e1e6f6e8217216f27f5ec9440d7a65e99221960ea
3
+ metadata.gz: 3f71ba28241da92db06de185e52be789597cdd41f3c138f6ab6e1b75c06450fc
4
+ data.tar.gz: c5c3d60a79603f1eeee436c6a7a93e505b4ac66ef5ccd7b86678e298e6f751c4
5
5
  SHA512:
6
- metadata.gz: 27c95fed5bfedc2bbc14cb19c2e42254337fb491730dfad26f4d59f7e6d9c5a7e90d81c1d0414ad746b7b8ad8267b061aef3f67740cf206e1aa8a8df4877954d
7
- data.tar.gz: ad141c93c430a0600ff00b7c504a3237682858abd4238b8820830348f54527674d662e81445470821b4c68cbeba4ffdc51a6b149cc8e0a1a720a1981337b1990
6
+ metadata.gz: 978e8c20322dae07355915e9e12c1fbb450b36a08bae3c76c5d9202fc27393a604c9af1f567ae0a9301ade48593df5fd4d8afdee2107df3f3e3b44363cf66ecc
7
+ data.tar.gz: 0a74be8f5ccad900ac1181b6db4b9e197c6f6956c7ef1af975883fa7f52c8b029e423c6d359155de889479e255ced3a284559be5da8c9a81bba8e607fbded80a
@@ -4,7 +4,7 @@ all::
4
4
  pkg = msgthr
5
5
  RUBY = ruby
6
6
  lib := lib
7
- VERSION := 1.2.0
7
+ VERSION := 1.2.2
8
8
  RSYNC_DEST := 80x24.org:/srv/80x24/msgthr/
9
9
 
10
10
  RSYNC = rsync
@@ -33,7 +33,7 @@ gem: $(pkggem)
33
33
  install-gem: $(pkggem)
34
34
  gem install --local $(CURDIR)/$<
35
35
 
36
- $(pkggem): .manifest
36
+ $(pkggem): .manifest NEWS
37
37
  VERSION=$(VERSION) gem build $(pkg).gemspec
38
38
  mkdir -p pkg
39
39
  mv $(@F) $@
@@ -47,12 +47,13 @@ pkg_extra :=
47
47
  package: $(pkggem)
48
48
 
49
49
  NEWS: .olddoc.yml
50
- $(OLDDOC) prepare
50
+ $(OLDDOC) prepare || echo 'See https://80x24.org/msgthr/NEWS' >$@
51
51
  LATEST: NEWS
52
52
 
53
53
  doc:: .document .olddoc.yml
54
54
  -find lib -type f -name '*.rbc' -exec rm -f '{}' ';'
55
55
  $(RM) -r doc
56
+ $(OLDDOC) prepare
56
57
  $(RDOC) -f oldweb
57
58
 
58
59
  # this requires GNU coreutils variants
@@ -183,7 +183,7 @@ class Msgthr
183
183
  end
184
184
 
185
185
  # set parent of this message to be the last element in refs
186
- if prev
186
+ if prev && !cur.has_descendent(prev)
187
187
  prev.add_child(cur)
188
188
  yield(prev, cur) if block_given?
189
189
  end
@@ -64,9 +64,10 @@ class Msgthr::Container
64
64
  end
65
65
 
66
66
  def has_descendent(child) # :nodoc:
67
- seen = Hash.new(0)
67
+ seen = {}
68
68
  while child
69
- return true if self == child || (seen[child] += 1) != 0
69
+ return true if self == child || seen[child]
70
+ seen[child] = true
70
71
  child = child.parent
71
72
  end
72
73
  false
@@ -3,8 +3,9 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  manifest = File.read('.manifest').split(/\n/)
6
+ manifest << 'NEWS' if File.exist?('NEWS')
6
7
  s.name = %q{msgthr}
7
- s.version = ENV['VERSION'] || '1.2.0'
8
+ s.version = ENV['VERSION'] || '1.2.2'
8
9
  s.authors = ['msgthr hackers']
9
10
  s.summary = 'container-agnostic, non-recursive message threading'
10
11
  s.description = File.read('README').split(/\n\n/)[1].strip
@@ -144,4 +144,34 @@ EOF
144
144
  assert_equal threads[2][0], '2'
145
145
  end
146
146
 
147
+ def test_no_lost_root
148
+ ids = [
149
+ [ 8, [] ],
150
+ [ 7, [8] ],
151
+ [ 6, [8, 7] ],
152
+ [ 3, [6, 7, 8] ],
153
+ [ 2, [6, 7, 8, 3] ],
154
+ [ 10, [8, 7, 6] ],
155
+ [ 9, [6, 3] ],
156
+ [ 5, [6, 7, 8, 3, 2] ],
157
+ [ 4, [2, 3] ],
158
+ [ 1, [2, 3, 4] ],
159
+ [ 'a', ],
160
+ [ 'b', ['a'] ],
161
+ ]
162
+ [ [ :forward, ids, 2 ],
163
+ [ :backwards, ids.reverse, 3 ],
164
+ [ :shuffle, ids.shuffle, nil ],
165
+ ].each do |desc,msgs,exp|
166
+ thr = Msgthr.new
167
+ msgs.each { |id| thr.add(id[0], id[1], id[0]) }
168
+ seen0 = nr = 0
169
+ thr.walk_thread do |level, _, _|
170
+ seen0 += 1 if level == 0
171
+ nr += 1
172
+ end
173
+ assert_equal nr, msgs.size, 'no lost messages'
174
+ assert_equal exp, seen0, "single root #{desc}" if exp
175
+ end
176
+ end
147
177
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgthr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - msgthr hackers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-25 00:00:00.000000000 Z
11
+ date: 2018-05-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Pure Ruby message threading based on the algorithm described by
@@ -25,6 +25,7 @@ files:
25
25
  - ".olddoc.yml"
26
26
  - COPYING
27
27
  - GNUmakefile
28
+ - NEWS
28
29
  - README
29
30
  - lib/msgthr.rb
30
31
  - lib/msgthr/container.rb
@@ -53,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
54
  version: '0'
54
55
  requirements: []
55
56
  rubyforge_project:
56
- rubygems_version: 2.7.3
57
+ rubygems_version: 2.7.6
57
58
  signing_key:
58
59
  specification_version: 4
59
60
  summary: container-agnostic, non-recursive message threading