sup 1.0 → 1.2

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 (93) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/checks.yml +58 -0
  3. data/.rubocop.yml +5 -0
  4. data/CONTRIBUTORS +5 -2
  5. data/Gemfile +5 -1
  6. data/History.txt +33 -0
  7. data/Manifest.txt +171 -0
  8. data/README.md +9 -4
  9. data/Rakefile +40 -1
  10. data/bin/sup-add +4 -8
  11. data/bin/sup-sync-back-maildir +1 -1
  12. data/contrib/nix/Gemfile +22 -0
  13. data/contrib/nix/Gemfile.lock +80 -0
  14. data/contrib/nix/README +7 -0
  15. data/contrib/nix/gem-install-shell.nix +12 -0
  16. data/contrib/nix/gemset.nix +339 -0
  17. data/contrib/nix/ruby2.4-Gemfile.lock +81 -0
  18. data/contrib/nix/ruby2.4-gemset.nix +309 -0
  19. data/contrib/nix/ruby2.4-shell.nix +30 -0
  20. data/contrib/nix/ruby2.5-Gemfile.lock +81 -0
  21. data/contrib/nix/ruby2.5-gemset.nix +309 -0
  22. data/contrib/nix/ruby2.5-shell.nix +30 -0
  23. data/contrib/nix/ruby2.6-Gemfile.lock +83 -0
  24. data/contrib/nix/ruby2.6-gemset.nix +319 -0
  25. data/contrib/nix/ruby2.6-shell.nix +30 -0
  26. data/contrib/nix/ruby2.7-shell.nix +23 -0
  27. data/contrib/nix/ruby3.0-shell.nix +23 -0
  28. data/contrib/nix/ruby3.1-shell.nix +23 -0
  29. data/contrib/nix/ruby3.2-shell.nix +23 -0
  30. data/contrib/nix/ruby3.3-shell.nix +23 -0
  31. data/contrib/nix/test-all-rubies.sh +6 -0
  32. data/doc/Hooks.txt +1 -1
  33. data/ext/mkrf_conf_xapian.rb +12 -6
  34. data/lib/sup/colormap.rb +1 -1
  35. data/lib/sup/crypto.rb +1 -1
  36. data/lib/sup/hook.rb +1 -1
  37. data/lib/sup/index.rb +4 -4
  38. data/lib/sup/keymap.rb +1 -1
  39. data/lib/sup/maildir.rb +5 -5
  40. data/lib/sup/mbox.rb +5 -5
  41. data/lib/sup/message.rb +8 -7
  42. data/lib/sup/message_chunks.rb +27 -19
  43. data/lib/sup/modes/completion_mode.rb +0 -1
  44. data/lib/sup/modes/console_mode.rb +1 -1
  45. data/lib/sup/modes/file_browser_mode.rb +2 -2
  46. data/lib/sup/modes/label_list_mode.rb +1 -1
  47. data/lib/sup/modes/search_list_mode.rb +2 -2
  48. data/lib/sup/modes/thread_view_mode.rb +1 -2
  49. data/lib/sup/rfc2047.rb +21 -6
  50. data/lib/sup/source.rb +8 -2
  51. data/lib/sup/textfield.rb +0 -1
  52. data/lib/sup/thread.rb +20 -21
  53. data/lib/sup/util.rb +31 -53
  54. data/lib/sup/version.rb +1 -1
  55. data/lib/sup.rb +12 -8
  56. data/man/sup-add.1 +39 -39
  57. data/man/sup-config.1 +31 -27
  58. data/man/sup-dump.1 +34 -35
  59. data/man/sup-import-dump.1 +36 -32
  60. data/man/sup-psych-ify-config-files.1 +29 -25
  61. data/man/sup-recover-sources.1 +32 -28
  62. data/man/sup-sync-back-maildir.1 +34 -30
  63. data/man/sup-sync.1 +40 -36
  64. data/man/sup-tweak-labels.1 +36 -32
  65. data/man/sup.1 +41 -37
  66. data/shell.nix +1 -0
  67. data/sup.gemspec +6 -4
  68. data/test/dummy_source.rb +21 -15
  69. data/test/fixtures/embedded-message.eml +34 -0
  70. data/test/fixtures/non-ascii-header-in-nested-message.eml +36 -0
  71. data/test/fixtures/non-ascii-header.eml +8 -0
  72. data/test/fixtures/rfc2047-header-encoding.eml +15 -0
  73. data/test/fixtures/text-attachments-with-charset.eml +15 -1
  74. data/test/fixtures/utf8-header.eml +17 -0
  75. data/test/integration/test_maildir.rb +3 -0
  76. data/test/integration/test_mbox.rb +4 -1
  77. data/test/integration/test_sup-add.rb +83 -0
  78. data/test/integration/test_sup-sync-back-maildir.rb +40 -0
  79. data/test/test_crypto.rb +44 -0
  80. data/test/test_header_parsing.rb +11 -3
  81. data/test/test_helper.rb +7 -4
  82. data/test/test_message.rb +124 -32
  83. data/test/test_messages_dir.rb +13 -15
  84. data/test/unit/test_horizontal_selector.rb +4 -4
  85. data/test/unit/test_locale_fiddler.rb +1 -1
  86. data/test/unit/util/test_query.rb +1 -1
  87. data/test/unit/util/test_string.rb +3 -3
  88. data/test/unit/util/test_uri.rb +2 -2
  89. metadata +69 -18
  90. data/.travis.yml +0 -18
  91. data/bin/sup-psych-ify-config-files +0 -21
  92. data/test/integration/test_label_service.rb +0 -18
  93. data/test/test_yaml_migration.rb +0 -85
@@ -13,19 +13,22 @@ class TestMessagesDir < ::Minitest::Test
13
13
  def setup
14
14
  @path = Dir.mktmpdir
15
15
  Redwood::HookManager.init File.join(@path, 'hooks')
16
+ @log = StringIO.new
17
+ Redwood::Logger.add_sink @log
18
+ Redwood::Logger.remove_sink $stderr
16
19
  end
17
20
 
18
21
  def teardown
22
+ Redwood::Logger.clear!
23
+ Redwood::Logger.remove_sink @log
24
+ Redwood::Logger.add_sink $stderr
19
25
  Redwood::HookManager.deinstantiate!
20
26
  FileUtils.rm_r @path
21
27
  end
22
28
 
23
29
  def test_binary_content_transfer_encoding
24
- message = ''
25
- File.open('test/fixtures/binary-content-transfer-encoding-2.eml') { |f| message = f.read }
26
-
27
30
  source = DummySource.new("sup-test://test_messages")
28
- source.messages = [ message ]
31
+ source.messages = [ fixture_path('binary-content-transfer-encoding-2.eml') ]
29
32
  source_info = 0
30
33
 
31
34
  sup_message = Message.build_from_source(source, source_info)
@@ -41,7 +44,6 @@ class TestMessagesDir < ::Minitest::Test
41
44
  assert_equal("Important", subj)
42
45
 
43
46
  chunks = sup_message.load_from_source!
44
- indexable_chunks = sup_message.indexable_chunks
45
47
 
46
48
  # there should be only one chunk
47
49
  #assert_equal(1, chunks.length)
@@ -50,14 +52,13 @@ class TestMessagesDir < ::Minitest::Test
50
52
 
51
53
  # lines should contain an error message
52
54
  assert (lines.join.include? "An error occurred while loading this message."), "This message should not load successfully"
55
+
56
+ assert_match(/WARNING: problem reading message/, @log.string)
53
57
  end
54
58
 
55
59
  def test_bad_content_transfer_encoding
56
- message = ''
57
- File.open('test/fixtures/bad-content-transfer-encoding-1.eml') { |f| message = f.read }
58
-
59
60
  source = DummySource.new("sup-test://test_messages")
60
- source.messages = [ message ]
61
+ source.messages = [ fixture_path('bad-content-transfer-encoding-1.eml') ]
61
62
  source_info = 0
62
63
 
63
64
  sup_message = Message.build_from_source(source, source_info)
@@ -73,7 +74,6 @@ class TestMessagesDir < ::Minitest::Test
73
74
  assert_equal("Content-Transfer-Encoding:-bug in sup", subj)
74
75
 
75
76
  chunks = sup_message.load_from_source!
76
- indexable_chunks = sup_message.indexable_chunks
77
77
 
78
78
  # there should be only one chunk
79
79
  #assert_equal(1, chunks.length)
@@ -82,14 +82,13 @@ class TestMessagesDir < ::Minitest::Test
82
82
 
83
83
  # lines should contain an error message
84
84
  assert (lines.join.include? "An error occurred while loading this message."), "This message should not load successfully"
85
+
86
+ assert_match(/WARNING: problem reading message/, @log.string)
85
87
  end
86
88
 
87
89
  def test_missing_line
88
- message = ''
89
- File.open('test/fixtures/missing-line.eml') { |f| message = f.read }
90
-
91
90
  source = DummySource.new("sup-test://test_messages")
92
- source.messages = [ message ]
91
+ source.messages = [ fixture_path('missing-line.eml') ]
93
92
  source_info = 0
94
93
 
95
94
  sup_message = Message.build_from_source(source, source_info)
@@ -105,7 +104,6 @@ class TestMessagesDir < ::Minitest::Test
105
104
  assert_equal("Encoding bug", subj)
106
105
 
107
106
  chunks = sup_message.load_from_source!
108
- indexable_chunks = sup_message.indexable_chunks
109
107
 
110
108
  # there should be only one chunk
111
109
  #assert_equal(1, chunks.length)
@@ -13,18 +13,18 @@ describe Redwood::HorizontalSelector do
13
13
 
14
14
  it "init w/ the first value selected" do
15
15
  first_value = values.first
16
- @selector.val.must_equal first_value
16
+ assert_equal first_value, @selector.val
17
17
  end
18
18
 
19
19
  it "stores value for selection" do
20
20
  second_value = values[1]
21
21
  @selector.set_to second_value
22
- @selector.val.must_equal second_value
22
+ assert_equal second_value, @selector.val
23
23
  end
24
24
 
25
25
  describe "for unknown value" do
26
26
  it "cannot select unknown value" do
27
- @selector.wont_be :can_set_to?, strange_value
27
+ assert_equal false, @selector.can_set_to?(strange_value)
28
28
  end
29
29
 
30
30
  it "refuses selecting unknown value" do
@@ -34,7 +34,7 @@ describe Redwood::HorizontalSelector do
34
34
  @selector.set_to strange_value
35
35
  end
36
36
 
37
- @selector.val.must_equal old_value
37
+ assert_equal old_value, @selector.val
38
38
  end
39
39
  end
40
40
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'sup/util/locale_fiddler'
3
3
 
4
- class TestFiddle < ::Minitest::Unit::TestCase
4
+ class TestFiddle < Minitest::Test
5
5
  # TODO this is a silly test
6
6
  def test_fiddle_set_locale
7
7
  before = LocaleDummy.setlocale(6, nil).to_s
@@ -30,7 +30,7 @@ describe Redwood::Util::Query do
30
30
  else
31
31
  # xapian 1.2 doesn't handle this bad input, so we do
32
32
  assert_raises Redwood::Util::Query::QueryDescriptionError do
33
- desc = Redwood::Util::Query.describe (query)
33
+ _desc = Redwood::Util::Query.describe (query)
34
34
  end
35
35
  end
36
36
 
@@ -18,7 +18,7 @@ describe "Sup's String extension" do
18
18
 
19
19
  it "calculates display length of a string" do
20
20
  data.each do |(str, length)|
21
- str.display_length.must_equal length
21
+ assert_equal length, str.display_length
22
22
  end
23
23
  end
24
24
  end
@@ -36,7 +36,7 @@ describe "Sup's String extension" do
36
36
 
37
37
  it "slices string by display length" do
38
38
  data.each do |(str, length, sliced)|
39
- str.slice_by_display_length(length).must_equal sliced
39
+ assert_equal sliced, str.slice_by_display_length(length)
40
40
  end
41
41
  end
42
42
  end
@@ -56,7 +56,7 @@ describe "Sup's String extension" do
56
56
 
57
57
  it "wraps string by display length" do
58
58
  data.each do |(str, length, wrapped)|
59
- str.wrap(length).must_equal wrapped
59
+ assert_equal wrapped, str.wrap(length)
60
60
  end
61
61
  end
62
62
  end
@@ -7,13 +7,13 @@ describe Redwood::Util::Uri do
7
7
  it "builds uri from hash" do
8
8
  components = {:path => "/var/mail/foo", :scheme => "mbox"}
9
9
  uri = Redwood::Util::Uri.build(components)
10
- uri.to_s.must_equal "mbox:/var/mail/foo"
10
+ assert_equal "mbox:/var/mail/foo", uri.to_s
11
11
  end
12
12
 
13
13
  it "expands ~ in path" do
14
14
  components = {:path => "~/foo", :scheme => "maildir"}
15
15
  uri = Redwood::Util::Uri.build(components)
16
- uri.to_s.must_equal "maildir:#{ENV["HOME"]}/foo"
16
+ assert_equal "maildir:#{ENV["HOME"]}/foo", uri.to_s
17
17
  end
18
18
  end
19
19
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sup
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Morgan
8
8
  - Gaute Hope
9
9
  - Hamish Downer
10
10
  - Matthieu Rakotojaona
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-07-12 00:00:00.000000000 Z
14
+ date: 2024-04-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: ncursesw
@@ -31,16 +31,22 @@ dependencies:
31
31
  name: rmail
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - "~>"
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: '1.1'
36
+ version: 1.1.2
37
+ - - "<"
38
+ - !ruby/object:Gem::Version
39
+ version: '2'
37
40
  type: :runtime
38
41
  prerelease: false
39
42
  version_requirements: !ruby/object:Gem::Requirement
40
43
  requirements:
41
- - - "~>"
44
+ - - ">="
42
45
  - !ruby/object:Gem::Version
43
- version: '1.1'
46
+ version: 1.1.2
47
+ - - "<"
48
+ - !ruby/object:Gem::Version
49
+ version: '2'
44
50
  - !ruby/object:Gem::Dependency
45
51
  name: highline
46
52
  requirement: !ruby/object:Gem::Requirement
@@ -193,14 +199,14 @@ dependencies:
193
199
  requirements:
194
200
  - - "~>"
195
201
  - !ruby/object:Gem::Version
196
- version: 5.5.1
202
+ version: '5.5'
197
203
  type: :development
198
204
  prerelease: false
199
205
  version_requirements: !ruby/object:Gem::Requirement
200
206
  requirements:
201
207
  - - "~>"
202
208
  - !ruby/object:Gem::Version
203
- version: 5.5.1
209
+ version: '5.5'
204
210
  - !ruby/object:Gem::Dependency
205
211
  name: rr
206
212
  requirement: !ruby/object:Gem::Requirement
@@ -243,6 +249,20 @@ dependencies:
243
249
  - - ">="
244
250
  - !ruby/object:Gem::Version
245
251
  version: '0'
252
+ - !ruby/object:Gem::Dependency
253
+ name: rubocop-packaging
254
+ requirement: !ruby/object:Gem::Requirement
255
+ requirements:
256
+ - - ">="
257
+ - !ruby/object:Gem::Version
258
+ version: '0'
259
+ type: :development
260
+ prerelease: false
261
+ version_requirements: !ruby/object:Gem::Requirement
262
+ requirements:
263
+ - - ">="
264
+ - !ruby/object:Gem::Version
265
+ version: '0'
246
266
  description: |2
247
267
  Sup is a console-based email client for people with a lot of email.
248
268
 
@@ -259,7 +279,6 @@ executables:
259
279
  - sup-config
260
280
  - sup-dump
261
281
  - sup-import-dump
262
- - sup-psych-ify-config-files
263
282
  - sup-recover-sources
264
283
  - sup-sync
265
284
  - sup-sync-back-maildir
@@ -278,14 +297,16 @@ extra_rdoc_files:
278
297
  - man/sup-tweak-labels.1
279
298
  - man/sup.1
280
299
  files:
300
+ - ".github/workflows/checks.yml"
281
301
  - ".gitignore"
282
302
  - ".gitmodules"
283
- - ".travis.yml"
303
+ - ".rubocop.yml"
284
304
  - CONTRIBUTORS
285
305
  - Gemfile
286
306
  - HACKING
287
307
  - History.txt
288
308
  - LICENSE
309
+ - Manifest.txt
289
310
  - README.md
290
311
  - Rakefile
291
312
  - ReleaseNotes
@@ -294,7 +315,6 @@ files:
294
315
  - bin/sup-config
295
316
  - bin/sup-dump
296
317
  - bin/sup-import-dump
297
- - bin/sup-psych-ify-config-files
298
318
  - bin/sup-recover-sources
299
319
  - bin/sup-sync
300
320
  - bin/sup-sync-back-maildir
@@ -302,6 +322,26 @@ files:
302
322
  - contrib/colorpicker.rb
303
323
  - contrib/completion/_sup.bash
304
324
  - contrib/completion/_sup.zsh
325
+ - contrib/nix/Gemfile
326
+ - contrib/nix/Gemfile.lock
327
+ - contrib/nix/README
328
+ - contrib/nix/gem-install-shell.nix
329
+ - contrib/nix/gemset.nix
330
+ - contrib/nix/ruby2.4-Gemfile.lock
331
+ - contrib/nix/ruby2.4-gemset.nix
332
+ - contrib/nix/ruby2.4-shell.nix
333
+ - contrib/nix/ruby2.5-Gemfile.lock
334
+ - contrib/nix/ruby2.5-gemset.nix
335
+ - contrib/nix/ruby2.5-shell.nix
336
+ - contrib/nix/ruby2.6-Gemfile.lock
337
+ - contrib/nix/ruby2.6-gemset.nix
338
+ - contrib/nix/ruby2.6-shell.nix
339
+ - contrib/nix/ruby2.7-shell.nix
340
+ - contrib/nix/ruby3.0-shell.nix
341
+ - contrib/nix/ruby3.1-shell.nix
342
+ - contrib/nix/ruby3.2-shell.nix
343
+ - contrib/nix/ruby3.3-shell.nix
344
+ - contrib/nix/test-all-rubies.sh
305
345
  - devel/console.sh
306
346
  - devel/count-loc.sh
307
347
  - devel/load-index.rb
@@ -388,12 +428,14 @@ files:
388
428
  - man/sup-sync.1
389
429
  - man/sup-tweak-labels.1
390
430
  - man/sup.1
431
+ - shell.nix
391
432
  - sup.gemspec
392
433
  - test/dummy_source.rb
393
434
  - test/fixtures/bad-content-transfer-encoding-1.eml
394
435
  - test/fixtures/binary-content-transfer-encoding-2.eml
395
436
  - test/fixtures/blank-header-fields.eml
396
437
  - test/fixtures/contacts.txt
438
+ - test/fixtures/embedded-message.eml
397
439
  - test/fixtures/mailing-list-header.eml
398
440
  - test/fixtures/malicious-attachment-names.eml
399
441
  - test/fixtures/missing-from-to.eml
@@ -401,8 +443,12 @@ files:
401
443
  - test/fixtures/multi-part-2.eml
402
444
  - test/fixtures/multi-part.eml
403
445
  - test/fixtures/no-body.eml
446
+ - test/fixtures/non-ascii-header-in-nested-message.eml
447
+ - test/fixtures/non-ascii-header.eml
448
+ - test/fixtures/rfc2047-header-encoding.eml
404
449
  - test/fixtures/simple-message.eml
405
450
  - test/fixtures/text-attachments-with-charset.eml
451
+ - test/fixtures/utf8-header.eml
406
452
  - test/fixtures/zimbra-quote-with-bottom-post.eml
407
453
  - test/gnupg_test_home/.gpg-v21-migrated
408
454
  - test/gnupg_test_home/gpg.conf
@@ -413,15 +459,15 @@ files:
413
459
  - test/gnupg_test_home/regen_keys.sh
414
460
  - test/gnupg_test_home/secring.gpg
415
461
  - test/gnupg_test_home/sup-test-2@foo.bar.asc
416
- - test/integration/test_label_service.rb
417
462
  - test/integration/test_maildir.rb
418
463
  - test/integration/test_mbox.rb
464
+ - test/integration/test_sup-add.rb
465
+ - test/integration/test_sup-sync-back-maildir.rb
419
466
  - test/test_crypto.rb
420
467
  - test/test_header_parsing.rb
421
468
  - test/test_helper.rb
422
469
  - test/test_message.rb
423
470
  - test/test_messages_dir.rb
424
- - test/test_yaml_migration.rb
425
471
  - test/test_yaml_regressions.rb
426
472
  - test/unit/service/test_label_service.rb
427
473
  - test/unit/test_contact.rb
@@ -458,8 +504,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
458
504
  - !ruby/object:Gem::Version
459
505
  version: '0'
460
506
  requirements: []
461
- rubygems_version: 3.1.2
462
- signing_key:
507
+ rubygems_version: 3.4.22
508
+ signing_key:
463
509
  specification_version: 4
464
510
  summary: A console-based email client with the best features of GMail, mutt and Emacs
465
511
  test_files:
@@ -468,6 +514,7 @@ test_files:
468
514
  - test/fixtures/binary-content-transfer-encoding-2.eml
469
515
  - test/fixtures/blank-header-fields.eml
470
516
  - test/fixtures/contacts.txt
517
+ - test/fixtures/embedded-message.eml
471
518
  - test/fixtures/mailing-list-header.eml
472
519
  - test/fixtures/malicious-attachment-names.eml
473
520
  - test/fixtures/missing-from-to.eml
@@ -475,8 +522,12 @@ test_files:
475
522
  - test/fixtures/multi-part-2.eml
476
523
  - test/fixtures/multi-part.eml
477
524
  - test/fixtures/no-body.eml
525
+ - test/fixtures/non-ascii-header-in-nested-message.eml
526
+ - test/fixtures/non-ascii-header.eml
527
+ - test/fixtures/rfc2047-header-encoding.eml
478
528
  - test/fixtures/simple-message.eml
479
529
  - test/fixtures/text-attachments-with-charset.eml
530
+ - test/fixtures/utf8-header.eml
480
531
  - test/fixtures/zimbra-quote-with-bottom-post.eml
481
532
  - test/gnupg_test_home/.gpg-v21-migrated
482
533
  - test/gnupg_test_home/gpg.conf
@@ -487,15 +538,15 @@ test_files:
487
538
  - test/gnupg_test_home/regen_keys.sh
488
539
  - test/gnupg_test_home/secring.gpg
489
540
  - test/gnupg_test_home/sup-test-2@foo.bar.asc
490
- - test/integration/test_label_service.rb
491
541
  - test/integration/test_maildir.rb
492
542
  - test/integration/test_mbox.rb
543
+ - test/integration/test_sup-add.rb
544
+ - test/integration/test_sup-sync-back-maildir.rb
493
545
  - test/test_crypto.rb
494
546
  - test/test_header_parsing.rb
495
547
  - test/test_helper.rb
496
548
  - test/test_message.rb
497
549
  - test/test_messages_dir.rb
498
- - test/test_yaml_migration.rb
499
550
  - test/test_yaml_regressions.rb
500
551
  - test/unit/service/test_label_service.rb
501
552
  - test/unit/test_contact.rb
data/.travis.yml DELETED
@@ -1,18 +0,0 @@
1
- language: ruby
2
-
3
- dist: focal
4
-
5
- rvm:
6
- - 2.5
7
- - 2.6
8
- - 2.7
9
-
10
- before_install:
11
- - sudo apt update -qq
12
- - sudo apt install -qq uuid-dev uuid libncursesw5-dev libncursesw5 gnupg2 pandoc
13
- - git submodule update --init --recursive
14
-
15
- script:
16
- - bundle exec rake travis
17
- - bundle exec gem install pkg/sup-*.gem
18
-
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
-
5
- require "sup"
6
- require "fileutils"
7
-
8
- if RUBY_VERSION >= "2.1"
9
- puts "YAML migration is deprecated by Ruby 2.1 and newer."
10
- exit
11
- end
12
-
13
- Redwood.start
14
-
15
- fn = Redwood::SOURCE_FN
16
- FileUtils.cp fn, "#{fn}.syck_bak"
17
-
18
- Redwood::SourceManager.load_sources fn
19
- Redwood::SourceManager.save_sources fn, true
20
-
21
- Redwood.finish
@@ -1,18 +0,0 @@
1
- require "test_helper"
2
-
3
- require "sup/service/label_service"
4
-
5
- require "tmpdir"
6
-
7
- describe Redwood::LabelService do
8
- let(:tmpdir) { Dir.mktmpdir }
9
- after do
10
- require "fileutils"
11
- FileUtils.remove_entry_secure @tmpdir unless @tmpdir.nil?
12
- end
13
-
14
- describe "#add_labels" do
15
- # Integration tests are hard to write at this moment :(
16
- it "add labels to all messages matching the query"
17
- end
18
- end
@@ -1,85 +0,0 @@
1
- require "test_helper"
2
-
3
- require "sup"
4
- require "psych"
5
-
6
- if RUBY_VERSION < "2.1"
7
- describe "Sup's YAML util" do
8
- describe "Module#yaml_properties" do
9
- def build_class_with_name name, &b
10
- Class.new do
11
- meta_cls = class << self; self; end
12
- meta_cls.send(:define_method, :name) { name }
13
- class_exec(&b) unless b.nil?
14
- end
15
- end
16
-
17
- after do
18
- Psych.load_tags = {}
19
- Psych.dump_tags = {}
20
- end
21
-
22
- it "defines YAML tag for class" do
23
- cls = build_class_with_name 'Cls' do
24
- yaml_properties
25
- end
26
-
27
- expected_yaml_tag = "!supmua.org,2006-10-01/Cls"
28
-
29
- Psych.load_tags[expected_yaml_tag].must_equal cls
30
- Psych.dump_tags[cls].must_equal expected_yaml_tag
31
-
32
- end
33
-
34
- it "Loads legacy YAML format as well" do
35
- cls = build_class_with_name 'Cls' do
36
- yaml_properties :id
37
- attr_accessor :id
38
- def initialize id
39
- @id = id
40
- end
41
- end
42
-
43
- Psych.load_tags["!masanjin.net,2006-10-01/Cls"].must_equal cls
44
-
45
- yaml = <<EOF
46
- --- !masanjin.net,2006-10-01/Cls
47
- id: ID
48
- EOF
49
- loaded = YAML.load(yaml)
50
-
51
- loaded.id.must_equal 'ID'
52
- loaded.must_be_kind_of cls
53
- end
54
-
55
- it "Dumps & loads w/ state re-initialized" do
56
- cls = build_class_with_name 'Cls' do
57
- yaml_properties :id
58
- attr_accessor :id
59
- attr_reader :flag
60
-
61
- def initialize id
62
- @id = id
63
- @flag = true
64
- end
65
- end
66
-
67
- instance = cls.new 'ID'
68
-
69
- dumped = YAML.dump(instance)
70
- loaded = YAML.load(dumped)
71
-
72
- dumped.must_equal <<-EOF
73
- --- !supmua.org,2006-10-01/Cls
74
- id: ID
75
- EOF
76
-
77
- loaded.id.must_equal 'ID'
78
- assert loaded.flag
79
- end
80
- end
81
- end
82
-
83
- else
84
- puts "Some YAML tests are skipped on Ruby 2.1.0 and newer."
85
- end