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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b525f579cb1dfea91f74e339b0cefcc9713567e0555da3e8943cbf5e05a3a8fa
4
- data.tar.gz: 75ebc6504a1aa544134f6cd83f472f4cc056d86f093eb96eea450d96e3220603
3
+ metadata.gz: 5fb209b3857e98d43ad106f48fc2a1da554472421349b8219f04f322954b5afa
4
+ data.tar.gz: 2dea338e87eac08434524e70c85a92c63091f2fe5c118b61ef387de65d9e1da9
5
5
  SHA512:
6
- metadata.gz: e21bc777bae26f177ecad2aa4bcee2cd2d4b3b715b9d5fa509def84ed17ab007ff63b1f09734f506242b31d350e47f8600cbcc1a0dd544fd9932331c53572c3f
7
- data.tar.gz: 3caf9cce8f443aaf892815e9ef0930490956ef53c26800b49dd12175a59ac01c34fd77bc82a492e6e64b17f6acb3e633bd95a4cf4b9ca11575b3851baf8e6169
6
+ metadata.gz: 4f5dfa3b79685f5b2e9ff9c0d270433e81c576113e41f17641cb858edc07b0c35e4444d7ee3bf1b588404908b07b491bd6138d8c554d329cd1d641489377b704
7
+ data.tar.gz: c17e0df7d59f7a8afd52d37fc7803d8da56ccd1de6e4a186f5c3665b7661064917e616b1db8dd2d8700e2f3465afd0b7d3449bc01fad604b3462891254f08fa3
data/.vimproject CHANGED
@@ -1,30 +1,172 @@
1
1
  scout-essentials=/$PWD filter="*.rb *.txt *.md *.conf *.yaml" {
2
2
  LICENSE.txt
3
- Rakefile
3
+ chats=chats filter="*"{
4
+ review
5
+ document.rb
6
+ docs=docs{
7
+ Analyze Annotation tests
8
+ Analyze CMD and related tests
9
+ Analyze CMD tests
10
+ Analyze log tests
11
+ Analyze Open tests
12
+ Analyze Path tests
13
+ Analyze Persist tests
14
+ Analyze Resource tests
15
+ Analyze selected tests
16
+ simple_opt, log, open, persist, cmd, tmpfile
17
+
18
+ Analyze SimpleOpt tests
19
+ Analyze simple_opt tests
20
+ Analyze tests: simple_opt, log, open, persist, cmd, tmpfile
21
+ Analyze tmpfile tests
22
+ Analyze Utilities tests
23
+ Assemble Annotation docs
24
+ Assemble CMD docs
25
+ Assemble CMD docs
26
+ update
27
+
28
+ Assemble Open docs
29
+ Assemble Open docs
30
+ update
31
+
32
+ Assemble Path docs
33
+ Assemble Persist docs
34
+ Assemble Persist docs
35
+ update
36
+
37
+ Assemble Resource docs
38
+ Assemble Resource docs
39
+ update
40
+
41
+ Assemble Top-level README
42
+ Assemble Top-level README
43
+ update
44
+
45
+ Assemble Top-level README draft
46
+ Assemble Utilities docs
47
+ Assemble Utilities docs
48
+ update
49
+
50
+ Confirm·Explore Utilities dirs
51
+ Explore Annotation dirs
52
+ Explore CMD dirs
53
+ Explore Log dir
54
+ Explore Log lib dir
55
+ Explore Log lib dir
56
+ refresh
57
+
58
+ Explore Log test dir
59
+ Explore Log test dir
60
+ refresh
61
+
62
+ Explore Open dirs
63
+ Explore Path dirs
64
+ Explore Persist dirs
65
+ Explore Resource dirs
66
+ Explore Utilities dirs
67
+ Finalize README step
68
+ refresh
69
+
70
+ Finalize README.md into memory key
71
+ .md
72
+
73
+ conditional
74
+
75
+ NEXT_STEPS
76
+ QA Annotation docs
77
+ QA CMD docs
78
+ QA Integrated README
79
+ QA Integrated README
80
+ post-update
81
+
82
+ QA Integrated README
83
+ post-update
84
+
85
+ refresh
86
+
87
+ QA Open docs
88
+ QA Path docs
89
+ QA Persist docs
90
+ QA Resource docs
91
+ QA Utilities docs
92
+ Read Annotation source files
93
+ Read CMD source files
94
+ Read CMD source files
95
+ refresh
96
+
97
+ Read Log source files
98
+ Read Log source files
99
+ iterate
100
+
101
+ Read Log source files
102
+ refresh
103
+
104
+ Read Log source files
105
+ use explorer output
106
+
107
+ Read Open source files
108
+ Read Open stream and lockfile
109
+ Read Path source files
110
+ Read Persist serialize and open
111
+ Read Persist source files
112
+ Read Resource scout.rb
113
+ Read Resource source files
114
+ Read SimpleOpt source files
115
+ Read TmpFile and IndiferentHash source files
116
+ Read Utilities source files
117
+ Run QA Integrator on assembled docs
118
+ Update CMD docs
119
+ assemble
120
+
121
+ Update Open docs
122
+ assemble
123
+
124
+ Update Persist docs
125
+ assemble
126
+
127
+ Update Resource docs
128
+ assemble
129
+
130
+ Update Utilities docs
131
+ assemble
132
+
133
+ final=final{
134
+ annotation.md
135
+ cmd.md
136
+ open.md
137
+ path.md
138
+ persist.md
139
+ resource.md
140
+ }
141
+ }
142
+ }
143
+ doc=doc{
144
+ Annotation.md
145
+ CMD.md
146
+ ConcurrentStream.md
147
+ IndiferentHash.md
148
+ Log.md
149
+ NamedArray.md
150
+ Open.md
151
+ Path.md
152
+ Persist.md
153
+ Resource.md
154
+ SimpleOPT.md
155
+ TmpFile.md
156
+ }
4
157
  lib=lib {
5
158
  scout-essentials.rb
6
159
  scout=scout{
7
- exceptions.rb
8
160
  annotation.rb
9
161
  annotation=annotation{
10
- array.rb
11
162
  annotated_object.rb
12
163
  annotation_module.rb
164
+ array.rb
13
165
  }
14
- misc.rb
15
- misc=misc{
16
- digest.rb
17
- filesystem.rb
18
- format.rb
19
- helper.rb
20
- insist.rb
21
- monitor.rb
22
- system.rb
23
- math.rb
24
- hook.rb
25
- matching.rb
26
- }
27
- named_array.rb
166
+ cmd.rb
167
+ concurrent_stream.rb
168
+ config.rb
169
+ exceptions.rb
28
170
  indiferent_hash.rb
29
171
  indiferent_hash=indiferent_hash{
30
172
  case_insensitive.rb
@@ -35,42 +177,49 @@ scout-essentials=/$PWD filter="*.rb *.txt *.md *.conf *.yaml" {
35
177
  color.rb
36
178
  color_class.rb
37
179
  fingerprint.rb
180
+ trap.rb
38
181
  progress.rb
39
182
  progress=progress{
40
183
  report.rb
41
184
  util.rb
42
185
  }
43
-
44
- trap.rb
45
- }
46
- simple_opt.rb
47
- simple_opt=simple_opt{
48
- accessor.rb
49
- doc.rb
50
- get.rb
51
- parse.rb
52
- setup.rb
53
186
  }
54
- path.rb
55
- path=path{
56
- find.rb
57
- tmpfile.rb
58
- util.rb
187
+ misc.rb
188
+ misc=misc{
59
189
  digest.rb
190
+ filesystem.rb
191
+ format.rb
192
+ helper.rb
193
+ hook.rb
194
+ insist.rb
195
+ matching.rb
196
+ math.rb
197
+ monitor.rb
198
+ system.rb
60
199
  }
61
- concurrent_stream.rb
62
- cmd.rb
200
+ named_array.rb
63
201
  open.rb
64
202
  open=open{
65
203
  final.rb
66
204
  lock.rb
67
205
  remote.rb
68
206
  stream.rb
69
- util.rb
70
207
  sync.rb
71
- bgzf.rb
208
+ util.rb
209
+ }
210
+ path.rb
211
+ path=path{
212
+ digest.rb
213
+ find.rb
214
+ tmpfile.rb
215
+ util.rb
216
+ }
217
+ persist.rb
218
+ persist=persist{
219
+ open.rb
220
+ path.rb
221
+ serialize.rb
72
222
  }
73
- tmpfile.rb
74
223
  resource.rb
75
224
  resource=resource{
76
225
  open.rb
@@ -81,12 +230,14 @@ scout-essentials=/$PWD filter="*.rb *.txt *.md *.conf *.yaml" {
81
230
  sync.rb
82
231
  util.rb
83
232
  }
84
- config.rb
85
- persist.rb
86
- persist=persist{
87
- open.rb
88
- path.rb
89
- serialize.rb
233
+ simple_opt.rb
234
+ tmpfile.rb
235
+ simple_opt=simple_opt{
236
+ accessor.rb
237
+ doc.rb
238
+ get.rb
239
+ parse.rb
240
+ setup.rb
90
241
  }
91
242
  }
92
243
  }
@@ -94,10 +245,6 @@ scout-essentials=/$PWD filter="*.rb *.txt *.md *.conf *.yaml" {
94
245
  test_helper.rb
95
246
  scout=scout{
96
247
  test_annotation.rb
97
- annotation=annotation{
98
- test_annotated_object.rb
99
- test_array.rb
100
- }
101
248
  test_cmd.rb
102
249
  test_concurrent_stream.rb
103
250
  test_config.rb
@@ -110,11 +257,17 @@ scout-essentials=/$PWD filter="*.rb *.txt *.md *.conf *.yaml" {
110
257
  test_persist.rb
111
258
  test_resource.rb
112
259
  test_tmpfile.rb
260
+ annotation=annotation{
261
+ test_array.rb
262
+ }
113
263
  misc=misc{
114
264
  test_digest.rb
115
265
  test_filesystem.rb
116
266
  test_helper.rb
267
+ test_hook.rb
117
268
  test_insist.rb
269
+ test_matching.rb
270
+ test_math.rb
118
271
  test_system.rb
119
272
  }
120
273
  }
data/README.md ADDED
@@ -0,0 +1,136 @@
1
+ # scout-essentials
2
+
3
+ scout-essentials is the core library of the Scout framework. It provides a small, focused set of primitives used across the rest of the Scout ecosystem: process/stream management, file and path utilities, persistence and caching, logging and progress reporting, lightweight annotations for objects, and simple option parsing. The additional, domain-level functionality lives in companion packages such as `scout-gear`, `scout-ai`, etc. — see the mikisvaz GitHub account for those repositories.
4
+
5
+ This README points you to the key modules, shows quick usage patterns and explains where to find more detailed documentation in the `doc/` directory.
6
+
7
+ ## Overview
8
+
9
+ Core capabilities included in scout-essentials:
10
+
11
+ - Process and stream management with safe concurrency: `ConcurrentStream`, `CMD`
12
+ - Robust file/stream I/O and remote access: `Open`
13
+ - File/path abstraction and package-oriented lookup: `Path`, `Resource`
14
+ - Atomic persistence and caching: `Persist`, `TmpFile`
15
+ - Logging, color output and progress reporting: `Log`
16
+ - Lightweight typed annotations on arbitrary objects: `Annotation`, `NamedArray`
17
+ - Flexible indifferent Hash and option helpers: `IndiferentHash`, `SimpleOPT` (SOPT)
18
+
19
+ Each module is documented in the repository `doc/` directory; see the "Documentation" section below for direct links.
20
+
21
+ ---
22
+
23
+ ## Documentation
24
+
25
+ Full module-level documentation is shipped in `doc/`. The most important documents are:
26
+
27
+ - doc/Annotation.md — add typed annotations to objects and arrays; AnnotatedArray
28
+ - doc/CMD.md — process execution, streaming, tool discovery and helper wrappers
29
+ - doc/ConcurrentStream.md — concurrent stream lifecycle, joining, aborting and callbacks
30
+ - doc/IndiferentHash.md — string/symbol indifferent Hash helpers and options utilities
31
+ - doc/Log.md — logging, colors, fingerprinting and ProgressBar
32
+ - doc/NamedArray.md — small record-like arrays with named fields and fuzzy matching
33
+ - doc/Open.md — unified file/stream I/O, remote fetch (wget/ssh), atomic writes, sync
34
+ - doc/Path.md — Path helpers, mapping, finding and extension utilities
35
+ - doc/Persist.md — typed serialization, persistence/caching and `Persist.persist`
36
+ - doc/Resource.md — resource production, claim/produce and rake-based producers
37
+ - doc/SimpleOPT.md — small option parsing and usage generation (SOPT)
38
+ - doc/TmpFile.md — temporary file/dir helpers and stable cache path generator
39
+
40
+ Open those files for detailed API descriptions, examples and notes.
41
+
42
+ ---
43
+
44
+ ## Quick start (examples)
45
+
46
+ These short snippets show typical usage patterns — the docs in `doc/` contain more detail and examples.
47
+
48
+ Annotation:
49
+ ```ruby
50
+ module Tag
51
+ extend Annotation
52
+ annotation :code, :note
53
+ end
54
+
55
+ s = "hello"
56
+ Tag.setup(s, :code) # s.code -> :code
57
+ s2 = "other"
58
+ s.annotate(s2) # copies annotations
59
+ ```
60
+
61
+ Open (reading a file, auto-decompress):
62
+ ```ruby
63
+ content = Open.read("data.tsv.gz")
64
+ ```
65
+
66
+ Persist (cache a computed value):
67
+ ```ruby
68
+ value = Persist.persist("my-result", :json, dir: Path.setup("var/cache")) do
69
+ expensive_computation()
70
+ end
71
+ ```
72
+
73
+ CMD + ConcurrentStream (run a pipeline):
74
+ ```ruby
75
+ io = CMD.cmd("tail -n 100", :in => some_file_io, :pipe => true)
76
+ io2 = CMD.cmd("grep foo", :in => io, :pipe => true)
77
+ puts io2.read
78
+ io2.join
79
+ ```
80
+
81
+ Log + ProgressBar:
82
+ ```ruby
83
+ Log::ProgressBar.with_bar(100, desc: "Working") do |bar|
84
+ 100.times { bar.tick; work_item }
85
+ end
86
+ ```
87
+
88
+ Path + Resource:
89
+ ```ruby
90
+ # Resource modules typically claim resources and produce them on demand.
91
+ # Accessing a Path calls produce, so opening a resource Path triggers creation.
92
+ p = Path.setup("share/data/myfile", 'mypkg')
93
+ p.produce
94
+ Open.read(p)
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Running tests
100
+
101
+ The test suite exercises the modules (unit tests use Test::Unit). To run the tests in this repository, use your normal Ruby test runner; the test files are under `test/` — examples:
102
+
103
+ ```bash
104
+ # from repository root
105
+ ruby -Ilib test/scout/test_tmpfile.rb
106
+ # or run the whole suite with your preferred runner
107
+ ```
108
+
109
+ Tests in the suite show practical usages and edge cases for the provided utilities.
110
+
111
+ ---
112
+
113
+ ## Related projects
114
+
115
+ scout-essentials is intentionally focused on low-level primitives. Higher-level, domain-specific functionality is implemented in companion projects maintained on the mikisvaz GitHub account (look for repositories named `scout-gear`, `scout-ai`, etc.). Those packages build on what you find here to provide workflows, tools and integrations.
116
+
117
+ GitHub: https://github.com/mikisvaz
118
+ Look for repositories that begin with `scout-` (e.g. `scout-gear`, `scout-ai`).
119
+
120
+ ---
121
+
122
+ ## Contributing
123
+
124
+ Contributions and improvements are welcome. Please follow the repository contribution guidelines (if present) or submit issues / pull requests on the project repository.
125
+
126
+ If you extend or reuse code from this package in companion packages, prefer to keep core primitives here and implement domain logic in separate modules/packages (as done by the Scout ecosystem).
127
+
128
+ ---
129
+
130
+ ## License
131
+
132
+ See the repository LICENSE (if present) for licensing information.
133
+
134
+ ---
135
+
136
+ If you need help finding a specific API, open the corresponding file in `doc/` (listed above) or search the `lib/` tree for concrete implementations and tests in `test/` for usage examples.
data/Rakefile CHANGED
@@ -20,6 +20,7 @@ Juwelier::Tasks.new do |gem|
20
20
  gem.add_runtime_dependency 'term-ansicolor'
21
21
  gem.add_runtime_dependency 'yaml'
22
22
  gem.add_runtime_dependency 'rake'
23
+ gem.add_runtime_dependency 'listen'
23
24
  end
24
25
  Juwelier::RubygemsDotOrgTasks.new
25
26
  require 'rake/testtask'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.1
1
+ 1.8.0