sxn 0.2.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.
- checksums.yaml +7 -0
- data/.gem_rbs_collection/addressable/2.8/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/addressable/2.8/addressable.rbs +62 -0
- data/.gem_rbs_collection/async/2.12/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/async/2.12/async.rbs +119 -0
- data/.gem_rbs_collection/async/2.12/kernel.rbs +5 -0
- data/.gem_rbs_collection/async/2.12/manifest.yaml +7 -0
- data/.gem_rbs_collection/bcrypt/3.1/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/bcrypt/3.1/bcrypt.rbs +47 -0
- data/.gem_rbs_collection/bcrypt/3.1/manifest.yaml +2 -0
- data/.gem_rbs_collection/bigdecimal/3.1/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/bigdecimal/3.1/bigdecimal-math.rbs +119 -0
- data/.gem_rbs_collection/bigdecimal/3.1/bigdecimal.rbs +1630 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/array.rbs +4 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/executor.rbs +26 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/hash.rbs +4 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/map.rbs +65 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/promises.rbs +249 -0
- data/.gem_rbs_collection/concurrent-ruby/1.1/utility/processor_counter.rbs +5 -0
- data/.gem_rbs_collection/diff-lcs/1.5/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/diff-lcs/1.5/diff-lcs.rbs +11 -0
- data/.gem_rbs_collection/listen/3.9/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/listen/3.9/listen.rbs +25 -0
- data/.gem_rbs_collection/listen/3.9/listener.rbs +24 -0
- data/.gem_rbs_collection/mini_mime/0.1/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/mini_mime/0.1/mini_mime.rbs +14 -0
- data/.gem_rbs_collection/parallel/1.20/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/parallel/1.20/parallel.rbs +86 -0
- data/.gem_rbs_collection/rake/13.0/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/rake/13.0/manifest.yaml +2 -0
- data/.gem_rbs_collection/rake/13.0/rake.rbs +39 -0
- data/.gem_rbs_collection/rubocop-ast/1.46/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/rubocop-ast/1.46/rubocop-ast.rbs +822 -0
- data/.gem_rbs_collection/sqlite3/2.0/.rbs_meta.yaml +9 -0
- data/.gem_rbs_collection/sqlite3/2.0/database.rbs +20 -0
- data/.gem_rbs_collection/sqlite3/2.0/pragmas.rbs +5 -0
- data/.rspec +4 -0
- data/.rubocop.yml +121 -0
- data/.simplecov +51 -0
- data/CHANGELOG.md +49 -0
- data/Gemfile +24 -0
- data/Gemfile.lock +329 -0
- data/LICENSE.txt +21 -0
- data/README.md +225 -0
- data/Rakefile +54 -0
- data/Steepfile +50 -0
- data/bin/sxn +6 -0
- data/lib/sxn/CLI.rb +275 -0
- data/lib/sxn/commands/init.rb +137 -0
- data/lib/sxn/commands/projects.rb +350 -0
- data/lib/sxn/commands/rules.rb +435 -0
- data/lib/sxn/commands/sessions.rb +300 -0
- data/lib/sxn/commands/worktrees.rb +416 -0
- data/lib/sxn/commands.rb +13 -0
- data/lib/sxn/config/config_cache.rb +295 -0
- data/lib/sxn/config/config_discovery.rb +242 -0
- data/lib/sxn/config/config_validator.rb +562 -0
- data/lib/sxn/config.rb +259 -0
- data/lib/sxn/core/config_manager.rb +290 -0
- data/lib/sxn/core/project_manager.rb +307 -0
- data/lib/sxn/core/rules_manager.rb +306 -0
- data/lib/sxn/core/session_manager.rb +336 -0
- data/lib/sxn/core/worktree_manager.rb +281 -0
- data/lib/sxn/core.rb +13 -0
- data/lib/sxn/database/errors.rb +29 -0
- data/lib/sxn/database/session_database.rb +691 -0
- data/lib/sxn/database.rb +24 -0
- data/lib/sxn/errors.rb +76 -0
- data/lib/sxn/rules/base_rule.rb +367 -0
- data/lib/sxn/rules/copy_files_rule.rb +346 -0
- data/lib/sxn/rules/errors.rb +28 -0
- data/lib/sxn/rules/project_detector.rb +871 -0
- data/lib/sxn/rules/rules_engine.rb +485 -0
- data/lib/sxn/rules/setup_commands_rule.rb +307 -0
- data/lib/sxn/rules/template_rule.rb +262 -0
- data/lib/sxn/rules.rb +148 -0
- data/lib/sxn/runtime_validations.rb +96 -0
- data/lib/sxn/security/secure_command_executor.rb +364 -0
- data/lib/sxn/security/secure_file_copier.rb +478 -0
- data/lib/sxn/security/secure_path_validator.rb +258 -0
- data/lib/sxn/security.rb +15 -0
- data/lib/sxn/templates/common/gitignore.liquid +99 -0
- data/lib/sxn/templates/common/session-info.md.liquid +58 -0
- data/lib/sxn/templates/errors.rb +36 -0
- data/lib/sxn/templates/javascript/README.md.liquid +59 -0
- data/lib/sxn/templates/javascript/session-info.md.liquid +206 -0
- data/lib/sxn/templates/rails/CLAUDE.md.liquid +78 -0
- data/lib/sxn/templates/rails/database.yml.liquid +31 -0
- data/lib/sxn/templates/rails/session-info.md.liquid +144 -0
- data/lib/sxn/templates/template_engine.rb +346 -0
- data/lib/sxn/templates/template_processor.rb +279 -0
- data/lib/sxn/templates/template_security.rb +410 -0
- data/lib/sxn/templates/template_variables.rb +713 -0
- data/lib/sxn/templates.rb +28 -0
- data/lib/sxn/ui/output.rb +103 -0
- data/lib/sxn/ui/progress_bar.rb +91 -0
- data/lib/sxn/ui/prompt.rb +116 -0
- data/lib/sxn/ui/table.rb +183 -0
- data/lib/sxn/ui.rb +12 -0
- data/lib/sxn/version.rb +5 -0
- data/lib/sxn.rb +63 -0
- data/rbs_collection.lock.yaml +180 -0
- data/rbs_collection.yaml +39 -0
- data/scripts/test.sh +31 -0
- data/sig/external/liquid.rbs +116 -0
- data/sig/external/thor.rbs +99 -0
- data/sig/external/tty.rbs +71 -0
- data/sig/sxn/cli.rbs +46 -0
- data/sig/sxn/commands/init.rbs +38 -0
- data/sig/sxn/commands/projects.rbs +72 -0
- data/sig/sxn/commands/rules.rbs +95 -0
- data/sig/sxn/commands/sessions.rbs +62 -0
- data/sig/sxn/commands/worktrees.rbs +82 -0
- data/sig/sxn/commands.rbs +6 -0
- data/sig/sxn/config/config_cache.rbs +67 -0
- data/sig/sxn/config/config_discovery.rbs +64 -0
- data/sig/sxn/config/config_validator.rbs +64 -0
- data/sig/sxn/config.rbs +74 -0
- data/sig/sxn/core/config_manager.rbs +67 -0
- data/sig/sxn/core/project_manager.rbs +52 -0
- data/sig/sxn/core/rules_manager.rbs +54 -0
- data/sig/sxn/core/session_manager.rbs +59 -0
- data/sig/sxn/core/worktree_manager.rbs +50 -0
- data/sig/sxn/core.rbs +87 -0
- data/sig/sxn/database/errors.rbs +37 -0
- data/sig/sxn/database/session_database.rbs +151 -0
- data/sig/sxn/database.rbs +83 -0
- data/sig/sxn/errors.rbs +89 -0
- data/sig/sxn/rules/base_rule.rbs +137 -0
- data/sig/sxn/rules/copy_files_rule.rbs +65 -0
- data/sig/sxn/rules/errors.rbs +33 -0
- data/sig/sxn/rules/project_detector.rbs +115 -0
- data/sig/sxn/rules/rules_engine.rbs +118 -0
- data/sig/sxn/rules/setup_commands_rule.rbs +60 -0
- data/sig/sxn/rules/template_rule.rbs +44 -0
- data/sig/sxn/rules.rbs +287 -0
- data/sig/sxn/runtime_validations.rbs +16 -0
- data/sig/sxn/security/secure_command_executor.rbs +63 -0
- data/sig/sxn/security/secure_file_copier.rbs +79 -0
- data/sig/sxn/security/secure_path_validator.rbs +30 -0
- data/sig/sxn/security.rbs +128 -0
- data/sig/sxn/templates/errors.rbs +43 -0
- data/sig/sxn/templates/template_engine.rbs +50 -0
- data/sig/sxn/templates/template_processor.rbs +44 -0
- data/sig/sxn/templates/template_security.rbs +62 -0
- data/sig/sxn/templates/template_variables.rbs +103 -0
- data/sig/sxn/templates.rbs +104 -0
- data/sig/sxn/ui/output.rbs +50 -0
- data/sig/sxn/ui/progress_bar.rbs +39 -0
- data/sig/sxn/ui/prompt.rbs +38 -0
- data/sig/sxn/ui/table.rbs +43 -0
- data/sig/sxn/ui.rbs +63 -0
- data/sig/sxn/version.rbs +5 -0
- data/sig/sxn.rbs +29 -0
- metadata +635 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
module Concurrent
|
2
|
+
module ExecutorService
|
3
|
+
interface _Task
|
4
|
+
def call: () -> void
|
5
|
+
end
|
6
|
+
|
7
|
+
def post: [A] (*A args) { (*A args) -> void } -> bool
|
8
|
+
|
9
|
+
def <<: (_Task task) -> bool
|
10
|
+
|
11
|
+
def can_overflow?: () -> bool
|
12
|
+
|
13
|
+
def serialized?: () -> bool
|
14
|
+
end
|
15
|
+
|
16
|
+
type executor = ExecutorService | :io | :fast | :immediate
|
17
|
+
|
18
|
+
def self.executor: (executor executor_identifier) -> ExecutorService
|
19
|
+
|
20
|
+
def self.global_io_executor: () -> ExecutorService
|
21
|
+
def self.global_fast_executor: () -> ExecutorService
|
22
|
+
def self.global_immediate_executor: () -> ExecutorService
|
23
|
+
|
24
|
+
def self.new_io_executor: (?Hash[Symbol, untyped] opts) -> ExecutorService
|
25
|
+
def self.new_fast_executor: (?Hash[Symbol, untyped] opts) -> ExecutorService
|
26
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Concurrent
|
2
|
+
class Map[unchecked out K, unchecked out V]
|
3
|
+
def initialize: (?Hash[Symbol, untyped] options) ?{ (self, untyped) -> V } -> void
|
4
|
+
|
5
|
+
def []: (untyped key) -> V?
|
6
|
+
def []=: (K key, V value) -> V
|
7
|
+
|
8
|
+
alias get []
|
9
|
+
alias put []=
|
10
|
+
|
11
|
+
def compute: (K key) { (V? old_value) -> V } -> V
|
12
|
+
| (K key) { (V? old_value) -> nil } -> nil
|
13
|
+
|
14
|
+
def compute_if_absent: (K key) { () -> V } -> V
|
15
|
+
|
16
|
+
def compute_if_present: (K key) { (V old_value) -> V? } -> V?
|
17
|
+
|
18
|
+
def fetch: (untyped key) -> V
|
19
|
+
| [D] (untyped key, D default_value) -> (V | D)
|
20
|
+
| [T, D] (T key) { (T key) -> D } -> (V | D)
|
21
|
+
|
22
|
+
def fetch_or_store: (untyped key) -> V
|
23
|
+
| (K key, V default_value) -> V
|
24
|
+
| (K key) { (K key) -> V } -> V
|
25
|
+
|
26
|
+
def put_if_absent: (K key, V value) -> V?
|
27
|
+
|
28
|
+
def value?: (untyped value) -> bool
|
29
|
+
|
30
|
+
def keys: () -> Array[K]
|
31
|
+
|
32
|
+
def values: () -> Array[V]
|
33
|
+
|
34
|
+
def each_key: () { (K key) -> void } -> self
|
35
|
+
|
36
|
+
def each_value: () { (V value) -> void } -> self
|
37
|
+
|
38
|
+
def each_pair: () { (K key, V value) -> void } -> self
|
39
|
+
|
40
|
+
alias each each_pair
|
41
|
+
|
42
|
+
def key: (untyped value) -> K?
|
43
|
+
|
44
|
+
def empty?: () -> bool
|
45
|
+
|
46
|
+
def size: () -> Integer
|
47
|
+
|
48
|
+
def marshal_dump: () -> Hash[K, V]
|
49
|
+
def marshal_load: (Hash[K, V] hash) -> self
|
50
|
+
|
51
|
+
# undef :freeze
|
52
|
+
|
53
|
+
def inspect: () -> String
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def raise_fetch_no_key: () -> bot
|
58
|
+
|
59
|
+
def initialize_copy: (instance other) -> void
|
60
|
+
|
61
|
+
def populate_from: (Hash[K, V] hash) -> self
|
62
|
+
|
63
|
+
def validate_options_hash!: (Hash[Symbol, untyped] options) -> void
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,249 @@
|
|
1
|
+
module Concurrent
|
2
|
+
module Promises
|
3
|
+
module FactoryMethods
|
4
|
+
def any_event: (*(Event | Future[top, top]) futures_and_or_events) -> Event
|
5
|
+
def any_event_on: (executor default_executor, *(Event | Future[top, top]) futures_and_or_events) -> Event
|
6
|
+
|
7
|
+
def any_fulfilled_future: (*Event events) -> Future[nil, bot]
|
8
|
+
| [T, E] (*Future[T, E] futures) -> Future[T, E]
|
9
|
+
| [T, E] (*(Event | Future[T, E]) futures_and_or_events) -> Future[T | nil, E]
|
10
|
+
def any_fulfilled_future_on: (executor default_executor, *Event events) -> Future[nil, bot]
|
11
|
+
| [T, E] (executor default_executor, *Future[T, E] futures) -> Future[T, E]
|
12
|
+
| [T, E] (executor default_executor, *(Event | Future[T, E]) futures_and_or_events) -> Future[T | nil, E]
|
13
|
+
|
14
|
+
def any_resolved_future: (*Event events) -> Future[nil, bot]
|
15
|
+
| [T, E] (*Future[T, E] futures) -> Future[T, E]
|
16
|
+
| [T, E] (*(Event | Future[T, E]) futures_and_or_events) -> Future[T | nil, E]
|
17
|
+
alias any any_resolved_future
|
18
|
+
def any_resolved_future_on: (executor default_executor, *Event events) -> Future[nil, bot]
|
19
|
+
| [T, E] (executor default_executor, *Future[T, E] futures) -> Future[T, E]
|
20
|
+
| [T, E] (executor default_executor, *(Event | Future[T, E]) futures_and_or_events) -> Future[T | nil, E]
|
21
|
+
|
22
|
+
def default_executor: () -> executor
|
23
|
+
|
24
|
+
def delay: () -> Event
|
25
|
+
| [A, T] (*A args) { (*A args) -> T } -> Future[T, Exception]
|
26
|
+
def delay_on: (executor default_executor) -> Event
|
27
|
+
| [A, T] (executor default_executor, *A args) { (*A args) -> T } -> Future[T, Exception]
|
28
|
+
|
29
|
+
def fulfilled_future: [T] (T value, ?executor default_executor) -> Future[T, bot]
|
30
|
+
|
31
|
+
def future: [A, T] (*A args) { (*A args) -> T } -> Future[T, Exception]
|
32
|
+
def future_on: [A, T] (executor default_executor, *A args) { (*A args) -> T } -> Future[T, Exception]
|
33
|
+
|
34
|
+
def make_future: (nil, ?executor default_executor) -> Event
|
35
|
+
| [X < AbstractEventFuture] (X event_or_future, ?executor default_executor) -> X
|
36
|
+
| [E < Exception] (E reason, ?executor default_executor) -> Future[bot, E]
|
37
|
+
| [T] (T value, ?executor default_executor) -> Future[T, bot]
|
38
|
+
|
39
|
+
def rejected_future: [E] (E reason, ?executor default_executor) -> Future[bot, E]
|
40
|
+
|
41
|
+
def resolvable_event: () -> ResolvableEvent
|
42
|
+
def resolvable_event_on: (executor default_executor) -> ResolvableEvent
|
43
|
+
|
44
|
+
def resolvable_future: () -> ResolvableFuture[untyped, untyped]
|
45
|
+
def resolvable_future_on: (executor default_executor) -> ResolvableFuture[untyped, untyped]
|
46
|
+
|
47
|
+
def resolved_event: (?executor default_executor) -> Event
|
48
|
+
|
49
|
+
def resolved_future: [T] (true fulfilled, T value, top reason, ?executor default_executor) -> Future[T, bot]
|
50
|
+
| [E] (false fulfilled, top value, E reason, ?executor default_executor) -> Future[bot, E]
|
51
|
+
| [T, E] (boolish fulfilled, T? value, E? reason, ?executor default_executor) -> Future[T, E]
|
52
|
+
|
53
|
+
def schedule: (Numeric | Time intended_time) -> Event
|
54
|
+
| [A, T] (Numeric | Time intended_time, *A args) { (*A args) -> T } -> Future[T, Exception]
|
55
|
+
def schedule_on: (executor default_executor, Numeric | Time intended_time) -> Event
|
56
|
+
| [A, T] (executor default_executor, Numeric | Time intended_time, *A args) { (*A args) -> T } -> Future[T, Exception]
|
57
|
+
|
58
|
+
def zip_events: (*(Event | Future[top, top]) futures_and_or_events) -> Event
|
59
|
+
def zip_events_on: (executor default_executor, *(Event | Future[top, top]) futures_and_or_events) -> Event
|
60
|
+
|
61
|
+
def zip_futures: (*Event events) -> Future[::Array[nil], bot]
|
62
|
+
| [T, E] (*Future[T, E] futures) -> Future[::Array[T], ::Array[E]]
|
63
|
+
| [T, E] (*(Event | Future[T, E]) futures_and_or_events) -> Future[::Array[T | nil], ::Array[E | nil]]
|
64
|
+
alias zip zip_futures
|
65
|
+
def zip_futures_on: (executor default_executor, *Event events) -> Future[Array[nil], bot]
|
66
|
+
| [T, E] (executor default_executor, *Future[T, E] futures) -> Future[Array[T], Array[E]]
|
67
|
+
| [T, E] (executor default_executor, *(Event | Future[T, E]) futures_and_or_events) -> Future[Array[T | nil], Array[E]]
|
68
|
+
end
|
69
|
+
|
70
|
+
extend FactoryMethods
|
71
|
+
|
72
|
+
class AbstractEventFuture
|
73
|
+
def chain: [A, U] (*A args) { (*untyped) -> U } -> Future[U, Exception]
|
74
|
+
def chain_on: [A, U] (executor executor, *A args) { (*untyped) -> U } -> Future[U, Exception]
|
75
|
+
|
76
|
+
def chain_resolvable: (Resolvable resolvable) -> self
|
77
|
+
alias tangle chain_resolvable
|
78
|
+
|
79
|
+
def default_executor: () -> executor
|
80
|
+
|
81
|
+
def internal_state: () -> Object
|
82
|
+
|
83
|
+
def on_resolution: [A] (*A args) { (*untyped) -> void } -> self
|
84
|
+
def on_resolution!: [A] (*A args) { (*untyped) -> void } -> self
|
85
|
+
def on_resolution_using: [A] (executor executor, *A args) { (*untyped) -> void } -> self
|
86
|
+
|
87
|
+
def resolved?: () -> bool
|
88
|
+
|
89
|
+
def pending?: () -> bool
|
90
|
+
|
91
|
+
def state: () -> Symbol
|
92
|
+
|
93
|
+
def touch: () -> self
|
94
|
+
|
95
|
+
def wait: (?nil) -> self
|
96
|
+
| (Numeric timeout) -> bool
|
97
|
+
end
|
98
|
+
|
99
|
+
class Event < AbstractEventFuture
|
100
|
+
def any: (Event | Future[top, top] event_or_future) -> Event
|
101
|
+
alias | any
|
102
|
+
|
103
|
+
def delay: () -> Event
|
104
|
+
|
105
|
+
def schedule: (Numeric | Time intended_time) -> Event
|
106
|
+
|
107
|
+
def to_event: () -> self
|
108
|
+
|
109
|
+
def to_future: () -> Future[nil, bot]
|
110
|
+
|
111
|
+
def with_default_executor: (executor executor) -> Event
|
112
|
+
|
113
|
+
def zip: (Event event) -> Event
|
114
|
+
| [T, E] (Future[T, E] future) -> Future[T, E]
|
115
|
+
alias & zip
|
116
|
+
|
117
|
+
|
118
|
+
## Following methods are actually defined in the base class and have specific types for Event
|
119
|
+
|
120
|
+
def chain: [A, U] (*A args) { (*A args) -> U } -> Future[U, Exception]
|
121
|
+
def chain_on: [A, U] (executor executor, *A args) { (*A args) -> U } -> Future[U, Exception]
|
122
|
+
|
123
|
+
def on_resolution: [A] (*A args) { (*A args) -> void } -> self
|
124
|
+
def on_resolution!: [A] (*A args) { (*A args) -> void } -> self
|
125
|
+
def on_resolution_using: [A] (executor executor, *A args) { (*A args) -> void } -> self
|
126
|
+
|
127
|
+
def state: () -> (:pending | :resolved)
|
128
|
+
end
|
129
|
+
|
130
|
+
class Future[out T, out E] < AbstractEventFuture
|
131
|
+
def any: (Event event) -> Future[T | nil, E]
|
132
|
+
| [T2, E2] (Future[T2, E2] future) -> Future[T | T2, E | E2]
|
133
|
+
alias | any
|
134
|
+
|
135
|
+
def delay: () -> Future[T, E]
|
136
|
+
|
137
|
+
def exception: () -> Exception # TODO: Return type can be narrowed to E when E <: Exception
|
138
|
+
|
139
|
+
def flat_event: () -> Event
|
140
|
+
|
141
|
+
def flat_future: (?Integer level) -> untyped # TODO: Valid only if T <: Future[top, top]
|
142
|
+
alias flat flat_future
|
143
|
+
|
144
|
+
def fulfilled?: () -> bool
|
145
|
+
|
146
|
+
def on_fulfillment: [A] (*A args) { (T value, *A args) -> void } -> self
|
147
|
+
def on_fulfillment!: [A] (*A args) { (T value, *A args) -> void } -> self
|
148
|
+
def on_fulfillment_using: [A] (executor executor, *A args) { (T value, A args) -> void } -> self
|
149
|
+
|
150
|
+
def on_rejection: [A] (*A args) { (E reason, *A args) -> void } -> self
|
151
|
+
def on_rejection!: [A] (*A args) { (E reason, *A args) -> void } -> self
|
152
|
+
def on_rejection_using: [A] (executor executor, *A args) { (E reason, A args) -> void } -> self
|
153
|
+
|
154
|
+
def reason: (?Numeric timeout) -> (E | nil)
|
155
|
+
| [R] (Numeric timeout, R timeout_value) -> (E | R | nil)
|
156
|
+
|
157
|
+
def rejected?: () -> bool
|
158
|
+
|
159
|
+
def rescue: [A, U] (*A args) { (E reason, *A args) -> U } -> Future[U, Exception]
|
160
|
+
def rescue_on: [A, U] (executor executor, *A args) { (E reason, *A args) -> U } -> Future[U, Exception]
|
161
|
+
|
162
|
+
def result: (?nil) -> ([true, T, nil] | [false, nil, E])
|
163
|
+
| (Numeric timeout) -> ([true, T, nil] | [false, nil, E] | nil)
|
164
|
+
|
165
|
+
def run: (?^(untyped) -> Future[untyped, untyped]? run_test) -> Future[untyped, untyped] # TODO: Any specific type?
|
166
|
+
|
167
|
+
def schedule: (Numeric | Time intended_time) -> Future[T, E]
|
168
|
+
|
169
|
+
def then: [A, U] (*A args) { (T value, *A args) -> U } -> Future[U, E | Exception]
|
170
|
+
def then_on: [A, U] (executor executor, *A args) { (T value, *A args) -> U } -> Future[U, E | Exception]
|
171
|
+
|
172
|
+
def to_event: () -> Event
|
173
|
+
|
174
|
+
def to_future: () -> self
|
175
|
+
|
176
|
+
def value: (?Numeric timeout) -> (T | nil)
|
177
|
+
| [R] (Numeric timeout, R timeout_value) -> (T | R | nil)
|
178
|
+
def value!: (?nil) -> T
|
179
|
+
| (Numeric timeout) -> (T | nil)
|
180
|
+
| [R] (Numeric timeout, R timeout_value) -> (T | R | nil)
|
181
|
+
|
182
|
+
def wait!: (?nil) -> self
|
183
|
+
| (Numeric timeout) -> bool
|
184
|
+
|
185
|
+
def with_default_executor: (executor executor) -> Future[T, E]
|
186
|
+
|
187
|
+
def zip: (Event event) -> Future[T, E]
|
188
|
+
| [T2, E2] (Future[T2, E2] future) -> Future[[T, T2], [E, E2]]
|
189
|
+
alias & zip
|
190
|
+
|
191
|
+
|
192
|
+
## Following methods are actually defined in the base class and have specific types for Future
|
193
|
+
|
194
|
+
def chain: [A, U] (*A args) { (bool fulfilled, T? value, E? reason, *A args) -> U } -> Future[U, Exception]
|
195
|
+
def chain_on: [A, U] (executor executor, *A args) { (bool fulfilled, T? value, E? reason, *A args) -> U } -> Future[U, Exception]
|
196
|
+
|
197
|
+
def on_resolution: [A] (*A args) { (bool fulfilled, T? value, E? reason, *A args) -> void } -> self
|
198
|
+
def on_resolution!: [A] (*A args) { (bool fulfilled, T? value, E? reason, *A args) -> void } -> self
|
199
|
+
def on_resolution_using: [A] (executor executor, *A args) { (bool fulfilled, T? value, E? reason, *A args) -> void } -> self
|
200
|
+
|
201
|
+
def state: () -> (:pending | :fulfilled | :rejected)
|
202
|
+
end
|
203
|
+
|
204
|
+
module Resolvable
|
205
|
+
end
|
206
|
+
|
207
|
+
class ResolvableEvent < Event
|
208
|
+
include Resolvable
|
209
|
+
|
210
|
+
def resolve: (?true raise_on_reassign, ?boolish reserved) -> self
|
211
|
+
| (boolish raise_on_reassign, ?boolish reserved) -> (self | false)
|
212
|
+
|
213
|
+
def wait: (Numeric timeout, boolish resolve_on_timeout) -> bool
|
214
|
+
| ...
|
215
|
+
|
216
|
+
def with_hidden_resolvable: () -> Event
|
217
|
+
end
|
218
|
+
|
219
|
+
class ResolvableFuture[T, E] < Future[T, E] # Note: ResolvableFuture is invariant on T and E
|
220
|
+
include Resolvable
|
221
|
+
|
222
|
+
def evalute_to: [A] (*A args) { (*A args) -> T } -> self # TODO: Unsound unless E :> Exception
|
223
|
+
def evalute_to!: [A] (*A args) { (*A args) -> T } -> self # TODO: ditto
|
224
|
+
|
225
|
+
def fulfill: (T value, ?true raise_on_reassign, ?boolish reserved) -> self
|
226
|
+
| (T value, boolish raise_on_reassign, ?boolish reserved) -> (self | false)
|
227
|
+
|
228
|
+
def reason: [R] (Numeric timeout, R timeout_value, [boolish, T?, E?] resolve_on_timeout) -> (E | R | nil)
|
229
|
+
| ...
|
230
|
+
|
231
|
+
def reject: (E reason, ?true raise_on_reassign, ?boolish reserved) -> self
|
232
|
+
| (E reason, boolish raise_on_reassign, ?boolish reserved) -> (self | false)
|
233
|
+
|
234
|
+
def resolve: (?boolish fulfilled, ?T? value, ?E? reason, ?true raise_on_reassign, ?boolish reserved) -> self
|
235
|
+
| (boolish fulfilled, T? value, E? reason, boolish raise_on_reassign, ?boolish reserved) -> (self | false)
|
236
|
+
|
237
|
+
def result: (Numeric timeout, [boolish, T?, E?] resolve_on_timeout) -> ([true, T, nil] | [false, nil, E] | nil)
|
238
|
+
| ...
|
239
|
+
|
240
|
+
def value: [R] (Numeric timeout, R timeout_value, [boolish, T?, E?] resolve_on_timeout) -> (T | R | nil)
|
241
|
+
| ...
|
242
|
+
|
243
|
+
def value!: [R] (Numeric timeout, R timeout_value, [boolish, T?, E?] resolve_on_timeout) -> (T | R | nil)
|
244
|
+
| ...
|
245
|
+
|
246
|
+
def with_hidden_resolvable: () -> Future[T, E]
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Diff
|
2
|
+
end
|
3
|
+
|
4
|
+
module Diff::LCS
|
5
|
+
def self.LCS: (Array[String], Array[String]) -> Array[String]
|
6
|
+
| (String, String) -> Array[String]
|
7
|
+
def self.diff: (Array[String], Array[String]) -> Array[String]
|
8
|
+
| (String, String) -> Array[String]
|
9
|
+
|
10
|
+
def self.patch!: (Array[String], Array[String]) -> String
|
11
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Listen
|
2
|
+
# Listens to file system modifications on a either single directory or
|
3
|
+
# multiple directories.
|
4
|
+
#
|
5
|
+
# @param (see Listen::Listener#new)
|
6
|
+
#
|
7
|
+
# @yield [modified, added, removed] the changed files
|
8
|
+
# @yieldparam [Array<String>] modified the list of modified files
|
9
|
+
# @yieldparam [Array<String>] added the list of added files
|
10
|
+
# @yieldparam [Array<String>] removed the list of removed files
|
11
|
+
#
|
12
|
+
# @return [Listen::Listener] the listener
|
13
|
+
#
|
14
|
+
def self.to: (*String dirs,
|
15
|
+
?debug: bool,
|
16
|
+
?wait_for_delay: Integer?,
|
17
|
+
?relative: bool,
|
18
|
+
?force_polling: bool,
|
19
|
+
?ignore: Regexp | Array[Regexp],
|
20
|
+
?ignore!: Regexp,
|
21
|
+
?only: Regexp?,
|
22
|
+
?polling_fallback_message: String?) {
|
23
|
+
(Array[String] modified, Array[String] added, Array[String] removed) -> void
|
24
|
+
} -> Listener
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Listen
|
2
|
+
class Listener
|
3
|
+
# Starts processing events and starts adapters
|
4
|
+
# or resumes invoking callbacks if paused
|
5
|
+
def start: () -> void
|
6
|
+
|
7
|
+
# Stops both listening for events and processing them
|
8
|
+
def stop: () -> void
|
9
|
+
|
10
|
+
# Stops invoking callbacks (messages pile up)
|
11
|
+
def pause: () -> void
|
12
|
+
|
13
|
+
# processing means callbacks are called
|
14
|
+
def processing?: () -> bool
|
15
|
+
|
16
|
+
def paused?: () -> bool
|
17
|
+
|
18
|
+
def ignore: (Regexp regexps) -> void
|
19
|
+
|
20
|
+
def ignore!: (Regexp regexps) -> void
|
21
|
+
|
22
|
+
def only: (Regexp regexps) -> void
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module MiniMime
|
2
|
+
def self.lookup_by_filename: (String filename) -> Info?
|
3
|
+
def self.lookup_by_extension: (String extension) -> Info?
|
4
|
+
def self.lookup_by_content_type: (String mime) -> Info?
|
5
|
+
|
6
|
+
class Info
|
7
|
+
attr_accessor extension: String
|
8
|
+
attr_accessor content_type: String
|
9
|
+
attr_accessor encoding: String
|
10
|
+
|
11
|
+
def []: (Integer idx) -> String
|
12
|
+
def binary?: () -> bool
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module Parallel
|
2
|
+
class Break < StandardError
|
3
|
+
attr_reader value: untyped
|
4
|
+
|
5
|
+
def initialize: (?untyped value) -> void
|
6
|
+
end
|
7
|
+
|
8
|
+
class Kill < Break
|
9
|
+
end
|
10
|
+
|
11
|
+
type stop = Object
|
12
|
+
Stop: stop
|
13
|
+
|
14
|
+
VERSION: String
|
15
|
+
|
16
|
+
Version: String
|
17
|
+
|
18
|
+
type callable_source[T] = ^() -> (T | stop)
|
19
|
+
|
20
|
+
def self.all?: [T] (Enumerable[T] | callable_source[T] source,
|
21
|
+
?in_processes: Integer,
|
22
|
+
?in_threads: Integer,
|
23
|
+
?progress: _ToStr,
|
24
|
+
?start: ^(T item, Integer index) -> void,
|
25
|
+
?finish: ^(T item, Integer index, boolish result) -> void) { (T) -> boolish } -> bool
|
26
|
+
|
27
|
+
def self.any?: [T] (Enumerable[T] | callable_source[T] source,
|
28
|
+
?in_processes: Integer,
|
29
|
+
?in_threads: Integer,
|
30
|
+
?progress: _ToStr,
|
31
|
+
?start: ^(T item, Integer index) -> void,
|
32
|
+
?finish: ^(T item, Integer index, boolish result) -> void) { (T) -> boolish } -> bool
|
33
|
+
|
34
|
+
def self.each: [T, U] (Enumerable[T] source,
|
35
|
+
?in_processes: Integer,
|
36
|
+
?in_threads: Integer,
|
37
|
+
?progress: _ToStr,
|
38
|
+
?start: ^(T item, Integer index) -> void,
|
39
|
+
?finish: ^(T item, Integer index, U result) -> void) { (T) -> U } -> Enumerable[U]
|
40
|
+
| [T, U] (callable_source[T] source,
|
41
|
+
?in_processes: Integer,
|
42
|
+
?in_threads: Integer,
|
43
|
+
?progress: _ToStr,
|
44
|
+
?start: ^(T item, Integer index) -> void,
|
45
|
+
?finish: ^(T item, Integer index, U result) -> void) { (T) -> U } -> callable_source[T]
|
46
|
+
|
47
|
+
def self.each_with_index: [T, U] (Enumerable[T] source,
|
48
|
+
?in_processes: Integer,
|
49
|
+
?in_threads: Integer,
|
50
|
+
?progress: _ToStr,
|
51
|
+
?start: ^(T item, Integer index) -> void,
|
52
|
+
?finish: ^(T item, Integer index, U result) -> void) { (T, Integer) -> U } -> Enumerable[T]
|
53
|
+
| [T, U] (callable_source[T] array,
|
54
|
+
?in_processes: Integer,
|
55
|
+
?in_threads: Integer,
|
56
|
+
?progress: _ToStr,
|
57
|
+
?start: ^(T item, Integer index) -> void,
|
58
|
+
?finish: ^(T item, Integer index, U result) -> void) { (T, Integer) -> U } -> callable_source[U]
|
59
|
+
|
60
|
+
def self.flat_map: [T, U] (Enumerable[T] | callable_source[T] src,
|
61
|
+
?in_processes: Integer,
|
62
|
+
?in_threads: Integer,
|
63
|
+
?progress: _ToStr,
|
64
|
+
?start: ^(T item, Integer index) -> void,
|
65
|
+
?finish: ^(T item, Integer index, U result) -> void) { (T) -> U } -> Array[U]
|
66
|
+
|
67
|
+
def self.map: [T, U] (Enumerable[T] | callable_source[T] | Thread::Queue source,
|
68
|
+
?in_processes: Integer,
|
69
|
+
?in_threads: Integer,
|
70
|
+
?progress: _ToStr,
|
71
|
+
?start: ^(T item, Integer index) -> void,
|
72
|
+
?finish: ^(T item, Integer index, U result) -> void) { (T) -> U } -> Array[U]
|
73
|
+
|
74
|
+
def self.map_with_index: [T, U] (Enumerable[T] | callable_source[T] source,
|
75
|
+
?in_processes: Integer,
|
76
|
+
?in_threads: Integer,
|
77
|
+
?progress: _ToStr,
|
78
|
+
?start: ^(T item, Integer index) -> untyped,
|
79
|
+
?finish: ^(T item, Integer index, U result) -> untyped) { (T, Integer) -> U } -> Array[U]
|
80
|
+
|
81
|
+
def self.physical_processor_count: () -> Integer
|
82
|
+
|
83
|
+
def self.processor_count: () -> Integer
|
84
|
+
|
85
|
+
def self.worker_number: () -> Integer
|
86
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Rake
|
2
|
+
class TaskLib
|
3
|
+
include Rake::DSL
|
4
|
+
end
|
5
|
+
|
6
|
+
class Task
|
7
|
+
end
|
8
|
+
|
9
|
+
class TaskArguments
|
10
|
+
include Enumerable[untyped]
|
11
|
+
|
12
|
+
def []: (untyped index) -> untyped
|
13
|
+
def each: () ?{ (untyped, untyped) -> void } -> void
|
14
|
+
end
|
15
|
+
|
16
|
+
module DSL
|
17
|
+
private
|
18
|
+
|
19
|
+
include FileUtils
|
20
|
+
|
21
|
+
def desc: (String description) -> void
|
22
|
+
def directory: (*untyped args) ?{ () -> void } -> void
|
23
|
+
def file: (*untyped args) ?{ () -> void } -> void
|
24
|
+
def file_create: (*untyped args) ?{ () -> void } -> void
|
25
|
+
def import: (*String fns) -> void
|
26
|
+
def multitask: (*untyped args) ?{ () -> void } -> void
|
27
|
+
def namespace: (?untyped name) ?{ () -> void } -> void
|
28
|
+
def rule: (*untyped args) ?{ () -> void } -> void
|
29
|
+
def task: (*untyped args) ?{ (Rake::Task, Rake::TaskArguments) -> void } -> void
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
module FileUtils
|
34
|
+
def sh: (*String cmd, **untyped options) ?{ (bool, Process::Status) -> void } -> void
|
35
|
+
| (Hash[String, String] env, *String cmd, **untyped options) ?{ (bool, Process::Status) -> void } -> void
|
36
|
+
def ruby: (*String args, **untyped options) ?{ (bool, Process::Status) -> void } -> void
|
37
|
+
def safe_ln: (*untyped args, **untyped options) -> void
|
38
|
+
def split_all: (String path) -> Array[String]
|
39
|
+
end
|