scout-essentials 1.7.1 → 1.8.0

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +200 -47
  3. data/README.md +136 -0
  4. data/Rakefile +1 -0
  5. data/VERSION +1 -1
  6. data/doc/Annotation.md +352 -0
  7. data/doc/CMD.md +203 -0
  8. data/doc/ConcurrentStream.md +163 -0
  9. data/doc/IndiferentHash.md +240 -0
  10. data/doc/Log.md +235 -0
  11. data/doc/NamedArray.md +174 -0
  12. data/doc/Open.md +331 -0
  13. data/doc/Path.md +217 -0
  14. data/doc/Persist.md +214 -0
  15. data/doc/Resource.md +229 -0
  16. data/doc/SimpleOPT.md +236 -0
  17. data/doc/TmpFile.md +154 -0
  18. data/lib/scout/annotation/annotated_object.rb +8 -0
  19. data/lib/scout/annotation/annotation_module.rb +1 -0
  20. data/lib/scout/cmd.rb +19 -12
  21. data/lib/scout/concurrent_stream.rb +3 -1
  22. data/lib/scout/config.rb +2 -2
  23. data/lib/scout/indiferent_hash/options.rb +2 -2
  24. data/lib/scout/indiferent_hash.rb +16 -0
  25. data/lib/scout/log/color.rb +5 -3
  26. data/lib/scout/log/fingerprint.rb +8 -8
  27. data/lib/scout/log/progress/report.rb +6 -6
  28. data/lib/scout/log.rb +7 -7
  29. data/lib/scout/misc/digest.rb +11 -13
  30. data/lib/scout/misc/format.rb +2 -2
  31. data/lib/scout/misc/system.rb +5 -0
  32. data/lib/scout/open/final.rb +16 -1
  33. data/lib/scout/open/remote.rb +0 -1
  34. data/lib/scout/open/stream.rb +30 -5
  35. data/lib/scout/open/util.rb +32 -0
  36. data/lib/scout/path/digest.rb +12 -2
  37. data/lib/scout/path/find.rb +19 -6
  38. data/lib/scout/path/util.rb +37 -1
  39. data/lib/scout/persist/open.rb +2 -0
  40. data/lib/scout/persist.rb +7 -1
  41. data/lib/scout/resource/path.rb +2 -2
  42. data/lib/scout/resource/util.rb +18 -4
  43. data/lib/scout/resource.rb +15 -1
  44. data/lib/scout/simple_opt/parse.rb +2 -0
  45. data/lib/scout/tmpfile.rb +1 -1
  46. data/scout-essentials.gemspec +19 -6
  47. data/test/scout/misc/test_hook.rb +2 -2
  48. data/test/scout/open/test_stream.rb +43 -15
  49. data/test/scout/path/test_find.rb +1 -1
  50. data/test/scout/path/test_util.rb +11 -0
  51. data/test/scout/test_path.rb +4 -4
  52. data/test/scout/test_persist.rb +10 -1
  53. metadata +31 -5
  54. data/README.rdoc +0 -18
@@ -2,30 +2,42 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: scout-essentials 1.7.1 ruby lib
5
+ # stub: scout-essentials 1.8.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "scout-essentials".freeze
9
- s.version = "1.7.1".freeze
9
+ s.version = "1.8.0".freeze
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Miguel Vazquez".freeze]
14
- s.date = "2025-06-12"
14
+ s.date = "1980-01-02"
15
15
  s.description = "Things a scout can use anywhere".freeze
16
16
  s.email = "mikisvaz@gmail.com".freeze
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE.txt",
19
- "README.rdoc"
19
+ "README.md"
20
20
  ]
21
21
  s.files = [
22
22
  ".document",
23
23
  ".vimproject",
24
24
  "Gemfile",
25
25
  "LICENSE.txt",
26
- "README.rdoc",
26
+ "README.md",
27
27
  "Rakefile",
28
28
  "VERSION",
29
+ "doc/Annotation.md",
30
+ "doc/CMD.md",
31
+ "doc/ConcurrentStream.md",
32
+ "doc/IndiferentHash.md",
33
+ "doc/Log.md",
34
+ "doc/NamedArray.md",
35
+ "doc/Open.md",
36
+ "doc/Path.md",
37
+ "doc/Persist.md",
38
+ "doc/Resource.md",
39
+ "doc/SimpleOPT.md",
40
+ "doc/TmpFile.md",
29
41
  "lib/scout-essentials.rb",
30
42
  "lib/scout/annotation.rb",
31
43
  "lib/scout/annotation/annotated_object.rb",
@@ -146,7 +158,7 @@ Gem::Specification.new do |s|
146
158
  ]
147
159
  s.homepage = "http://github.com/mikisvaz/scout-essentials".freeze
148
160
  s.licenses = ["MIT".freeze]
149
- s.rubygems_version = "3.6.6".freeze
161
+ s.rubygems_version = "3.7.0.dev".freeze
150
162
  s.summary = "Scout essential tools".freeze
151
163
 
152
164
  s.specification_version = 4
@@ -159,5 +171,6 @@ Gem::Specification.new do |s|
159
171
  s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0".freeze])
160
172
  s.add_runtime_dependency(%q<yaml>.freeze, [">= 0".freeze])
161
173
  s.add_runtime_dependency(%q<rake>.freeze, [">= 0".freeze])
174
+ s.add_runtime_dependency(%q<listen>.freeze, [">= 0".freeze])
162
175
  end
163
176
 
@@ -13,7 +13,7 @@ class TestHook < Test::Unit::TestCase
13
13
  end
14
14
  end
15
15
 
16
- a = 's'
16
+ a = 's'.dup
17
17
  a.extend m
18
18
 
19
19
  assert_equal 'original', m.test
@@ -32,7 +32,7 @@ class TestHook < Test::Unit::TestCase
32
32
 
33
33
  Hook.apply(h, m)
34
34
 
35
- a = 's'
35
+ a = 's'.dup
36
36
  a.extend m
37
37
 
38
38
  assert_equal 'hook', m.test
@@ -421,6 +421,49 @@ row2 aaa ccc
421
421
  assert_not_include txt, "bb|"
422
422
  end
423
423
 
424
+ def test_line_monitor_stream
425
+ text=<<-EOF
426
+ row1 A B C
427
+ row2 AA BB CC
428
+ row3 AAA BBB CCC
429
+ EOF
430
+
431
+ TmpFile.with_file text do |file|
432
+ Open.open(file) do |f|
433
+ lines = []
434
+ s = Open.line_monitor_stream f do |line|
435
+ lines << line.strip
436
+ end
437
+
438
+ res = s.read
439
+ assert_equal text, res
440
+ assert_equal text.split("\n"), lines
441
+ end
442
+ end
443
+ end
444
+
445
+ def test_line_monitor_stream_exception
446
+ text=<<-EOF
447
+ row1 A B C
448
+ row2 AA BB CC
449
+ row3 AAA BBB CCC
450
+ EOF
451
+
452
+ TmpFile.with_file text do |file|
453
+ Open.open(file) do |f|
454
+ lines = []
455
+ s = Open.line_monitor_stream f do |line|
456
+ lines << line.strip
457
+ raise if line.include?('row3')
458
+ end
459
+
460
+ s.autojoin = true
461
+ assert_raise do
462
+ res = s.read
463
+ end
464
+ end
465
+ end
466
+ end
424
467
  #
425
468
  #
426
469
  # def test_paste_stream
@@ -684,21 +727,6 @@ row2 aaa ccc
684
727
  # end
685
728
  # end
686
729
  #
687
- # def test_open_pipe_error
688
- # sout = Misc.open_pipe do |sin|
689
- # 10.times do |i|
690
- # sin.puts "line #{i}"
691
- # end
692
- # raise
693
- # end
694
- #
695
- # TmpFile.with_file do |tmp|
696
- # #Misc.consume_stream(sout, false, tmp)
697
- # assert_raise do
698
- # Open.write(tmp, sout)
699
- # end
700
- # end
701
- # end
702
730
  #end
703
731
  end
704
732
 
@@ -143,7 +143,7 @@ class TestPathFind < Test::Unit::TestCase
143
143
  file = Path.setup('foo')
144
144
  assert_equal 'foo', file._toplevel
145
145
  assert_equal nil, file._subpath
146
- assert_equal '/usr/local/foo/scout/', file.find(:local)
146
+ assert_equal '/usr/local/foo/scout', file.find(:local)
147
147
  end
148
148
  end
149
149
 
@@ -26,5 +26,16 @@ class TestPathUtil < Test::Unit::TestCase
26
26
  path = Path.setup("/home/.scout/dir/file")
27
27
  assert_equal "/home/.scout/dir/file", path.unset_extension
28
28
  end
29
+
30
+ def test_newer?
31
+ TmpFile.with_path do |dir|
32
+ Open.write dir.f1, 'test1'
33
+ sleep 0.1
34
+ Open.write dir.f2, 'test2'
35
+
36
+ assert Path.newer? dir.f1.find, dir.f2.find
37
+ refute Path.newer? dir.f2.find, dir.f1.find
38
+ end
39
+ end
29
40
  end
30
41
 
@@ -3,14 +3,14 @@ require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1
3
3
 
4
4
  class TestPath < Test::Unit::TestCase
5
5
  def test_join
6
- path = '/tmp'
6
+ path = '/tmp'.dup
7
7
  path.extend Path
8
8
  assert_equal '/tmp/foo', path.join(:foo)
9
9
  assert_equal '/tmp/foo/bar', path.join(:bar, :foo)
10
10
  end
11
11
 
12
12
  def test_get
13
- path = '/tmp'
13
+ path = '/tmp'.dup
14
14
  path.extend Path
15
15
  assert_equal '/tmp/foo', path[:foo]
16
16
  assert_equal '/tmp/foo/bar', path.foo[:bar]
@@ -18,7 +18,7 @@ class TestPath < Test::Unit::TestCase
18
18
  end
19
19
 
20
20
  def test_slash
21
- path = '/tmp'
21
+ path = '/tmp'.dup
22
22
  path.extend Path
23
23
  assert_equal '/tmp/foo', path/:foo
24
24
  assert_equal '/tmp/foo/bar', path/:foo/:bar
@@ -27,7 +27,7 @@ class TestPath < Test::Unit::TestCase
27
27
  end
28
28
 
29
29
  def test_setup
30
- path = 'tmp'
30
+ path = 'tmp'.dup
31
31
  Path.setup(path)
32
32
  assert_equal 'scout', path.pkgdir
33
33
  assert path.libdir.end_with?("scout-essentials")
@@ -71,7 +71,7 @@ class TestPersist < Test::Unit::TestCase
71
71
  end
72
72
  end
73
73
 
74
- def test_update_time
74
+ def test_update_file
75
75
  TmpFile.with_file do |dir|
76
76
  Path.setup(dir)
77
77
  obj = "TEST"
@@ -95,6 +95,15 @@ class TestPersist < Test::Unit::TestCase
95
95
  end
96
96
  end
97
97
 
98
+ def test_update_time
99
+ TmpFile.with_file do |dir|
100
+ assert_equal "TEST1", Persist.persist('Test update time', :string, :dir => tmpdir.persist){ "TEST1" }
101
+ assert_equal "TEST1", Persist.persist('Test update time', :string, :dir => tmpdir.persist){ "TEST2" }
102
+ assert_equal "TEST1", Persist.persist('Test update time', :string, :dir => tmpdir.persist, update: 5){ "TEST2" }
103
+ sleep 5
104
+ assert_equal "TEST2", Persist.persist('Test update time', :string, :dir => tmpdir.persist, update: 5){ "TEST2" }
105
+ end
106
+ end
98
107
  def test_concurrent
99
108
  num = 10
100
109
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout-essentials
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: shoulda
@@ -121,21 +121,47 @@ dependencies:
121
121
  - - ">="
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
+ - !ruby/object:Gem::Dependency
125
+ name: listen
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ type: :runtime
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
124
138
  description: Things a scout can use anywhere
125
139
  email: mikisvaz@gmail.com
126
140
  executables: []
127
141
  extensions: []
128
142
  extra_rdoc_files:
129
143
  - LICENSE.txt
130
- - README.rdoc
144
+ - README.md
131
145
  files:
132
146
  - ".document"
133
147
  - ".vimproject"
134
148
  - Gemfile
135
149
  - LICENSE.txt
136
- - README.rdoc
150
+ - README.md
137
151
  - Rakefile
138
152
  - VERSION
153
+ - doc/Annotation.md
154
+ - doc/CMD.md
155
+ - doc/ConcurrentStream.md
156
+ - doc/IndiferentHash.md
157
+ - doc/Log.md
158
+ - doc/NamedArray.md
159
+ - doc/Open.md
160
+ - doc/Path.md
161
+ - doc/Persist.md
162
+ - doc/Resource.md
163
+ - doc/SimpleOPT.md
164
+ - doc/TmpFile.md
139
165
  - lib/scout-essentials.rb
140
166
  - lib/scout/annotation.rb
141
167
  - lib/scout/annotation/annotated_object.rb
@@ -271,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
297
  - !ruby/object:Gem::Version
272
298
  version: '0'
273
299
  requirements: []
274
- rubygems_version: 3.6.6
300
+ rubygems_version: 3.7.0.dev
275
301
  specification_version: 4
276
302
  summary: Scout essential tools
277
303
  test_files: []
data/README.rdoc DELETED
@@ -1,18 +0,0 @@
1
- = scout-essentials
2
-
3
- Description goes here.
4
-
5
- == Contributing to scout-essentials
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2023 Miguel Vazquez. See LICENSE.txt for
18
- further details.