nukadoko 0.6.0 → 0.7.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 +4 -4
- data/CHANGELOG.md +541 -3
- data/README.ja.md +20 -5
- data/README.md +12 -6
- data/docs/ci.ja.md +542 -0
- data/docs/ci.md +635 -0
- data/docs/commands.ja.md +1524 -0
- data/docs/commands.md +1281 -0
- data/docs/engines.json +19 -0
- data/docs/execution-events.ja.md +336 -0
- data/docs/execution-events.md +423 -0
- data/docs/glossary.json +1348 -0
- data/docs/guide.ja.md +733 -0
- data/docs/guide.md +815 -0
- data/docs/intent.ja.md +133 -0
- data/docs/intent.md +156 -0
- data/docs/layout.ja.md +442 -0
- data/docs/layout.md +399 -0
- data/docs/releasing.ja.md +186 -0
- data/docs/releasing.md +237 -0
- data/docs/ruby/reference.ja.md +302 -0
- data/docs/ruby/reference.md +368 -0
- data/docs/spec.ja.md +8916 -0
- data/docs/spec.md +11250 -0
- data/docs/tutorial.ja.md +451 -0
- data/docs/tutorial.md +458 -0
- data/docs/typescript/adopting.ja.md +231 -0
- data/docs/typescript/adopting.md +251 -0
- data/docs/typescript/doors.ja.md +301 -0
- data/docs/typescript/doors.md +329 -0
- data/docs/typescript/migration-playwright-test.ja.md +189 -0
- data/docs/typescript/migration-playwright-test.md +212 -0
- data/docs/typescript/migration.ja.md +391 -0
- data/docs/typescript/migration.md +505 -0
- data/docs/typescript/reference.ja.md +176 -0
- data/docs/typescript/reference.md +197 -0
- data/docs/typescript/upgrading.ja.md +1774 -0
- data/docs/typescript/upgrading.md +2224 -0
- data/docs/web-app.ja.md +627 -0
- data/docs/web-app.md +659 -0
- data/docs/writing-scenarios.ja.md +544 -0
- data/docs/writing-scenarios.md +563 -0
- data/lib/nukadoko/base.rb +12 -5
- data/lib/nukadoko/changed_files.rb +95 -0
- data/lib/nukadoko/check.rb +459 -51
- data/lib/nukadoko/claim_drops.rb +271 -0
- data/lib/nukadoko/claim_line.rb +24 -4
- data/lib/nukadoko/claim_rules.rb +143 -1
- data/lib/nukadoko/claim_sides.rb +157 -9
- data/lib/nukadoko/cli.rb +395 -48
- data/lib/nukadoko/codes.json +246 -21
- data/lib/nukadoko/codes.rb +21 -4
- data/lib/nukadoko/command.rb +120 -13
- data/lib/nukadoko/command_help.rb +128 -0
- data/lib/nukadoko/compat.rb +469 -0
- data/lib/nukadoko/criteria.rb +1 -1
- data/lib/nukadoko/definition.rb +157 -7
- data/lib/nukadoko/error_frames.rb +6 -3
- data/lib/nukadoko/events/count.rb +146 -0
- data/lib/nukadoko/events/counted.rb +114 -0
- data/lib/nukadoko/events/format.rb +257 -0
- data/lib/nukadoko/events/lists.rb +154 -0
- data/lib/nukadoko/events/path.rb +285 -0
- data/lib/nukadoko/events/read.rb +284 -0
- data/lib/nukadoko/events/reader.rb +490 -0
- data/lib/nukadoko/events/selection.rb +252 -0
- data/lib/nukadoko/events/tally.rb +438 -0
- data/lib/nukadoko/features.rb +2 -2
- data/lib/nukadoko/fixtures.rb +160 -35
- data/lib/nukadoko/http_recording.rb +6 -2
- data/lib/nukadoko/intent.rb +364 -0
- data/lib/nukadoko/intent_file.rb +81 -0
- data/lib/nukadoko/intent_view.rb +190 -0
- data/lib/nukadoko/js_json.rb +2 -1
- data/lib/nukadoko/judge.rb +2 -2
- data/lib/nukadoko/judgment_file.rb +1 -1
- data/lib/nukadoko/judgments.rb +4 -4
- data/lib/nukadoko/measure_mcp.rb +202 -0
- data/lib/nukadoko/parts.rb +8 -2
- data/lib/nukadoko/path_view.rb +252 -0
- data/lib/nukadoko/place_rows.rb +161 -0
- data/lib/nukadoko/program.rb +1265 -51
- data/lib/nukadoko/program_log.rb +122 -0
- data/lib/nukadoko/program_shape.rb +385 -0
- data/lib/nukadoko/project_fixtures.rb +43 -10
- data/lib/nukadoko/project_program.rb +5 -4
- data/lib/nukadoko/repeated_prefix.rb +310 -0
- data/lib/nukadoko/report_run.rb +3 -3
- data/lib/nukadoko/run.rb +1148 -159
- data/lib/nukadoko/run_record.rb +70 -46
- data/lib/nukadoko/scaffold.rb +24 -6
- data/lib/nukadoko/schema.rb +15 -2
- data/lib/nukadoko/secrets.rb +55 -5
- data/lib/nukadoko/states.rb +478 -0
- data/lib/nukadoko/step.rb +71 -2
- data/lib/nukadoko/step_fixtures.rb +52 -3
- data/lib/nukadoko/summary.rb +799 -29
- data/lib/nukadoko/table.rb +4 -2
- data/lib/nukadoko/text_fit.rb +20 -7
- data/lib/nukadoko/trace.rb +152 -45
- data/lib/nukadoko/tree_passes.rb +95 -33
- data/lib/nukadoko/underneath.rb +311 -0
- data/lib/nukadoko/version.rb +1 -1
- data/lib/nukadoko/vocabulary.rb +166 -23
- data/lib/nukadoko/walk.rb +2 -2
- data/lib/nukadoko/walk_step.rb +1 -1
- data/lib/nukadoko.rb +23 -0
- data/llms.txt +41 -34
- data/sig/generated/nukadoko/base.rbs +4 -4
- data/sig/generated/nukadoko/changed_files.rbs +42 -0
- data/sig/generated/nukadoko/check.rbs +147 -10
- data/sig/generated/nukadoko/claim_drops.rbs +135 -0
- data/sig/generated/nukadoko/claim_line.rbs +11 -0
- data/sig/generated/nukadoko/claim_rules.rbs +49 -4
- data/sig/generated/nukadoko/claim_sides.rbs +63 -12
- data/sig/generated/nukadoko/cli.rbs +80 -7
- data/sig/generated/nukadoko/codes.rbs +19 -4
- data/sig/generated/nukadoko/command.rbs +68 -1
- data/sig/generated/nukadoko/command_help.rbs +18 -0
- data/sig/generated/nukadoko/compat.rbs +392 -0
- data/sig/generated/nukadoko/criteria.rbs +1 -1
- data/sig/generated/nukadoko/definition.rbs +50 -0
- data/sig/generated/nukadoko/error_frames.rbs +1 -1
- data/sig/generated/nukadoko/events/count.rbs +69 -0
- data/sig/generated/nukadoko/events/counted.rbs +70 -0
- data/sig/generated/nukadoko/events/format.rbs +163 -0
- data/sig/generated/nukadoko/events/lists.rbs +47 -0
- data/sig/generated/nukadoko/events/path.rbs +161 -0
- data/sig/generated/nukadoko/events/read.rbs +109 -0
- data/sig/generated/nukadoko/events/reader.rbs +226 -0
- data/sig/generated/nukadoko/events/selection.rbs +100 -0
- data/sig/generated/nukadoko/events/tally.rbs +227 -0
- data/sig/generated/nukadoko/features.rbs +6 -4
- data/sig/generated/nukadoko/fixtures.rbs +67 -11
- data/sig/generated/nukadoko/http_recording.rbs +1 -1
- data/sig/generated/nukadoko/intent.rbs +132 -0
- data/sig/generated/nukadoko/intent_file.rbs +46 -0
- data/sig/generated/nukadoko/intent_view.rbs +69 -0
- data/sig/generated/nukadoko/judgment_file.rbs +1 -1
- data/sig/generated/nukadoko/judgments.rbs +1 -1
- data/sig/generated/nukadoko/measure_mcp.rbs +104 -0
- data/sig/generated/nukadoko/parts.rbs +2 -2
- data/sig/generated/nukadoko/path_view.rbs +105 -0
- data/sig/generated/nukadoko/place_rows.rbs +43 -0
- data/sig/generated/nukadoko/program.rbs +627 -23
- data/sig/generated/nukadoko/program_log.rbs +67 -0
- data/sig/generated/nukadoko/program_shape.rbs +147 -0
- data/sig/generated/nukadoko/project_fixtures.rbs +16 -3
- data/sig/generated/nukadoko/project_program.rbs +2 -1
- data/sig/generated/nukadoko/repeated_prefix.rbs +172 -0
- data/sig/generated/nukadoko/report_run.rbs +1 -1
- data/sig/generated/nukadoko/run.rbs +286 -41
- data/sig/generated/nukadoko/run_record.rbs +20 -12
- data/sig/generated/nukadoko/scaffold.rbs +3 -0
- data/sig/generated/nukadoko/schema.rbs +5 -0
- data/sig/generated/nukadoko/secrets.rbs +26 -3
- data/sig/generated/nukadoko/states.rbs +214 -0
- data/sig/generated/nukadoko/step.rbs +58 -1
- data/sig/generated/nukadoko/step_fixtures.rbs +39 -0
- data/sig/generated/nukadoko/summary.rbs +256 -2
- data/sig/generated/nukadoko/table.rbs +3 -2
- data/sig/generated/nukadoko/trace.rbs +108 -33
- data/sig/generated/nukadoko/tree_passes.rbs +36 -8
- data/sig/generated/nukadoko/underneath.rbs +141 -0
- data/sig/generated/nukadoko/vocabulary.rbs +45 -6
- data/skills/nukadoko/SKILL.md +18 -18
- data/skills/nukadoko/references/checking-steps.md +16 -83
- data/skills/nukadoko/references/diagnosing.md +6 -6
- data/skills/nukadoko/references/evidence.md +19 -6
- data/skills/nukadoko/references/exploring.md +22 -7
- data/skills/nukadoko/references/fixtures.md +12 -32
- data/skills/nukadoko/references/judgments.md +12 -0
- data/skills/nukadoko/references/maintenance.md +1 -1
- data/skills/nukadoko/references/merge-risk.md +1 -1
- data/skills/nukadoko/references/parts.md +46 -23
- data/skills/nukadoko/references/{perturbed-worlds.md → perturbed-systems.md} +30 -12
- data/skills/nukadoko/references/program.md +168 -169
- data/skills/nukadoko/references/reviewing.md +20 -20
- data/skills/nukadoko/references/ruby/checking-steps.md +106 -0
- data/skills/nukadoko/references/ruby/examples/cli.md +212 -0
- data/skills/nukadoko/references/ruby/fixtures.md +34 -0
- data/skills/nukadoko/references/ruby/program.md +112 -0
- data/skills/nukadoko/references/ruby/step-files.md +115 -0
- data/skills/nukadoko/references/running.md +34 -34
- data/skills/nukadoko/references/scenario-rules.md +7 -6
- data/skills/nukadoko/references/states.md +7 -1
- data/skills/nukadoko/references/step-files.md +41 -120
- data/skills/nukadoko/references/typescript/checking-steps.md +129 -0
- data/skills/nukadoko/references/{examples → typescript/examples}/cli.md +1 -1
- data/skills/nukadoko/references/{examples → typescript/examples}/http-api.md +6 -6
- data/skills/nukadoko/references/{examples → typescript/examples}/workflow.md +1 -1
- data/skills/nukadoko/references/typescript/fixtures.md +56 -0
- data/skills/nukadoko/references/typescript/program.md +111 -0
- data/skills/nukadoko/references/typescript/step-files.md +104 -0
- data/skills/nukadoko/references/verdicts.md +10 -10
- data/skills/nukadoko/references/writing-steps.md +67 -67
- data/skills/nukadoko/references/writing-the-feature.md +1 -1
- data/skills/nukadoko-verification/SKILL.md +13 -8
- metadata +103 -7
- data/skills/nukadoko/references/ruby.md +0 -80
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# Generated from lib/nukadoko/program.rb with RBS::Inline
|
|
2
2
|
|
|
3
3
|
# How the program under test starts, once per environment: an environment
|
|
4
|
-
# is a
|
|
5
|
-
# environment's state never reaches another's scenarios.
|
|
4
|
+
# is a system of its own, with its own port, directory, and process, so one
|
|
5
|
+
# environment's state never reaches another's scenarios. A system goes
|
|
6
|
+
# through the TypeScript engine's phases in its order: build (once per
|
|
7
|
+
# tree per run), prepare, serve or url, then setup. Each phase has a limit,
|
|
8
|
+
# and a phase past it, or one that fails, stops the system and names itself.
|
|
6
9
|
module Nukadoko
|
|
7
10
|
module Engine
|
|
8
11
|
class Environment < Data
|
|
@@ -22,18 +25,121 @@ module Nukadoko
|
|
|
22
25
|
def members: () -> [ :name, :conditions, :env, :env_files ]
|
|
23
26
|
end
|
|
24
27
|
|
|
28
|
+
# One service of a system, its environment's layer applied and each
|
|
29
|
+
# limit filled. `root` is the directory its commands run in, as the
|
|
30
|
+
# program writes it: relative to the tree's root (`.` when it writes
|
|
31
|
+
# none), or absolute; nil for a service with `external: true`. Whether
|
|
32
|
+
# it is a directory of the tree or a checkout outside it is known
|
|
33
|
+
# where the tree is (Program.service_code). `reach` is how the system
|
|
34
|
+
# reaches it: `{ kind: "serve", serve: }`, `{ kind: "url", url:,
|
|
35
|
+
# timeout_ms: }`, or `{ kind: "none" }`. `env` is the program's env with
|
|
36
|
+
# the service's own over it, its placeholders not yet filled.
|
|
37
|
+
class ServiceRecipe < Data
|
|
38
|
+
attr_reader name(): String
|
|
39
|
+
|
|
40
|
+
attr_reader root(): String?
|
|
41
|
+
|
|
42
|
+
attr_reader build(): Array[Hash[Symbol, untyped]]
|
|
43
|
+
|
|
44
|
+
attr_reader prepare(): Array[Hash[Symbol, untyped]]
|
|
45
|
+
|
|
46
|
+
attr_reader reach(): Hash[Symbol, untyped]
|
|
47
|
+
|
|
48
|
+
attr_reader env(): Hash[String, String]
|
|
49
|
+
|
|
50
|
+
attr_reader lists(): Array[Hash[Symbol, untyped]]
|
|
51
|
+
|
|
52
|
+
def self.new: (String name, String? root, Array[Hash[Symbol, untyped]] build, Array[Hash[Symbol, untyped]] prepare, Hash[Symbol, untyped] reach, Hash[String, String] env, Array[Hash[Symbol, untyped]] lists) -> instance
|
|
53
|
+
| (name: String, root: String?, build: Array[Hash[Symbol, untyped]], prepare: Array[Hash[Symbol, untyped]], reach: Hash[Symbol, untyped], env: Hash[String, String], lists: Array[Hash[Symbol, untyped]]) -> instance
|
|
54
|
+
|
|
55
|
+
def self.members: () -> [ :name, :root, :build, :prepare, :reach, :env, :lists ]
|
|
56
|
+
|
|
57
|
+
def members: () -> [ :name, :root, :build, :prepare, :reach, :env, :lists ]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# One environment's program, its layer over the top level applied:
|
|
61
|
+
# its services in the program's order, the one the steps reach, and
|
|
62
|
+
# what the system runs once.
|
|
63
|
+
class Recipe < Data
|
|
64
|
+
attr_reader services(): Array[ServiceRecipe]
|
|
65
|
+
|
|
66
|
+
attr_reader primary(): String
|
|
67
|
+
|
|
68
|
+
attr_reader setup(): Hash[Symbol, untyped]?
|
|
69
|
+
|
|
70
|
+
attr_reader conditions(): Hash[String, untyped]
|
|
71
|
+
|
|
72
|
+
attr_reader steps_reach(): String
|
|
73
|
+
|
|
74
|
+
def self.new: (Array[ServiceRecipe] services, String primary, Hash[Symbol, untyped]? setup, Hash[String, untyped] conditions, String steps_reach) -> instance
|
|
75
|
+
| (services: Array[ServiceRecipe], primary: String, setup: Hash[Symbol, untyped]?, conditions: Hash[String, untyped], steps_reach: String) -> instance
|
|
76
|
+
|
|
77
|
+
def self.members: () -> [ :services, :primary, :setup, :conditions, :steps_reach ]
|
|
78
|
+
|
|
79
|
+
def members: () -> [ :services, :primary, :setup, :conditions, :steps_reach ]
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class Recipe
|
|
83
|
+
# The service the steps reach.
|
|
84
|
+
# : () -> ServiceRecipe
|
|
85
|
+
def primary_service: () -> ServiceRecipe
|
|
86
|
+
end
|
|
87
|
+
|
|
25
88
|
class Program
|
|
89
|
+
# How long a build or prepare command may run, and a setup or a url
|
|
90
|
+
# function take, unless the program says otherwise: a phase with no
|
|
91
|
+
# limit left a run waiting on a command that never ended.
|
|
92
|
+
DEFAULT_COMMAND_TIMEOUT_MS: ::Integer
|
|
93
|
+
|
|
94
|
+
DEFAULT_SETUP_TIMEOUT_MS: ::Integer
|
|
95
|
+
|
|
96
|
+
DEFAULT_URL_TIMEOUT_MS: ::Integer
|
|
97
|
+
|
|
98
|
+
# How long a `lists` command may run: a list is read while the system
|
|
99
|
+
# waits to run its first scenario.
|
|
100
|
+
DEFAULT_LIST_TIMEOUT_MS: ::Integer
|
|
101
|
+
|
|
102
|
+
# The most a list command may print; past it the list is not read.
|
|
103
|
+
LIST_OUTPUT_CAP_BYTES: untyped
|
|
104
|
+
|
|
105
|
+
# What a placeholder names, as the TypeScript engine names them.
|
|
106
|
+
# `{service.<name>.url}` and `{service.<name>.port}` are another
|
|
107
|
+
# service's address, which every service knows before any of them
|
|
108
|
+
# runs a command, so two that call each other need no order.
|
|
109
|
+
PLACEHOLDER: ::Regexp
|
|
110
|
+
|
|
111
|
+
# The placeholders an earlier release named differently, each old
|
|
112
|
+
# name with the name it carries now. `{world}` became `{system}` when
|
|
113
|
+
# one pass of a run against one program stopped sharing a word with
|
|
114
|
+
# the compat World. Nothing fills a name nukadoko does not know, so a
|
|
115
|
+
# config that still writes the old one would hand its program those
|
|
116
|
+
# characters as they stand: it is refused by name instead.
|
|
117
|
+
RENAMED_PLACEHOLDERS: untyped
|
|
118
|
+
|
|
119
|
+
RENAMED_PLACEHOLDER: ::Regexp
|
|
120
|
+
|
|
121
|
+
# The name of the one service of a program that writes no services.
|
|
122
|
+
MAIN_SERVICE: ::String
|
|
123
|
+
|
|
26
124
|
# : (Hash[Symbol, untyped]) -> void
|
|
27
125
|
def initialize: (Hash[Symbol, untyped]) -> void
|
|
28
126
|
|
|
29
|
-
# The
|
|
127
|
+
# The builds this program already ran, by the directory and the
|
|
128
|
+
# commands: the system that ran each one, as its lines name it, and
|
|
129
|
+
# "failed" when it failed. A `--base` tree's pass runs in a process
|
|
130
|
+
# of its own, so the run hands each pass what ran before it and takes
|
|
131
|
+
# back what the pass ran: a checkout is the same directory in every
|
|
132
|
+
# tree, and builds once a run.
|
|
133
|
+
attr_reader builds: Hash[String, [ String, String? ]]
|
|
134
|
+
|
|
135
|
+
# The systems a run starts: each --env in the order given; without one,
|
|
30
136
|
# defaultEnvironments in its order, else every environment that
|
|
31
137
|
# declares conditions, else the top level under the name default.
|
|
32
138
|
# default is always a name, whether or not the file defines it.
|
|
33
139
|
# : (?Array[String]) -> Array[Environment]
|
|
34
140
|
def environments: (?Array[String]) -> Array[Environment]
|
|
35
141
|
|
|
36
|
-
# Whether the config gave a program, so each step names its
|
|
142
|
+
# Whether the config gave a program, so each step names its system.
|
|
37
143
|
# : () -> bool
|
|
38
144
|
def file?: () -> bool
|
|
39
145
|
|
|
@@ -43,6 +149,44 @@ module Nukadoko
|
|
|
43
149
|
# : (String) -> Environment
|
|
44
150
|
def environment: (String) -> Environment
|
|
45
151
|
|
|
152
|
+
# A read-only environment refuses every step that declares it mutates.
|
|
153
|
+
# : (String) -> String?
|
|
154
|
+
def policy: (String) -> String?
|
|
155
|
+
|
|
156
|
+
# The environment's version function, whose answer each record names
|
|
157
|
+
# as target_version.
|
|
158
|
+
# : (String) -> untyped
|
|
159
|
+
def version: (String) -> untyped
|
|
160
|
+
|
|
161
|
+
# The environment's fields over the top level's, service by service.
|
|
162
|
+
# A field the environment writes replaces the top level's, except
|
|
163
|
+
# env, whose keys merge with the environment's winning; a service's
|
|
164
|
+
# env is the program's with its own over it. serve and url are one
|
|
165
|
+
# choice, and an environment that writes url keeps none of the top
|
|
166
|
+
# level's build, prepare, or root (Program.layer_service). A program
|
|
167
|
+
# that writes no services is one service, main, which its top level
|
|
168
|
+
# and each environment write the fields of.
|
|
169
|
+
# : (Environment) -> Recipe
|
|
170
|
+
def recipe: (Environment) -> Recipe
|
|
171
|
+
|
|
172
|
+
# One service, `overlay` (its environment's fields) over `top`, with
|
|
173
|
+
# `env`, the program's env as its environment layers it, under both.
|
|
174
|
+
# An environment that reaches the service at a url takes none of the
|
|
175
|
+
# top level's build, prepare, or root: they are for the code the top
|
|
176
|
+
# level starts, and a url reaches code nukadoko does not start, so an
|
|
177
|
+
# environment that wants a build there writes its own.
|
|
178
|
+
# : (String, Hash[Symbol, untyped], Hash[Symbol, untyped]?, Hash[untyped, untyped]) -> ServiceRecipe
|
|
179
|
+
def self.layer_service: (String, Hash[Symbol, untyped], Hash[Symbol, untyped]?, Hash[untyped, untyped]) -> ServiceRecipe
|
|
180
|
+
|
|
181
|
+
# : (untyped, Integer) -> Hash[Symbol, untyped]
|
|
182
|
+
def self.timed: (untyped, Integer) -> Hash[Symbol, untyped]
|
|
183
|
+
|
|
184
|
+
# : (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]?
|
|
185
|
+
def self.reach_of: (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]?
|
|
186
|
+
|
|
187
|
+
# : (untyped) -> Hash[Symbol, untyped]?
|
|
188
|
+
def self.setup_of: (untyped) -> Hash[Symbol, untyped]?
|
|
189
|
+
|
|
46
190
|
# The config's envFiles, then the environment's own: later files win.
|
|
47
191
|
# : (Hash[Symbol, untyped]) -> Array[String]
|
|
48
192
|
def self.env_files: (Hash[Symbol, untyped]) -> Array[String]
|
|
@@ -54,48 +198,508 @@ module Nukadoko
|
|
|
54
198
|
# : () -> String
|
|
55
199
|
def chosen_by: () -> String
|
|
56
200
|
|
|
57
|
-
#
|
|
58
|
-
|
|
201
|
+
# Each placeholder a system's program names that has no value there,
|
|
202
|
+
# as `<where> names {<name>}, which has no value here: <why>`: build
|
|
203
|
+
# runs before any system exists, a system with neither serve nor url has
|
|
204
|
+
# no port or URL, and a condition must be one the environment declares.
|
|
205
|
+
# `{events}` is the file nukadoko makes only for a system it serves.
|
|
206
|
+
# : (Recipe) -> Array[String]
|
|
207
|
+
def self.placeholder_gaps: (Recipe) -> Array[String]
|
|
208
|
+
|
|
209
|
+
# The same gaps, each as the field, the placeholder, and why, service
|
|
210
|
+
# by service. With more than one service, each gap's field names its
|
|
211
|
+
# service (`services.shop.env.PORT`); a program of one service keeps
|
|
212
|
+
# the field alone.
|
|
213
|
+
# : (Recipe) -> Array[Hash[Symbol, String]]
|
|
214
|
+
def self.placeholder_gap_list: (Recipe) -> Array[Hash[Symbol, String]]
|
|
215
|
+
|
|
216
|
+
# Each field of every service of `recipe` that names a renamed
|
|
217
|
+
# placeholder, each as the field, the name it writes, and the name it
|
|
218
|
+
# has now, service by service, the field named the way a gap's is. A
|
|
219
|
+
# name written twice in one field is one entry.
|
|
220
|
+
# : (Recipe) -> Array[Hash[Symbol, String]]
|
|
221
|
+
def self.renamed_placeholder_list: (Recipe) -> Array[Hash[Symbol, String]]
|
|
222
|
+
|
|
223
|
+
# One renamed placeholder as a sentence.
|
|
224
|
+
# : (Hash[Symbol, String]) -> String
|
|
225
|
+
def self.describe_renamed_placeholder: (Hash[Symbol, String]) -> String
|
|
226
|
+
|
|
227
|
+
# The edit that closes one renamed placeholder.
|
|
228
|
+
# : (Hash[Symbol, String], String) -> String
|
|
229
|
+
def self.renamed_placeholder_fix: (Hash[Symbol, String], String) -> String
|
|
230
|
+
|
|
231
|
+
# Every field of one service that holds text a placeholder can stand
|
|
232
|
+
# in, in the order the system would reach them: build, prepare,
|
|
233
|
+
# serve, lists, then env, each with the reach that decides what a
|
|
234
|
+
# placeholder there can name.
|
|
235
|
+
# : (ServiceRecipe) -> Array[[String, Array[String], String]]
|
|
236
|
+
def self.service_fields: (ServiceRecipe) -> Array[[ String, Array[String], String ]]
|
|
237
|
+
|
|
238
|
+
# One service's gaps, in the order the system reaches its fields.
|
|
239
|
+
# `peers` is every service of the system, this one among them, by
|
|
240
|
+
# name, with its reach: what `{service.<name>.url}` can name.
|
|
241
|
+
# : (ServiceRecipe, Hash[String, untyped], ?Hash[String, String]) -> Array[Hash[Symbol, String]]
|
|
242
|
+
def self.service_gaps: (ServiceRecipe, Hash[String, untyped], ?Hash[String, String]) -> Array[Hash[Symbol, String]]
|
|
243
|
+
|
|
244
|
+
URL_EVENTS_WHY: ::String
|
|
245
|
+
|
|
246
|
+
# The edit that closes `gap` in system `system` of `file`: it names only
|
|
247
|
+
# what the system lacks. Outside a build, only a system with neither
|
|
248
|
+
# serve nor url lacks a value, so the edit offers either one; a system
|
|
249
|
+
# that has one of them is never told to add the other, which the file
|
|
250
|
+
# refuses beside it. A condition is declared on the system's
|
|
251
|
+
# environment, and a system that is no entry of `environments` is sent
|
|
252
|
+
# to one that declares it.
|
|
253
|
+
# : (Hash[Symbol, String], String, String, Hash[untyped, untyped]) -> String
|
|
254
|
+
def self.placeholder_gap_fix: (Hash[Symbol, String], String, String, Hash[untyped, untyped]) -> String
|
|
255
|
+
|
|
256
|
+
# : (String, String, Hash[String, untyped], ?Hash[String, String]) -> String?
|
|
257
|
+
def self.absence: (String, String, Hash[String, untyped], ?Hash[String, String]) -> String?
|
|
258
|
+
|
|
259
|
+
# Whether a system of the environment writes execution events:
|
|
260
|
+
# nukadoko serves a service of it, and that service names {events}.
|
|
261
|
+
# : (Environment) -> bool
|
|
262
|
+
def writes_events?: (Environment) -> bool
|
|
263
|
+
|
|
264
|
+
# Whether a field of the service's commands or env names `{name}`.
|
|
265
|
+
# : (ServiceRecipe, String) -> bool
|
|
266
|
+
def self.names_placeholder?: (ServiceRecipe, String) -> bool
|
|
267
|
+
|
|
268
|
+
# The file a served system's program appends its execution events to,
|
|
269
|
+
# made before its first command runs. The program writes it directly,
|
|
270
|
+
# so it holds whatever the program wrote, secrets included, until
|
|
271
|
+
# nukadoko reads and redacts it: it lives in a directory of its own
|
|
272
|
+
# in the machine's temporary directory, made with mode 0700, and the
|
|
273
|
+
# file with mode 0600, never in the run directory, which CI uploads.
|
|
274
|
+
# Only the redacted copies reach the run directory. The file exists
|
|
275
|
+
# before the program starts, so every reader opens the same file, and
|
|
276
|
+
# a reader can tell when the program replaced it.
|
|
277
|
+
# : () -> String
|
|
278
|
+
def self.open_events: () -> String
|
|
279
|
+
|
|
280
|
+
# What a step reads as the service's env: a variable whose value names
|
|
281
|
+
# the events file is left out, and so is it for what `setup` reads
|
|
282
|
+
# with it. A step that could find that file could append a line the
|
|
283
|
+
# program never wrote, and a claim would read it as the program's.
|
|
284
|
+
# : (Service) -> Hash[String, String]
|
|
285
|
+
def self.step_env: (Service) -> Hash[String, String]
|
|
286
|
+
|
|
287
|
+
# The path of the first part of `value` that JSON cannot carry, or nil
|
|
288
|
+
# when every part of it can. A setup's answer crosses a process
|
|
289
|
+
# boundary as JSON (a `--concurrency` worker reads it from the system
|
|
290
|
+
# it was handed), so a value that cannot make the crossing is named
|
|
291
|
+
# where it sits, not at the top level.
|
|
292
|
+
# : (untyped, ?String, ?Array[untyped]) -> String?
|
|
293
|
+
def self.not_json_at: (untyped, ?String, ?Array[untyped]) -> String?
|
|
294
|
+
|
|
295
|
+
# `.key` for a name a reader can write back, `["..."]` for one it
|
|
296
|
+
# cannot: the path is meant to be pasted into the setup that wrote it.
|
|
297
|
+
# : (untyped) -> String
|
|
298
|
+
def self.key_step: (untyped) -> String
|
|
299
|
+
|
|
300
|
+
# The message a setup gets when its answer is not JSON, or nil when it
|
|
301
|
+
# is.
|
|
302
|
+
# : (untyped) -> String?
|
|
303
|
+
def self.setup_result_problem: (untyped) -> String?
|
|
304
|
+
|
|
305
|
+
# A copy of the setup's answer that no later write of the setup's own
|
|
306
|
+
# object can change, in the shape a worker reads it in: the JSON round
|
|
307
|
+
# trip is the crossing itself, so a step and a worker read one value.
|
|
308
|
+
# : (untyped) -> untyped
|
|
309
|
+
def self.frozen_setup_result: (untyped) -> untyped
|
|
310
|
+
|
|
311
|
+
# The events directories still to remove, however nukadoko ends.
|
|
312
|
+
EVENTS_DIRS: Array[String]
|
|
313
|
+
|
|
314
|
+
# Started, or StartFailed with the system as far as it got, and the
|
|
315
|
+
# message the run reports as program-start-failed. A base system that
|
|
316
|
+
# has no URL of its own raises Unavailable.
|
|
317
|
+
# `lists` reads the program's routes and flags lists in head's systems,
|
|
318
|
+
# as `nuka run` does; `tables` reads its tables list in a system of any
|
|
319
|
+
# tree, which `nuka do` leaves out when its step reads no events.
|
|
320
|
+
# `progress` gets one line per phase as it starts, and one when the
|
|
321
|
+
# system is ready, redacted, since a `{token}` can be in a command.
|
|
322
|
+
# `secrets` are the environment's: each service's program.log, and
|
|
323
|
+
# what setup and a url function print, are redacted with them and
|
|
324
|
+
# with the system's own.
|
|
325
|
+
# Each service keeps its state and its log in a directory of its own
|
|
326
|
+
# under `dir`. Every service's port and URL are known before any of
|
|
327
|
+
# them runs a command, so each can name the others in its env; every
|
|
328
|
+
# served service starts at once, and each waits for its own ready.
|
|
329
|
+
# `head_root` is head's project root, which a service's root is read
|
|
330
|
+
# from in every tree: `project` when absent. A base or an old tree
|
|
331
|
+
# sits in the run's own directory, so a checkout written as `../shop`
|
|
332
|
+
# names head's neighbour there too, not a directory beside the tree.
|
|
333
|
+
# `repository_root` is the root of the repository `head_root` is in,
|
|
334
|
+
# which decides whether a service's root is a directory of the tree
|
|
335
|
+
# or a checkout (Program.service_code): found with git when absent.
|
|
336
|
+
# `env_vars` is what the environment's env files define, which setup
|
|
337
|
+
# reads under the program's own env, so setup and a step read one env.
|
|
338
|
+
# `head_urls` is the key (Program.url_key) of the URL each service of
|
|
339
|
+
# head's system of this environment reached: a base service of the
|
|
340
|
+
# tree whose url function answers with head's URL is unavailable, since
|
|
341
|
+
# the base's code runs nowhere.
|
|
342
|
+
# : (Environment, String, String, ?secrets: Secrets, ?tree: String, ?lists: bool, ?tables: bool, ?progress: untyped, ?head_root: String?, ?repository_root: String?, ?env_vars: Hash[String, String], ?head_urls: Hash[String, String]) -> System
|
|
343
|
+
def start: (Environment, String, String, ?secrets: Secrets, ?tree: String, ?lists: bool, ?tables: bool, ?progress: untyped, ?head_root: String?, ?repository_root: String?, ?env_vars: Hash[String, String], ?head_urls: Hash[String, String]) -> System
|
|
344
|
+
|
|
345
|
+
# Where `root` puts a service's code, as the TypeScript engine says
|
|
346
|
+
# it: a directory inside the repository is part of the tree, which
|
|
347
|
+
# `nuka run --base` builds again from the base's tree, and one
|
|
348
|
+
# outside it is a checkout, the same directory whichever tree a system
|
|
349
|
+
# runs. Where the code is decides, rather than how the config is
|
|
350
|
+
# written. `root` is as the program writes it, relative to
|
|
351
|
+
# `tree_root` (head's project root, whichever tree a system runs, so
|
|
352
|
+
# a checkout is head's directory and a tree directory keeps its place
|
|
353
|
+
# in the tree: Program.service_directory) or absolute; nil is a
|
|
354
|
+
# service with `external: true`. `repository_root` is in the same
|
|
355
|
+
# terms as `tree_root`. A tree service's path is relative to
|
|
356
|
+
# `tree_root`, "." for the root itself; a checkout's is absolute.
|
|
357
|
+
# Pure.
|
|
358
|
+
# : (String?, String, String) -> Hash[Symbol, untyped]
|
|
359
|
+
def self.service_code: (String?, String, String) -> Hash[Symbol, untyped]
|
|
360
|
+
|
|
361
|
+
# A checkout's commit and whether it had an uncommitted change, an
|
|
362
|
+
# untracked file included, from `git status --porcelain=v2 --branch`
|
|
363
|
+
# in it, as the TypeScript engine reads it: both nil in no
|
|
364
|
+
# repository, before the first commit, or when git does not answer.
|
|
365
|
+
# A dirty checkout fails nothing; the summary says so.
|
|
366
|
+
# : (String) -> Hash[Symbol, untyped]
|
|
367
|
+
def self.checkout_state: (String) -> Hash[Symbol, untyped]
|
|
368
|
+
|
|
369
|
+
# The commit git's status header names, and whether a line other than
|
|
370
|
+
# a header follows. Pure.
|
|
371
|
+
# : (String) -> Hash[Symbol, untyped]
|
|
372
|
+
def self.checkout_state_of: (String) -> Hash[Symbol, untyped]
|
|
373
|
+
|
|
374
|
+
# The directory a service's commands run in, absolute, in the tree at
|
|
375
|
+
# `tree_root`: a tree service's place in it, or the checkout every
|
|
376
|
+
# tree shares. A service nukadoko only reaches runs no command, so
|
|
377
|
+
# the tree's root stands in.
|
|
378
|
+
# : (Hash[Symbol, untyped], String) -> String
|
|
379
|
+
def self.service_directory: (Hash[Symbol, untyped], String) -> String
|
|
380
|
+
|
|
381
|
+
# The root of the git repository `tree_root` is in, in `tree_root`'s
|
|
382
|
+
# own terms (not resolved through a link where `tree_root` is not), or
|
|
383
|
+
# `tree_root` when it is in none: then every directory outside the
|
|
384
|
+
# tree is a checkout.
|
|
385
|
+
# : (String) -> String
|
|
386
|
+
def self.repository_root_of: (String) -> String
|
|
387
|
+
|
|
388
|
+
# A service of a system whose root names no directory: a checkout a
|
|
389
|
+
# run needs and does not have is named before anything builds, so a
|
|
390
|
+
# missing clone reads as one rather than as a build that failed in a
|
|
391
|
+
# directory that is not there.
|
|
392
|
+
# : (Array[[String, Recipe]], String) -> Array[Hash[Symbol, String]]
|
|
393
|
+
def self.missing_service_roots: (Array[[ String, Recipe ]], String) -> Array[Hash[Symbol, String]]
|
|
394
|
+
|
|
395
|
+
# : (Hash[Symbol, String]) -> String
|
|
396
|
+
def self.describe_missing_service_root: (Hash[Symbol, String]) -> String
|
|
397
|
+
|
|
398
|
+
# : (Hash[Symbol, String], String) -> String
|
|
399
|
+
def self.missing_service_root_fix: (Hash[Symbol, String], String) -> String
|
|
400
|
+
|
|
401
|
+
# The refusal for the systems a command is about to start, before any
|
|
402
|
+
# of them builds: every missing root in one message, and the edit for
|
|
403
|
+
# the first. nil when every root is there.
|
|
404
|
+
# : (Array[[String, Recipe]], String, String) -> Refusal?
|
|
405
|
+
def self.service_root_refusal: (Array[[ String, Recipe ]], String, String) -> Refusal?
|
|
406
|
+
|
|
407
|
+
# One service as setup and a step's `services` read it, its entry in
|
|
408
|
+
# the system's address book: where it answers, the directory its
|
|
409
|
+
# commands run in, its own directory, and its env, placeholders
|
|
410
|
+
# filled. The TypeScript engine names it ProgramService.
|
|
411
|
+
class Address < Data
|
|
412
|
+
attr_reader url(): String?
|
|
413
|
+
|
|
414
|
+
attr_reader port(): Integer?
|
|
415
|
+
|
|
416
|
+
attr_reader root(): String
|
|
417
|
+
|
|
418
|
+
attr_reader dir(): String
|
|
419
|
+
|
|
420
|
+
attr_reader env(): Hash[String, String]
|
|
421
|
+
|
|
422
|
+
def self.new: (String? url, Integer? port, String root, String dir, Hash[String, String] env) -> instance
|
|
423
|
+
| (url: String?, port: Integer?, root: String, dir: String, env: Hash[String, String]) -> instance
|
|
424
|
+
|
|
425
|
+
def self.members: () -> [ :url, :port, :root, :dir, :env ]
|
|
426
|
+
|
|
427
|
+
def members: () -> [ :url, :port, :root, :dir, :env ]
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
# What setup receives once its program answers, and a url function
|
|
431
|
+
# as it is asked, as the TypeScript engine's ProgramSystem names it.
|
|
432
|
+
# `service` is the service it answers for: the primary for setup.
|
|
433
|
+
# `services` is every service of the system by name, empty for a url
|
|
434
|
+
# function, which runs before every address is known.
|
|
435
|
+
# `env` is what the steps' env fixture holds: the environment's env
|
|
436
|
+
# files, then the primary service's env with its placeholders filled,
|
|
437
|
+
# minus the variables whose value names {events}. setup is the
|
|
438
|
+
# program's first client, so it reads what a step reads, down to a
|
|
439
|
+
# test API key an env file keeps for a shared environment.
|
|
440
|
+
# `conditions` are the facts a scenario's @with: and @without: tags
|
|
441
|
+
# name, which setup switches for the system it is making, so a
|
|
442
|
+
# scenario names a switch with a tag and no step branches on the
|
|
443
|
+
# environment.
|
|
444
|
+
class SetupSystem < Data
|
|
445
|
+
attr_reader name(): String
|
|
446
|
+
|
|
447
|
+
attr_reader service(): String
|
|
448
|
+
|
|
449
|
+
attr_reader root(): String
|
|
450
|
+
|
|
451
|
+
attr_reader dir(): String
|
|
452
|
+
|
|
453
|
+
attr_reader tree(): String
|
|
454
|
+
|
|
455
|
+
attr_reader url(): String?
|
|
456
|
+
|
|
457
|
+
attr_reader port(): Integer?
|
|
458
|
+
|
|
459
|
+
attr_reader env(): Hash[String, String]
|
|
460
|
+
|
|
461
|
+
attr_reader services(): Hash[String, Address]
|
|
462
|
+
|
|
463
|
+
attr_reader conditions(): Hash[String, untyped]
|
|
464
|
+
|
|
465
|
+
def self.new: (String name, String service, String root, String dir, String tree, String? url, Integer? port, Hash[String, String] env, Hash[String, Address] services, Hash[String, untyped] conditions) -> instance
|
|
466
|
+
| (name: String, service: String, root: String, dir: String, tree: String, url: String?, port: Integer?, env: Hash[String, String], services: Hash[String, Address], conditions: Hash[String, untyped]) -> instance
|
|
467
|
+
|
|
468
|
+
def self.members: () -> [ :name, :service, :root, :dir, :tree, :url, :port, :env, :services, :conditions ]
|
|
469
|
+
|
|
470
|
+
def members: () -> [ :name, :service, :root, :dir, :tree, :url, :port, :env, :services, :conditions ]
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
# Why a system did not start, in the TypeScript engine's words.
|
|
474
|
+
class StartError < StandardError
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
# A base system with no URL to reach: it runs no cell, and nothing failed.
|
|
478
|
+
class Unavailable < StandardError
|
|
479
|
+
end
|
|
480
|
+
|
|
481
|
+
# A system that did not start: the message program-start-failed
|
|
482
|
+
# carries, and the system as far as it got, which run.json names with
|
|
483
|
+
# its cause.
|
|
484
|
+
class StartFailed < StandardError
|
|
485
|
+
attr_reader system: System
|
|
486
|
+
|
|
487
|
+
attr_reader cause_text: String
|
|
488
|
+
|
|
489
|
+
# : (String, System, String) -> void
|
|
490
|
+
def initialize: (String, System, String) -> void
|
|
491
|
+
end
|
|
492
|
+
|
|
493
|
+
# argv as a shell would read it back, for a message and the log.
|
|
494
|
+
# : (Array[String]) -> String
|
|
495
|
+
def self.display: (Array[String]) -> String
|
|
496
|
+
|
|
497
|
+
# A command's words: an Array as written, a String split on whitespace.
|
|
498
|
+
# : (String | Array[String]) -> Array[String]
|
|
499
|
+
def self.words: (String | Array[String]) -> Array[String]
|
|
500
|
+
|
|
501
|
+
# Each placeholder with its value; one with none is left as written,
|
|
502
|
+
# which placeholder_gaps has already refused.
|
|
503
|
+
# : (String, Hash[String, String], Hash[String, untyped]) -> String
|
|
504
|
+
def self.filled: (String, Hash[String, String], Hash[String, untyped]) -> String
|
|
505
|
+
|
|
506
|
+
# Runs one list command to its end and reads what it printed: the
|
|
507
|
+
# list's entries (`{ entries: }`), or why it was not read
|
|
508
|
+
# (`{ problem: }`). A failure is the list's and never the system's.
|
|
509
|
+
# : (String, Array[String], Integer, Hash[String, String], String, ProgramLog) -> Hash[Symbol, untyped]
|
|
510
|
+
def self.read_list: (String, Array[String], Integer, Hash[String, String], String, ProgramLog) -> Hash[Symbol, untyped]
|
|
511
|
+
|
|
512
|
+
# Runs one build, prepare, or list command to its end in the tree's
|
|
513
|
+
# root, its stderr in the system's log and its stdout in `out` (the
|
|
514
|
+
# log unless a list reads it), its process group stopped at its limit.
|
|
515
|
+
# It returns once what it printed is in the log, so the next
|
|
516
|
+
# command's line comes after it.
|
|
517
|
+
# : (String, Array[String], Integer, Hash[String, String], String, ProgramLog, ?out: IO?) -> void
|
|
518
|
+
def self.run_to_end: (String, Array[String], Integer, Hash[String, String], String, ProgramLog, ?out: IO?) -> void
|
|
519
|
+
|
|
520
|
+
# The port a request to `url` goes to: the one it writes, or its scheme's.
|
|
521
|
+
# : (String) -> Integer
|
|
522
|
+
def self.url_port: (String) -> Integer
|
|
523
|
+
|
|
524
|
+
# Why `url` cannot be a system's URL: only http: and https: reach the
|
|
525
|
+
# system, and a user or a password in it would print in every record.
|
|
526
|
+
# The reason never quotes the URL, for that password.
|
|
527
|
+
# : (String) -> String?
|
|
528
|
+
def self.url_problem: (String) -> String?
|
|
529
|
+
|
|
530
|
+
# A URL as another tree's pass compares it: the same URL written two
|
|
531
|
+
# ways reads as one key, and the key says nothing of what the URL
|
|
532
|
+
# holds. A base tree learns head's URLs through a file in the run
|
|
533
|
+
# directory, and a URL can carry a token in its query, which every
|
|
534
|
+
# record redacts, so the key is a digest: the base needs only to know
|
|
535
|
+
# whether its own url function answered with head's.
|
|
536
|
+
# : (String) -> String
|
|
537
|
+
def self.url_key: (String) -> String
|
|
538
|
+
|
|
539
|
+
# `count` free ports, each held open until all are taken, so no two
|
|
540
|
+
# are the same.
|
|
541
|
+
# : (Integer) -> Array[Integer]
|
|
542
|
+
def self.free_ports: (Integer) -> Array[Integer]
|
|
543
|
+
|
|
544
|
+
# A port the program names is checked before it starts: one something
|
|
545
|
+
# already answers on would send every request to a server nukadoko
|
|
546
|
+
# did not start.
|
|
547
|
+
# : (Integer) -> Integer
|
|
548
|
+
def self.unanswered: (Integer) -> Integer
|
|
59
549
|
|
|
60
550
|
private
|
|
61
551
|
|
|
62
|
-
#
|
|
63
|
-
|
|
552
|
+
# A service's build, once per run for its root and commands: a system
|
|
553
|
+
# whose build already ran for another system waits on nothing and
|
|
554
|
+
# notes it in the service's log.
|
|
555
|
+
# : (ServiceRecipe, Service, String, ^(String) -> void) -> Integer?
|
|
556
|
+
def build: (ServiceRecipe, Service, String, ^(String) -> void) -> Integer?
|
|
557
|
+
|
|
558
|
+
# A url function's answer, under its limit, checked by the rule a
|
|
559
|
+
# written url is checked by when the file is read. What it prints
|
|
560
|
+
# goes to the log and to `progress`.
|
|
561
|
+
# : (Hash[Symbol, untyped], SetupSystem, String, ProgramLog, untyped) -> String
|
|
562
|
+
def reach_url: (Hash[Symbol, untyped], SetupSystem, String, ProgramLog, untyped) -> String
|
|
563
|
+
|
|
564
|
+
# Runs a setup or a url function under its limit. Ruby's Timeout stops
|
|
565
|
+
# it where it is, which the TypeScript engine cannot do.
|
|
566
|
+
# : [T] (String, Integer) { (Numeric) -> T } -> T
|
|
567
|
+
def within: [T] (String, Integer) { (Numeric) -> T } -> T
|
|
568
|
+
|
|
569
|
+
# Runs a setup or a url function with what it prints on $stdout and
|
|
570
|
+
# $stderr sent to the log and to `progress`, line by line and
|
|
571
|
+
# redacted, as the TypeScript engine sends it: the function runs in
|
|
572
|
+
# nukadoko's own process, where a `{token}` it prints would reach the
|
|
573
|
+
# terminal as it is, and `nuka run --json`'s stdout is the envelope.
|
|
574
|
+
# A write straight to STDOUT or STDERR is not seen.
|
|
575
|
+
# : [T] (ProgramLog, untyped) { () -> T } -> T
|
|
576
|
+
def printing_to: [T] (ProgramLog, untyped) { () -> T } -> T
|
|
64
577
|
end
|
|
65
578
|
|
|
66
|
-
#
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
|
|
579
|
+
# One started service of a system: where it answers, its env, its log,
|
|
580
|
+
# and what it ran. `timings` gains each phase as it ends. `pid` is the
|
|
581
|
+
# process group nukadoko serves; `events_path` the file it appends its
|
|
582
|
+
# execution events to when it names {events}.
|
|
583
|
+
class Service < Data
|
|
584
|
+
attr_reader name(): String
|
|
585
|
+
|
|
586
|
+
attr_reader code(): Hash[Symbol, untyped]
|
|
587
|
+
|
|
588
|
+
attr_reader root(): String
|
|
589
|
+
|
|
590
|
+
attr_reader dir(): String
|
|
591
|
+
|
|
592
|
+
attr_reader base_url(): String?
|
|
593
|
+
|
|
594
|
+
attr_reader port(): Integer?
|
|
70
595
|
|
|
71
596
|
attr_reader pid(): Integer?
|
|
72
597
|
|
|
73
|
-
attr_reader log():
|
|
598
|
+
attr_reader log(): ProgramLog
|
|
74
599
|
|
|
75
600
|
attr_reader env(): Hash[String, String]
|
|
76
601
|
|
|
77
|
-
attr_reader
|
|
78
|
-
|
|
79
|
-
attr_reader log_path(): String?
|
|
602
|
+
attr_reader events_path(): String?
|
|
80
603
|
|
|
81
604
|
attr_reader commands(): Array[Hash[Symbol, untyped]]
|
|
82
605
|
|
|
83
606
|
attr_reader timings(): Hash[Symbol, Integer]
|
|
84
607
|
|
|
85
|
-
|
|
86
|
-
|
|
608
|
+
attr_reader places(): Hash[String, Array[Hash[Symbol, untyped]]]
|
|
609
|
+
|
|
610
|
+
attr_reader listed(): Hash[String, Hash[Symbol, untyped]]
|
|
611
|
+
|
|
612
|
+
attr_reader tables(): Hash[Symbol, untyped]
|
|
613
|
+
|
|
614
|
+
attr_reader error(): String?
|
|
87
615
|
|
|
88
|
-
def self.
|
|
616
|
+
def self.new: (String name, Hash[Symbol, untyped] code, String root, String dir, String? base_url, Integer? port, Integer? pid, ProgramLog log, Hash[String, String] env, String? events_path, Array[Hash[Symbol, untyped]] commands, Hash[Symbol, Integer] timings, Hash[String, Array[Hash[Symbol, untyped]]] places, Hash[String, Hash[Symbol, untyped]] listed, Hash[Symbol, untyped] tables, String? error) -> instance
|
|
617
|
+
| (name: String, code: Hash[Symbol, untyped], root: String, dir: String, base_url: String?, port: Integer?, pid: Integer?, log: ProgramLog, env: Hash[String, String], events_path: String?, commands: Array[Hash[Symbol, untyped]], timings: Hash[Symbol, Integer], places: Hash[String, Array[Hash[Symbol, untyped]]], listed: Hash[String, Hash[Symbol, untyped]], tables: Hash[Symbol, untyped], error: String?) -> instance
|
|
89
618
|
|
|
90
|
-
def members: () -> [ :base_url, :pid, :log, :env, :
|
|
619
|
+
def self.members: () -> [ :name, :code, :root, :dir, :base_url, :port, :pid, :log, :env, :events_path, :commands, :timings, :places, :listed, :tables, :error ]
|
|
620
|
+
|
|
621
|
+
def members: () -> [ :name, :code, :root, :dir, :base_url, :port, :pid, :log, :env, :events_path, :commands, :timings, :places, :listed, :tables, :error ]
|
|
91
622
|
end
|
|
92
623
|
|
|
93
|
-
class
|
|
94
|
-
#
|
|
95
|
-
|
|
624
|
+
class Service
|
|
625
|
+
# The service's program.log, once anything was written to it.
|
|
626
|
+
# : () -> String?
|
|
627
|
+
def log_path: () -> String?
|
|
628
|
+
|
|
629
|
+
# Ready once `path` answers 2xx, as in the TypeScript engine: a 404 or
|
|
630
|
+
# a 503 from a server still starting is not a program that can take
|
|
631
|
+
# requests. A program that exits first, or never answers 2xx within
|
|
632
|
+
# `timeout_ms`, stops the system.
|
|
633
|
+
# A redirect is an answer, not ready: following one would let a ready
|
|
634
|
+
# path that sends the check elsewhere answer for the program.
|
|
635
|
+
# : (String, Integer, Array[String]) -> void
|
|
636
|
+
def wait_ready: (String, Integer, Array[String]) -> void
|
|
96
637
|
|
|
638
|
+
# Sends the service's process group SIGTERM, the first half of a stop.
|
|
639
|
+
# : () -> void
|
|
640
|
+
def terminate: () -> void
|
|
641
|
+
|
|
642
|
+
# Waits for the service's process, then puts what it printed last in
|
|
643
|
+
# the log before anything reads it, and closes the log.
|
|
644
|
+
# : () -> void
|
|
645
|
+
def finish: () -> void
|
|
646
|
+
|
|
647
|
+
# Removes the events file and its directory, once its lines are read.
|
|
648
|
+
# : () -> void
|
|
649
|
+
def remove_events: () -> void
|
|
650
|
+
end
|
|
651
|
+
|
|
652
|
+
# A started program: the prefix of every trace id its steps carry, its
|
|
653
|
+
# services, and the one the steps reach. `timings` gains setup_ms, and
|
|
654
|
+
# stop_ms at its stop. `secrets` are the system's own, its {token} as
|
|
655
|
+
# SYSTEM_TOKEN and its trace ids kept, which every record redacts with.
|
|
656
|
+
class System < Data
|
|
657
|
+
attr_reader trace_prefix(): String
|
|
658
|
+
|
|
659
|
+
attr_reader timings(): Hash[Symbol, Integer]
|
|
660
|
+
|
|
661
|
+
attr_reader secrets(): Secrets
|
|
662
|
+
|
|
663
|
+
attr_reader primary(): String
|
|
664
|
+
|
|
665
|
+
attr_reader services(): Array[Service]
|
|
666
|
+
|
|
667
|
+
attr_reader setup_result(): untyped
|
|
668
|
+
|
|
669
|
+
attr_reader steps_reach(): String
|
|
670
|
+
|
|
671
|
+
def self.new: (String trace_prefix, Hash[Symbol, Integer] timings, Secrets secrets, String primary, Array[Service] services, untyped setup_result, String steps_reach) -> instance
|
|
672
|
+
| (trace_prefix: String, timings: Hash[Symbol, Integer], secrets: Secrets, primary: String, services: Array[Service], setup_result: untyped, steps_reach: String) -> instance
|
|
673
|
+
|
|
674
|
+
def self.members: () -> [ :trace_prefix, :timings, :secrets, :primary, :services, :setup_result, :steps_reach ]
|
|
675
|
+
|
|
676
|
+
def members: () -> [ :trace_prefix, :timings, :secrets, :primary, :services, :setup_result, :steps_reach ]
|
|
677
|
+
end
|
|
678
|
+
|
|
679
|
+
class System
|
|
680
|
+
# The service the steps reach.
|
|
681
|
+
# : () -> Service
|
|
682
|
+
def primary_service: () -> Service
|
|
683
|
+
|
|
684
|
+
# Each service with a URL as a step's trace reaches it, in the
|
|
685
|
+
# program's order: a request to a stamped one gets the step's
|
|
686
|
+
# traceparent. A service with `external: true` is a third party's,
|
|
687
|
+
# which nukadoko sends no header it did not expect.
|
|
688
|
+
# : () -> Array[Hash[Symbol, untyped]]
|
|
689
|
+
def trace_origins: () -> Array[Hash[Symbol, untyped]]
|
|
690
|
+
|
|
691
|
+
# Each service with a URL by name: the reader of its log, or nil for
|
|
692
|
+
# one at a `url`, whose log nukadoko does not read.
|
|
693
|
+
# : () -> Hash[String, Trace::Log?]
|
|
694
|
+
def program_logs: () -> Hash[String, Trace::Log?]
|
|
695
|
+
|
|
696
|
+
# Every service's process group gets SIGTERM at once, and the stop
|
|
697
|
+
# waits for each.
|
|
97
698
|
# : () -> void
|
|
98
699
|
def stop: () -> void
|
|
700
|
+
|
|
701
|
+
# : () -> void
|
|
702
|
+
def remove_events: () -> void
|
|
99
703
|
end
|
|
100
704
|
end
|
|
101
705
|
end
|