sup 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/checks.yml +27 -39
  3. data/CONTRIBUTORS +3 -1
  4. data/History.txt +16 -3
  5. data/Manifest.txt +22 -0
  6. data/README.md +0 -1
  7. data/bin/sup-sync-back-maildir +1 -1
  8. data/contrib/nix/Gemfile +22 -0
  9. data/contrib/nix/Gemfile.lock +80 -0
  10. data/contrib/nix/README +7 -0
  11. data/contrib/nix/gem-install-shell.nix +12 -0
  12. data/contrib/nix/gemset.nix +339 -0
  13. data/contrib/nix/ruby2.4-Gemfile.lock +81 -0
  14. data/contrib/nix/ruby2.4-gemset.nix +309 -0
  15. data/contrib/nix/ruby2.4-shell.nix +30 -0
  16. data/contrib/nix/ruby2.5-Gemfile.lock +81 -0
  17. data/contrib/nix/ruby2.5-gemset.nix +309 -0
  18. data/contrib/nix/ruby2.5-shell.nix +30 -0
  19. data/contrib/nix/ruby2.6-Gemfile.lock +83 -0
  20. data/contrib/nix/ruby2.6-gemset.nix +319 -0
  21. data/contrib/nix/ruby2.6-shell.nix +30 -0
  22. data/contrib/nix/ruby2.7-shell.nix +23 -0
  23. data/contrib/nix/ruby3.0-shell.nix +23 -0
  24. data/contrib/nix/ruby3.1-shell.nix +23 -0
  25. data/contrib/nix/ruby3.2-shell.nix +23 -0
  26. data/contrib/nix/ruby3.3-shell.nix +23 -0
  27. data/contrib/nix/test-all-rubies.sh +6 -0
  28. data/doc/Hooks.txt +1 -1
  29. data/ext/mkrf_conf_xapian.rb +2 -2
  30. data/lib/sup/crypto.rb +1 -1
  31. data/lib/sup/index.rb +2 -2
  32. data/lib/sup/maildir.rb +1 -1
  33. data/lib/sup/mbox.rb +1 -1
  34. data/lib/sup/message.rb +2 -2
  35. data/lib/sup/modes/console_mode.rb +1 -1
  36. data/lib/sup/thread.rb +20 -20
  37. data/lib/sup/util.rb +3 -5
  38. data/lib/sup/version.rb +1 -1
  39. data/man/sup-add.1 +27 -27
  40. data/man/sup-config.1 +23 -19
  41. data/man/sup-dump.1 +28 -29
  42. data/man/sup-import-dump.1 +24 -20
  43. data/man/sup-psych-ify-config-files.1 +23 -19
  44. data/man/sup-recover-sources.1 +23 -19
  45. data/man/sup-sync-back-maildir.1 +23 -19
  46. data/man/sup-sync.1 +23 -19
  47. data/man/sup-tweak-labels.1 +23 -19
  48. data/man/sup.1 +23 -19
  49. data/shell.nix +1 -0
  50. data/test/integration/test_maildir.rb +3 -0
  51. data/test/integration/test_mbox.rb +3 -0
  52. data/test/integration/test_sup-sync-back-maildir.rb +40 -0
  53. data/test/test_header_parsing.rb +2 -2
  54. metadata +26 -3
@@ -0,0 +1,319 @@
1
+ {
2
+ ast = {
3
+ groups = ["default"];
4
+ platforms = [];
5
+ source = {
6
+ remotes = ["https://rubygems.org"];
7
+ sha256 = "04nc8x27hlzlrr5c2gn7mar4vdr0apw5xg22wp6m8dx3wqr04a0y";
8
+ type = "gem";
9
+ };
10
+ version = "2.4.2";
11
+ };
12
+ chronic = {
13
+ groups = ["default"];
14
+ platforms = [];
15
+ source = {
16
+ remotes = ["https://rubygems.org"];
17
+ sha256 = "1hrdkn4g8x7dlzxwb1rfgr8kw3bp4ywg5l4y4i9c2g5cwv62yvvn";
18
+ type = "gem";
19
+ };
20
+ version = "0.10.2";
21
+ };
22
+ coderay = {
23
+ groups = ["default"];
24
+ platforms = [];
25
+ source = {
26
+ remotes = ["https://rubygems.org"];
27
+ sha256 = "0jvxqxzply1lwp7ysn94zjhh57vc14mcshw1ygw14ib8lhc00lyw";
28
+ type = "gem";
29
+ };
30
+ version = "1.1.3";
31
+ };
32
+ gpgme = {
33
+ dependencies = ["mini_portile2"];
34
+ groups = ["default"];
35
+ platforms = [];
36
+ source = {
37
+ remotes = ["https://rubygems.org"];
38
+ sha256 = "010wr6nnifi952bx4v5c49q25yx1g8lhib5wiv2sg7bip3yvlyy8";
39
+ type = "gem";
40
+ };
41
+ version = "2.0.23";
42
+ };
43
+ highline = {
44
+ groups = ["default"];
45
+ platforms = [];
46
+ source = {
47
+ remotes = ["https://rubygems.org"];
48
+ sha256 = "0yclf57n2j3cw8144ania99h1zinf8q3f5zrhqa754j6gl95rp9d";
49
+ type = "gem";
50
+ };
51
+ version = "2.0.3";
52
+ };
53
+ json = {
54
+ groups = ["default"];
55
+ platforms = [];
56
+ source = {
57
+ remotes = ["https://rubygems.org"];
58
+ sha256 = "0yk5d10yvspkc5jyvx9gc1a9pn1z8v4k2hvjk1l88zixwf3wf3cl";
59
+ type = "gem";
60
+ };
61
+ version = "2.6.2";
62
+ };
63
+ locale = {
64
+ groups = ["default"];
65
+ platforms = [];
66
+ source = {
67
+ remotes = ["https://rubygems.org"];
68
+ sha256 = "0997465kxvpxm92fiwc2b16l49mngk7b68g5k35ify0m3q0yxpdn";
69
+ type = "gem";
70
+ };
71
+ version = "2.1.3";
72
+ };
73
+ lockfile = {
74
+ groups = ["default"];
75
+ platforms = [];
76
+ source = {
77
+ remotes = ["https://rubygems.org"];
78
+ sha256 = "0dij3ijywylvfgrpi2i0k17f6w0wjhnjjw0k9030f54z56cz7jrr";
79
+ type = "gem";
80
+ };
81
+ version = "2.1.3";
82
+ };
83
+ method_source = {
84
+ groups = ["default"];
85
+ platforms = [];
86
+ source = {
87
+ remotes = ["https://rubygems.org"];
88
+ sha256 = "1pnyh44qycnf9mzi1j6fywd5fkskv3x7nmsqrrws0rjn5dd4ayfp";
89
+ type = "gem";
90
+ };
91
+ version = "1.0.0";
92
+ };
93
+ mime-types = {
94
+ dependencies = ["mime-types-data"];
95
+ groups = ["default"];
96
+ platforms = [];
97
+ source = {
98
+ remotes = ["https://rubygems.org"];
99
+ sha256 = "0ipw892jbksbxxcrlx9g5ljq60qx47pm24ywgfbyjskbcl78pkvb";
100
+ type = "gem";
101
+ };
102
+ version = "3.4.1";
103
+ };
104
+ mime-types-data = {
105
+ groups = ["default"];
106
+ platforms = [];
107
+ source = {
108
+ remotes = ["https://rubygems.org"];
109
+ sha256 = "003gd7mcay800k2q4pb2zn8lwwgci4bhi42v2jvlidm8ksx03i6q";
110
+ type = "gem";
111
+ };
112
+ version = "3.2022.0105";
113
+ };
114
+ mini_portile2 = {
115
+ groups = ["default"];
116
+ platforms = [];
117
+ source = {
118
+ remotes = ["https://rubygems.org"];
119
+ sha256 = "1kl9c3kdchjabrihdqfmcplk3lq4cw1rr9f378y6q22qwy5dndvs";
120
+ type = "gem";
121
+ };
122
+ version = "2.8.5";
123
+ };
124
+ minitest = {
125
+ groups = ["default"];
126
+ platforms = [];
127
+ source = {
128
+ remotes = ["https://rubygems.org"];
129
+ sha256 = "14a9ign0hj3z3j4cpfplj2djaskx3skzyx4fl3x53d7saxmhrgn1";
130
+ type = "gem";
131
+ };
132
+ version = "5.16.2";
133
+ };
134
+ ncursesw = {
135
+ groups = ["default"];
136
+ platforms = [];
137
+ source = {
138
+ remotes = ["https://rubygems.org"];
139
+ sha256 = "0qlfhp9b445g0qp9kkdiylfjlpfzrv6nqvry4ar6y0yacn0zr5y8";
140
+ type = "gem";
141
+ };
142
+ version = "1.4.11";
143
+ };
144
+ optimist = {
145
+ groups = ["default"];
146
+ platforms = [];
147
+ source = {
148
+ remotes = ["https://rubygems.org"];
149
+ sha256 = "1vg2chy1cfmdj6c1gryl8zvjhhmb3plwgyh1jfnpq4fnfqv7asrk";
150
+ type = "gem";
151
+ };
152
+ version = "3.0.1";
153
+ };
154
+ parallel = {
155
+ groups = ["default"];
156
+ platforms = [];
157
+ source = {
158
+ remotes = ["https://rubygems.org"];
159
+ sha256 = "07vnk6bb54k4yc06xnwck7php50l09vvlw1ga8wdz0pia461zpzb";
160
+ type = "gem";
161
+ };
162
+ version = "1.22.1";
163
+ };
164
+ parser = {
165
+ dependencies = ["ast"];
166
+ groups = ["default"];
167
+ platforms = [];
168
+ source = {
169
+ remotes = ["https://rubygems.org"];
170
+ sha256 = "0xhfghgidj8cbdnqp01f7kvnrv1f60izpkd9dhxsvpdzkfsdg97d";
171
+ type = "gem";
172
+ };
173
+ version = "3.1.2.0";
174
+ };
175
+ pry = {
176
+ dependencies = ["coderay" "method_source"];
177
+ groups = ["default"];
178
+ platforms = [];
179
+ source = {
180
+ remotes = ["https://rubygems.org"];
181
+ sha256 = "0m445x8fwcjdyv2bc0glzss2nbm1ll51bq45knixapc7cl3dzdlr";
182
+ type = "gem";
183
+ };
184
+ version = "0.14.1";
185
+ };
186
+ rainbow = {
187
+ groups = ["default"];
188
+ platforms = [];
189
+ source = {
190
+ remotes = ["https://rubygems.org"];
191
+ sha256 = "0smwg4mii0fm38pyb5fddbmrdpifwv22zv3d3px2xx497am93503";
192
+ type = "gem";
193
+ };
194
+ version = "3.1.1";
195
+ };
196
+ rake = {
197
+ groups = ["default"];
198
+ platforms = [];
199
+ source = {
200
+ remotes = ["https://rubygems.org"];
201
+ sha256 = "15whn7p9nrkxangbs9hh75q585yfn66lv0v2mhj6q6dl6x8bzr2w";
202
+ type = "gem";
203
+ };
204
+ version = "13.0.6";
205
+ };
206
+ regexp_parser = {
207
+ groups = ["default"];
208
+ platforms = [];
209
+ source = {
210
+ remotes = ["https://rubygems.org"];
211
+ sha256 = "1rfd3q17p7q7pa67844q8b16ipy6ksh8mkzynpm1zldqbb9x4xm0";
212
+ type = "gem";
213
+ };
214
+ version = "2.5.0";
215
+ };
216
+ rexml = {
217
+ groups = ["default"];
218
+ platforms = [];
219
+ source = {
220
+ remotes = ["https://rubygems.org"];
221
+ sha256 = "08ximcyfjy94pm1rhcx04ny1vx2sk0x4y185gzn86yfsbzwkng53";
222
+ type = "gem";
223
+ };
224
+ version = "3.2.5";
225
+ };
226
+ rmail = {
227
+ groups = ["default"];
228
+ platforms = [];
229
+ source = {
230
+ remotes = ["https://rubygems.org"];
231
+ sha256 = "0m5npkmv764m725wzjzasgf3k8q5anf3vfr6k2cac1xj6jc8lcqi";
232
+ type = "gem";
233
+ };
234
+ version = "1.1.4";
235
+ };
236
+ rr = {
237
+ groups = ["default"];
238
+ platforms = [];
239
+ source = {
240
+ remotes = ["https://rubygems.org"];
241
+ sha256 = "1n9g78ba4c2zzmz8cdb97c38h1xm0clircag00vbcxwqs4dq0ymp";
242
+ type = "gem";
243
+ };
244
+ version = "1.2.1";
245
+ };
246
+ rubocop = {
247
+ dependencies = ["json" "parallel" "parser" "rainbow" "regexp_parser" "rexml" "rubocop-ast" "ruby-progressbar" "unicode-display_width"];
248
+ groups = ["default"];
249
+ platforms = [];
250
+ source = {
251
+ remotes = ["https://rubygems.org"];
252
+ sha256 = "09k371m1l177ca8w70hfbjb1w0hasfb46pxp4w6yw92kk71akll2";
253
+ type = "gem";
254
+ };
255
+ version = "1.32.0";
256
+ };
257
+ rubocop-ast = {
258
+ dependencies = ["parser"];
259
+ groups = ["default"];
260
+ platforms = [];
261
+ source = {
262
+ remotes = ["https://rubygems.org"];
263
+ sha256 = "0h8q3gwqs8afshjd2l52ywf48md9rskr3q2y4fydgm536vvahjgm";
264
+ type = "gem";
265
+ };
266
+ version = "1.19.1";
267
+ };
268
+ rubocop-packaging = {
269
+ dependencies = ["rubocop"];
270
+ groups = ["default"];
271
+ platforms = [];
272
+ source = {
273
+ remotes = ["https://rubygems.org"];
274
+ sha256 = "0bzjd1077v96pyp62jg7s8ndxqbdhfnrdpdnmgi7h88xw22fp5xf";
275
+ type = "gem";
276
+ };
277
+ version = "0.5.1";
278
+ };
279
+ ruby-progressbar = {
280
+ groups = ["default"];
281
+ platforms = [];
282
+ source = {
283
+ remotes = ["https://rubygems.org"];
284
+ sha256 = "02nmaw7yx9kl7rbaan5pl8x5nn0y4j5954mzrkzi9i3dhsrps4nc";
285
+ type = "gem";
286
+ };
287
+ version = "1.11.0";
288
+ };
289
+ unicode = {
290
+ groups = ["default"];
291
+ platforms = [];
292
+ source = {
293
+ remotes = ["https://rubygems.org"];
294
+ sha256 = "1v8kxmq9i85agjpl7pnl72688901xhs8wxhmj6lpy16a8xz3nzxk";
295
+ type = "gem";
296
+ };
297
+ version = "0.4.4.4";
298
+ };
299
+ unicode-display_width = {
300
+ groups = ["default"];
301
+ platforms = [];
302
+ source = {
303
+ remotes = ["https://rubygems.org"];
304
+ sha256 = "1nlfck6z986fngp0r74maswmyb1rcksc8xc3mfpw9cj23c3s8zwn";
305
+ type = "gem";
306
+ };
307
+ version = "2.2.0";
308
+ };
309
+ xapian-ruby = {
310
+ groups = ["default"];
311
+ platforms = [];
312
+ source = {
313
+ remotes = ["https://rubygems.org"];
314
+ sha256 = "1z8arjkd0nlj6zv9in2sihmbwpbd17a10lsv7nwii7z0jjscyxpp";
315
+ type = "gem";
316
+ };
317
+ version = "1.4.18";
318
+ };
319
+ }
@@ -0,0 +1,30 @@
1
+ let
2
+ pkgs = import (builtins.fetchGit {
3
+ url = "https://github.com/NixOS/nixpkgs";
4
+ ref = "refs/heads/master";
5
+ rev = "3ef1d2a9602c18f8742e1fb63d5ae9867092e3d6";
6
+ }) {};
7
+ gems = pkgs.bundlerEnv {
8
+ name = "ruby2.6-gems-for-sup";
9
+ ruby = pkgs.ruby_2_6;
10
+ gemfile = ./Gemfile;
11
+ lockfile = ./ruby2.6-Gemfile.lock;
12
+ gemset = ./ruby2.6-gemset.nix;
13
+ gemConfig = pkgs.defaultGemConfig // {
14
+ # Workaround for a new error in clang 16 (MacOS):
15
+ # https://github.com/blackwinter/unicode/pull/11
16
+ unicode = attrs: {
17
+ buildFlags = [
18
+ "--with-cflags=-Wno-incompatible-function-pointer-types"
19
+ ];
20
+ };
21
+ # Workaround: remove rake from nativeBuildInputs, otherwise it causes
22
+ # xapian-bindings to build against the default Ruby version
23
+ # instead of our chosen version.
24
+ xapian-ruby = attrs: pkgs.defaultGemConfig.xapian-ruby attrs // {
25
+ dependencies = [ "rake" ];
26
+ nativeBuildInputs = [ pkgs.pkg-config ];
27
+ };
28
+ };
29
+ };
30
+ in pkgs.mkShell { packages = [ gems gems.wrappedRuby pkgs.pandoc ]; }
@@ -0,0 +1,23 @@
1
+ let
2
+ pkgs = import (builtins.fetchGit {
3
+ url = "https://github.com/NixOS/nixpkgs";
4
+ ref = "refs/heads/master";
5
+ rev = "402cc3633cc60dfc50378197305c984518b30773";
6
+ }) {};
7
+ gems = pkgs.bundlerEnv {
8
+ name = "ruby2.7-gems-for-sup";
9
+ ruby = pkgs.ruby_2_7;
10
+ gemfile = ./Gemfile;
11
+ lockfile = ./Gemfile.lock;
12
+ gemset = ./gemset.nix;
13
+ gemConfig = pkgs.defaultGemConfig // {
14
+ # Workaround for a new error in clang 16 (MacOS):
15
+ # https://github.com/blackwinter/unicode/pull/11
16
+ unicode = attrs: {
17
+ buildFlags = [
18
+ "--with-cflags=-Wno-incompatible-function-pointer-types"
19
+ ];
20
+ };
21
+ };
22
+ };
23
+ in pkgs.mkShell { packages = [ gems gems.wrappedRuby pkgs.pandoc ]; }
@@ -0,0 +1,23 @@
1
+ let
2
+ pkgs = import (builtins.fetchGit {
3
+ url = "https://github.com/NixOS/nixpkgs";
4
+ ref = "refs/heads/master";
5
+ rev = "402cc3633cc60dfc50378197305c984518b30773";
6
+ }) {};
7
+ gems = pkgs.bundlerEnv {
8
+ name = "ruby3.0-gems-for-sup";
9
+ ruby = pkgs.ruby_3_0;
10
+ gemfile = ./Gemfile;
11
+ lockfile = ./Gemfile.lock;
12
+ gemset = ./gemset.nix;
13
+ gemConfig = pkgs.defaultGemConfig // {
14
+ # Workaround for a new error in clang 16 (MacOS):
15
+ # https://github.com/blackwinter/unicode/pull/11
16
+ unicode = attrs: {
17
+ buildFlags = [
18
+ "--with-cflags=-Wno-incompatible-function-pointer-types"
19
+ ];
20
+ };
21
+ };
22
+ };
23
+ in pkgs.mkShell { packages = [ gems gems.wrappedRuby pkgs.pandoc ]; }
@@ -0,0 +1,23 @@
1
+ let
2
+ pkgs = import (builtins.fetchGit {
3
+ url = "https://github.com/NixOS/nixpkgs";
4
+ ref = "refs/heads/master";
5
+ rev = "0e2ba0d131331e318eba20fcb03db0372dc2a926";
6
+ }) {};
7
+ gems = pkgs.bundlerEnv {
8
+ name = "ruby3.1-gems-for-sup";
9
+ ruby = pkgs.ruby_3_1;
10
+ gemfile = ./Gemfile;
11
+ lockfile = ./Gemfile.lock;
12
+ gemset = ./gemset.nix;
13
+ gemConfig = pkgs.defaultGemConfig // {
14
+ # Workaround for a new error in clang 16 (MacOS):
15
+ # https://github.com/blackwinter/unicode/pull/11
16
+ unicode = attrs: {
17
+ buildFlags = [
18
+ "--with-cflags=-Wno-incompatible-function-pointer-types"
19
+ ];
20
+ };
21
+ };
22
+ };
23
+ in pkgs.mkShell { packages = [ gems gems.wrappedRuby pkgs.pandoc ]; }
@@ -0,0 +1,23 @@
1
+ let
2
+ pkgs = import (builtins.fetchGit {
3
+ url = "https://github.com/NixOS/nixpkgs";
4
+ ref = "refs/heads/master";
5
+ rev = "0e2ba0d131331e318eba20fcb03db0372dc2a926";
6
+ }) {};
7
+ gems = pkgs.bundlerEnv {
8
+ name = "ruby3.2-gems-for-sup";
9
+ ruby = pkgs.ruby_3_2;
10
+ gemfile = ./Gemfile;
11
+ lockfile = ./Gemfile.lock;
12
+ gemset = ./gemset.nix;
13
+ gemConfig = pkgs.defaultGemConfig // {
14
+ # Workaround for a new error in clang 16 (MacOS):
15
+ # https://github.com/blackwinter/unicode/pull/11
16
+ unicode = attrs: {
17
+ buildFlags = [
18
+ "--with-cflags=-Wno-incompatible-function-pointer-types"
19
+ ];
20
+ };
21
+ };
22
+ };
23
+ in pkgs.mkShell { packages = [ gems gems.wrappedRuby pkgs.pandoc ]; }
@@ -0,0 +1,23 @@
1
+ let
2
+ pkgs = import (builtins.fetchGit {
3
+ url = "https://github.com/NixOS/nixpkgs";
4
+ ref = "refs/heads/master";
5
+ rev = "0e2ba0d131331e318eba20fcb03db0372dc2a926";
6
+ }) {};
7
+ gems = pkgs.bundlerEnv {
8
+ name = "ruby3.3-gems-for-sup";
9
+ ruby = pkgs.ruby_3_3;
10
+ gemfile = ./Gemfile;
11
+ lockfile = ./Gemfile.lock;
12
+ gemset = ./gemset.nix;
13
+ gemConfig = pkgs.defaultGemConfig // {
14
+ # Workaround for a new error in clang 16 (MacOS):
15
+ # https://github.com/blackwinter/unicode/pull/11
16
+ unicode = attrs: {
17
+ buildFlags = [
18
+ "--with-cflags=-Wno-incompatible-function-pointer-types"
19
+ ];
20
+ };
21
+ };
22
+ };
23
+ in pkgs.mkShell { packages = [ gems gems.wrappedRuby pkgs.pandoc ]; }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+ cd "$(dirname "$0")/../.."
4
+ for rubyversion in 2.4 2.5 2.6 2.7 3.0 3.1 3.2 ; do
5
+ nix-shell contrib/nix/ruby$rubyversion-shell.nix --run 'rake ci'
6
+ done
data/doc/Hooks.txt CHANGED
@@ -69,7 +69,7 @@ startup:
69
69
  set 'bgtask_pid' @bgtask_pid
70
70
  Process.detach(@bgtask_pid) # so we don't have to wait on it when we go to kill it
71
71
  else
72
- exec "background-task args 2&>1 >> /tmp/logfile"
72
+ exec "background-task args 2>&1 >> /tmp/logfile"
73
73
  end
74
74
 
75
75
  after-poll:
@@ -14,7 +14,7 @@ destination = File.writable?(Gem.dir) ? Gem.dir : Gem.user_dir
14
14
  inst = Gem::DependencyInstaller.new(:install_dir => destination)
15
15
  begin
16
16
 
17
- if !RbConfig::CONFIG['arch'].include?('openbsd')
17
+ if not ENV.include? "SUP_SKIP_XAPIAN_GEM_INSTALL"
18
18
  # update version in Gemfile as well
19
19
  name = "xapian-ruby"
20
20
  version =
@@ -37,7 +37,7 @@ begin
37
37
 
38
38
  end
39
39
  else
40
- STDERR.puts "xapian: openbsd: you have to install xapian-core and xapian-bindings manually, have a look at: https://github.com/sup-heliotrope/sup/wiki/Installation%3A-OpenBSD"
40
+ STDERR.puts "xapian: you have to install xapian-core and xapian-bindings manually"
41
41
  end
42
42
 
43
43
  rescue StandardError => e
data/lib/sup/crypto.rb CHANGED
@@ -369,7 +369,7 @@ EOS
369
369
  def retrieve fingerprint
370
370
  require 'net/http'
371
371
  uri = URI($config[:keyserver_url] || KEYSERVER_URL)
372
- unless uri.scheme == "http" and not uri.host.nil?
372
+ unless uri.scheme == "http" and not uri.host.nil? and not uri.host.empty?
373
373
  return "Invalid url: #{uri}"
374
374
  end
375
375
 
data/lib/sup/index.rb CHANGED
@@ -99,14 +99,14 @@ EOS
99
99
  end
100
100
 
101
101
  def load failsafe=false
102
- SourceManager.load_sources
102
+ SourceManager.load_sources File.join(@dir, "sources.yaml")
103
103
  load_index failsafe
104
104
  end
105
105
 
106
106
  def save
107
107
  debug "saving index and sources..."
108
108
  FileUtils.mkdir_p @dir unless File.exist? @dir
109
- SourceManager.save_sources
109
+ SourceManager.save_sources File.join(@dir, "sources.yaml")
110
110
  save_index
111
111
  end
112
112
 
data/lib/sup/maildir.rb CHANGED
@@ -23,7 +23,7 @@ class Maildir < Source
23
23
  end
24
24
 
25
25
  raise ArgumentError, "not a maildir URI" unless uri.scheme == "maildir"
26
- raise ArgumentError, "maildir URI cannot have a host: #{uri.host}" if uri.host
26
+ raise ArgumentError, "maildir URI cannot have a host: #{uri.host}" unless uri.host.nil? || uri.host.empty?
27
27
  raise ArgumentError, "maildir URI must have a path component" unless uri.path
28
28
 
29
29
  @sync_back = sync_back
data/lib/sup/mbox.rb CHANGED
@@ -30,7 +30,7 @@ class MBox < Source
30
30
  end
31
31
 
32
32
  raise ArgumentError, "not an mbox uri" unless uri.scheme == "mbox"
33
- raise ArgumentError, "mbox URI ('#{uri}') cannot have a host: #{uri.host}" if uri.host
33
+ raise ArgumentError, "mbox URI ('#{uri}') cannot have a host: #{uri.host}" unless uri.host.nil? || uri.host.empty?
34
34
  raise ArgumentError, "mbox URI must have a path component" unless uri.path
35
35
  @f = nil
36
36
  else
data/lib/sup/message.rb CHANGED
@@ -271,7 +271,7 @@ class Message
271
271
  message_to_chunks rmsg
272
272
  rescue SourceError, SocketError, RMail::EncodingUnsupportedError => e
273
273
  warn_with_location "problem reading message #{id}"
274
- debug "could not load message: #{location.inspect}, exception: #{e.inspect}"
274
+ debug "could not load message, exception: #{e.inspect}"
275
275
 
276
276
  [Chunk::Text.new(error_message.split("\n"))]
277
277
 
@@ -760,7 +760,7 @@ private
760
760
 
761
761
  def warn_with_location msg
762
762
  warn msg
763
- warn "Message is in #{location.source.uri} at #{location.info}"
763
+ warn "Message is in #{@locations}"
764
764
  end
765
765
  end
766
766
 
@@ -11,7 +11,7 @@ class Console
11
11
  end
12
12
 
13
13
  def query(query)
14
- Enumerator.new(Index.instance, :each_message, Index.parse_query(query))
14
+ Index.instance.enum_for :each_message, Index.parse_query(query)
15
15
  end
16
16
 
17
17
  def add_labels(query, *labels)
data/lib/sup/thread.rb CHANGED
@@ -86,22 +86,22 @@ class Thread
86
86
  end
87
87
  end
88
88
 
89
- def first; each { |m, *o| return m if m }; nil; end
90
- def has_message?; any? { |m, *o| m.is_a? Message }; end
91
- def dirty?; any? { |m, *o| m && m.dirty? }; end
92
- def date; map { |m, *o| m.date if m }.compact.max; end
89
+ def first; each { |m, *| return m if m }; nil; end
90
+ def has_message?; any? { |m, *| m.is_a? Message }; end
91
+ def dirty?; any? { |m, *| m && m.dirty? }; end
92
+ def date; map { |m, *| m.date if m }.compact.max; end
93
93
  def snippet
94
- with_snippets = select { |m, *o| m && m.snippet && !m.snippet.empty? }
95
- first_unread, * = with_snippets.select { |m, *o| m.has_label?(:unread) }.sort_by { |m, *o| m.date }.first
94
+ with_snippets = select { |m, *| m && m.snippet && !m.snippet.empty? }
95
+ first_unread, * = with_snippets.select { |m, *| m.has_label?(:unread) }.sort_by { |m, *| m.date }.first
96
96
  return first_unread.snippet if first_unread
97
- last_read, * = with_snippets.sort_by { |m, *o| m.date }.last
97
+ last_read, * = with_snippets.sort_by { |m, *| m.date }.last
98
98
  return last_read.snippet if last_read
99
99
  ""
100
100
  end
101
- def authors; map { |m, *o| m.from if m }.compact.uniq; end
101
+ def authors; map { |m, *| m.from if m }.compact.uniq; end
102
102
 
103
- def apply_label t; each { |m, *o| m && m.add_label(t) }; end
104
- def remove_label t; each { |m, *o| m && m.remove_label(t) }; end
103
+ def apply_label t; each { |m, *| m && m.add_label(t) }; end
104
+ def remove_label t; each { |m, *| m && m.remove_label(t) }; end
105
105
 
106
106
  def toggle_label label
107
107
  if has_label? label
@@ -113,24 +113,24 @@ class Thread
113
113
  end
114
114
  end
115
115
 
116
- def set_labels l; each { |m, *o| m && m.labels = l }; end
117
- def has_label? t; any? { |m, *o| m && m.has_label?(t) }; end
118
- def each_dirty_message; each { |m, *o| m && m.dirty? && yield(m) }; end
116
+ def set_labels l; each { |m, *| m && m.labels = l }; end
117
+ def has_label? t; any? { |m, *| m && m.has_label?(t) }; end
118
+ def each_dirty_message; each { |m, *| m && m.dirty? && yield(m) }; end
119
119
 
120
120
  def direct_participants
121
- map { |m, *o| [m.from] + m.to if m }.flatten.compact.uniq
121
+ map { |m, *| [m.from] + m.to if m }.flatten.compact.uniq
122
122
  end
123
123
 
124
124
  def participants
125
- map { |m, *o| [m.from] + m.to + m.cc + m.bcc if m }.flatten.compact.uniq
125
+ map { |m, *| [m.from] + m.to + m.cc + m.bcc if m }.flatten.compact.uniq
126
126
  end
127
127
 
128
- def size; map { |m, *o| m ? 1 : 0 }.sum; end
129
- def subj; argfind { |m, *o| m && m.subj }; end
130
- def labels; inject(Set.new) { |s, (m, *o)| m ? s | m.labels : s } end
128
+ def size; map { |m, *| m ? 1 : 0 }.sum; end
129
+ def subj; argfind { |m, *| m && m.subj }; end
130
+ def labels; inject(Set.new) { |s, (m, *)| m ? s | m.labels : s } end
131
131
  def labels= l
132
132
  raise ArgumentError, "not a set" unless l.is_a?(Set)
133
- each { |m, *o| m && m.labels = l.dup }
133
+ each { |m, *| m && m.labels = l.dup }
134
134
  end
135
135
 
136
136
  def latest_message
@@ -360,7 +360,7 @@ class ThreadSet
360
360
  ## merges in a pre-loaded thread
361
361
  def add_thread t
362
362
  raise "duplicate" if @threads.values.member? t
363
- t.each { |m, *o| add_message m }
363
+ t.each { |m, *| add_message m }
364
364
  end
365
365
 
366
366
  ## merges two threads together. both must be members of this threadset.
data/lib/sup/util.rb CHANGED
@@ -11,6 +11,7 @@ require 'benchmark'
11
11
  require 'unicode'
12
12
  require 'unicode/display_width'
13
13
  require 'fileutils'
14
+ require 'string-scrub' if /^2\.0\./ =~ RUBY_VERSION
14
15
 
15
16
  module ExtendedLockfile
16
17
  def gen_lock_id
@@ -315,11 +316,8 @@ class String
315
316
  # first try to encode to utf-8 from whatever current encoding
316
317
  encode!('UTF-8', :invalid => :replace, :undef => :replace)
317
318
 
318
- # do this anyway in case string is set to be UTF-8, encoding to
319
- # something else (UTF-16 which can fully represent UTF-8) and back
320
- # ensures invalid chars are replaced.
321
- encode!('UTF-16', 'UTF-8', :invalid => :replace, :undef => :replace)
322
- encode!('UTF-8', 'UTF-16', :invalid => :replace, :undef => :replace)
319
+ # ensure invalid chars are replaced
320
+ scrub!
323
321
 
324
322
  fail "Could not create valid UTF-8 string out of: '#{self.to_s}'." unless valid_encoding?
325
323