tayle 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/lib/tayle/version.rb +1 -1
- data/rakelib/rbs.rake +61 -0
- data/sig/manifest.yaml +2 -0
- data/sig/tayle/command.rbs +26 -0
- data/sig/tayle/gnu_tail.rbs +22 -0
- data/sig/tayle/version.rbs +3 -0
- data/sig/tayle/writer.rbs +17 -0
- data/sig/tayle.rbs +39 -0
- metadata +8 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a65760090afbdffc216ac783b3d12eabb027d12cfc5e7400562c5bce648fecc2
|
|
4
|
+
data.tar.gz: 9472e410596c4cd47414279c191655731792626d4460be0defa6e3dd5e333dc2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1758346dbb7deb61cfcc5d2497bb475b7215fbb37568823ef1b2471af4a0a8160411eeb3e1107c299fa852cd07b4518721739d6499e6944275eac864e88783ea
|
|
7
|
+
data.tar.gz: 88c85b7d0bc9b67cc40d653a26c0e76c2fc5d39d5cc5226c3ea36662adda266e2ca4484198278ce73a111a32a41085d80f4b39cfd4f0d9fbe152b928e6a144c2
|
data/lib/tayle/version.rb
CHANGED
data/rakelib/rbs.rake
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require "yaml"
|
|
2
|
+
|
|
3
|
+
namespace :rbs do
|
|
4
|
+
root_dir = Pathname(__dir__).parent
|
|
5
|
+
collection_yaml = root_dir / "rbs_collection.yaml"
|
|
6
|
+
collection_dir = root_dir / ".gem_rbs_collection"
|
|
7
|
+
manifest = root_dir / "sig" / "manifest.yaml"
|
|
8
|
+
|
|
9
|
+
# The stdlib signatures sig/manifest.yaml names, as rbs -r flags; the
|
|
10
|
+
# manifest only applies by itself when the gem's sig is loaded as a library.
|
|
11
|
+
stdlib_flags = lambda do
|
|
12
|
+
YAML.safe_load_file(manifest).fetch("dependencies").flat_map { ["-r", it.fetch("name")] }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
desc "Install the rbs collection rbs_collection.lock.yaml pins"
|
|
16
|
+
task setup: ["rbs:collection:install"]
|
|
17
|
+
|
|
18
|
+
desc "Remove the installed rbs collection"
|
|
19
|
+
task :clobber do
|
|
20
|
+
rm_rf collection_dir
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
desc "Check every signature under sig parses and names only types that exist"
|
|
24
|
+
task validate: ["rbs:collection:install"] do
|
|
25
|
+
sh "bundle", "exec", "rbs", "-I", "sig", *stdlib_flags.call, "validate"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Enumerators go unchecked: the checker samples one by iterating, and the
|
|
29
|
+
# Enumerator #each returns blocks on tail until the log grows.
|
|
30
|
+
desc "Run the specs with every Tayle call checked against its signature"
|
|
31
|
+
task test: ["rbs:collection:install"] do
|
|
32
|
+
env = {
|
|
33
|
+
"RBS_TEST_TARGET" => "Tayle,Tayle::*",
|
|
34
|
+
"RBS_TEST_OPT" => ["-I", "sig", *stdlib_flags.call].join(" "),
|
|
35
|
+
"RBS_TEST_LOGLEVEL" => "warn",
|
|
36
|
+
"RBS_TEST_DOUBLE_SUITE" => "rspec",
|
|
37
|
+
"RBS_TEST_UNCHECKED_CLASSES" => "Enumerator",
|
|
38
|
+
"RUBYOPT" => "-r rbs/test/setup",
|
|
39
|
+
}
|
|
40
|
+
sh env, "bundle", "exec", "rspec"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
namespace :collection do
|
|
44
|
+
file collection_yaml.to_s do
|
|
45
|
+
sh "bundle exec rbs collection init"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
desc "Write rbs_collection.yaml if it is missing"
|
|
49
|
+
task init: [collection_yaml.to_s]
|
|
50
|
+
|
|
51
|
+
desc "Install the gem RBS files the collection lists"
|
|
52
|
+
task install: ["rbs:collection:init"] do
|
|
53
|
+
sh "bundle exec rbs collection install"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
desc "Re-resolve the collection and rewrite rbs_collection.lock.yaml"
|
|
57
|
+
task :update do
|
|
58
|
+
sh "bundle exec rbs collection update"
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
data/sig/manifest.yaml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class Tayle
|
|
2
|
+
# Private constants; RBS has no private_constant.
|
|
3
|
+
POSITIONS: Array[position]
|
|
4
|
+
|
|
5
|
+
# The tail invocation: argv for one path, writer and start position.
|
|
6
|
+
class Command < Data
|
|
7
|
+
attr_reader executable: Pathname
|
|
8
|
+
attr_reader path: Pathname
|
|
9
|
+
attr_reader writer: Writer?
|
|
10
|
+
attr_reader position: position
|
|
11
|
+
|
|
12
|
+
def self.new: (executable: Pathname, path: String | Pathname, writer: Writer?, position: position) -> instance
|
|
13
|
+
| (Pathname executable, String | Pathname path, Writer? writer, position position) -> instance
|
|
14
|
+
|
|
15
|
+
def self.members: () -> [:executable, :path, :writer, :position]
|
|
16
|
+
|
|
17
|
+
# Raises ArgumentError for any Symbol but :start or :end.
|
|
18
|
+
def initialize: (executable: Pathname, path: String | Pathname, writer: Writer?, position: Symbol) -> void
|
|
19
|
+
|
|
20
|
+
def argv: () -> Array[String]
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def first_byte: () -> Integer
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
class Tayle
|
|
2
|
+
OLDEST_SUPPORTED_VERSION: [Integer, Integer]
|
|
3
|
+
|
|
4
|
+
# A located tail executable and its coreutils version, nil when not GNU.
|
|
5
|
+
class GnuTail < Data
|
|
6
|
+
attr_reader executable: Pathname
|
|
7
|
+
attr_reader version: [Integer, Integer]?
|
|
8
|
+
|
|
9
|
+
def self.new: (executable: Pathname, version: [Integer, Integer]?) -> instance
|
|
10
|
+
| (Pathname executable, [Integer, Integer]? version) -> instance
|
|
11
|
+
|
|
12
|
+
def self.members: () -> [:executable, :version]
|
|
13
|
+
|
|
14
|
+
def self.locate: (String | Pathname command) -> instance
|
|
15
|
+
|
|
16
|
+
private def self.list_candidates: (String | Pathname command) -> Array[Pathname]
|
|
17
|
+
|
|
18
|
+
private def self.read_version: (Pathname executable) -> [Integer, Integer]?
|
|
19
|
+
|
|
20
|
+
def check_supported: () -> void
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class Tayle
|
|
2
|
+
# The process writing the log; tail --pid exits once it is reaped.
|
|
3
|
+
class Writer < Data
|
|
4
|
+
attr_reader pid: Integer
|
|
5
|
+
|
|
6
|
+
def self.new: (pid: Integer | String) -> instance
|
|
7
|
+
| (Integer | String pid) -> instance
|
|
8
|
+
|
|
9
|
+
def self.members: () -> [:pid]
|
|
10
|
+
|
|
11
|
+
def initialize: (pid: Integer | String) -> void
|
|
12
|
+
|
|
13
|
+
def flag: () -> String
|
|
14
|
+
|
|
15
|
+
def gone?: () -> bool
|
|
16
|
+
end
|
|
17
|
+
end
|
data/sig/tayle.rbs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
class Tayle
|
|
2
|
+
include Enumerable[String]
|
|
3
|
+
|
|
4
|
+
# Where reading begins: the file's current end, or its first byte.
|
|
5
|
+
type position = :start | :end
|
|
6
|
+
|
|
7
|
+
LOADER: Zeitwerk::GemLoader
|
|
8
|
+
|
|
9
|
+
class Unsupported < StandardError
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class Exited < StandardError
|
|
13
|
+
# nil if something else reaped tail first.
|
|
14
|
+
attr_reader status: Process::Status?
|
|
15
|
+
|
|
16
|
+
def initialize: (status: Process::Status?) -> void
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
attr_reader lines_read: Integer
|
|
20
|
+
|
|
21
|
+
# Any Symbol reaches Command, which raises ArgumentError unless it is :start or :end;
|
|
22
|
+
# writer_pid is coerced with Integer(), so a non-numeric String raises the same.
|
|
23
|
+
def initialize: (String | Pathname path, ?writer_pid: (Integer | String)?, ?tail_path: String | Pathname, ?position: Symbol) ?{ (Tayle) -> void } -> void
|
|
24
|
+
|
|
25
|
+
def path: () -> Pathname
|
|
26
|
+
|
|
27
|
+
def position: () -> position
|
|
28
|
+
|
|
29
|
+
def each: (?chomp: bool) { (String) -> void } -> self
|
|
30
|
+
| (?chomp: bool) -> Enumerator[String, self]
|
|
31
|
+
|
|
32
|
+
alias each_line each
|
|
33
|
+
|
|
34
|
+
def close: () -> void
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def yield_and_close: [T] () { (Tayle) -> T } -> T
|
|
39
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tayle
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Gillis
|
|
@@ -40,6 +40,13 @@ files:
|
|
|
40
40
|
- lib/tayle/gnu_tail.rb
|
|
41
41
|
- lib/tayle/version.rb
|
|
42
42
|
- lib/tayle/writer.rb
|
|
43
|
+
- rakelib/rbs.rake
|
|
44
|
+
- sig/manifest.yaml
|
|
45
|
+
- sig/tayle.rbs
|
|
46
|
+
- sig/tayle/command.rbs
|
|
47
|
+
- sig/tayle/gnu_tail.rbs
|
|
48
|
+
- sig/tayle/version.rbs
|
|
49
|
+
- sig/tayle/writer.rbs
|
|
43
50
|
licenses:
|
|
44
51
|
- MIT
|
|
45
52
|
metadata:
|