pray-cli 1.20.0 → 1.21.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 +7 -0
- data/lib/pray/cli/help.rb +9 -1
- data/lib/pray/git_materialize.rb +1 -1
- data/lib/pray/git_run.rb +30 -1
- data/lib/pray/git_store.rb +24 -0
- data/lib/pray/registry.rb +2 -2
- data/lib/pray/trust_ops.rb +2 -1
- data/lib/pray/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cdfebfb1eb131a2329908805545aff6330a96381e7790251da11a615cb30174d
|
|
4
|
+
data.tar.gz: 10dd49010364b5525e230ec4b567c9fe0fe036ed61e26397db2f6ab8370134cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a25b584cc6561c2454642f23e2e6a7245966e928d10c5c7ff903cdab564e82c0ec0b985918fdc0c5586451b6dce770b4cbb9e330e2a78476fb904fa6bf4e9fe
|
|
7
|
+
data.tar.gz: a53cce034d8cca01ab38119f982515b715c72b70675e9d97999d00cbaa43bf5e804eb205a48fb64846d1b1069fc44d28f535ae9d34be75e945eadbc4426944ab
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 1.21.0 (2026-10-21)
|
|
4
|
+
|
|
5
|
+
- Read package catalogs whose `published_at` is an RFC 3339 string or JSON null.
|
|
6
|
+
- Keep prayer sources under `prayers/<name>/`, beside `prayers/v1/` when this project publishes. `prayers/v1/packages/` is catalog metadata. A root `packages/` folder is not a pray source convention.
|
|
7
|
+
- Prevent commands from changing the calling repository when a Git hook passes repository variables such as `GIT_DIR` or `GIT_WORK_TREE`. Explicit Git configuration, including CI credentials and URL rewrites, still applies.
|
|
8
|
+
- Refuse a damaged Git cache that resolves to a parent repository before changing its remote.
|
|
9
|
+
|
|
3
10
|
## 1.20.0 (2026-09-18)
|
|
4
11
|
|
|
5
12
|
- Fetch a locked git catalog revision during `pray install` when the local cache does not have that commit yet. `pray install --offline` still refuses a missing commit.
|
data/lib/pray/cli/help.rb
CHANGED
|
@@ -207,11 +207,19 @@ module Pray
|
|
|
207
207
|
The default directory is prayers/. Use --path to choose another.
|
|
208
208
|
Declares pray "<source>/<name>" once, such as pray "local/project", inside compose when a compose block exists.
|
|
209
209
|
The default name is project. The name v1 is reserved for the distribution layout.
|
|
210
|
+
Named prayers may sit beside prayers/v1/. Keep sources under prayers/<name>/.
|
|
210
211
|
Without a Prayfile, writes a versioned package spec in the current directory.
|
|
211
212
|
Add spec.version before pray package or pray publish.
|
|
212
213
|
A compose file such as .agents/project.md remains a shortcut for one local file.
|
|
213
214
|
TEXT
|
|
214
|
-
"repo" =>
|
|
215
|
+
"repo" => <<~TEXT.strip,
|
|
216
|
+
scaffold a distribution root
|
|
217
|
+
|
|
218
|
+
Usage: pray repo init
|
|
219
|
+
|
|
220
|
+
Writes prayers/v1/. Git install discovers that catalog. Named prayers may sit beside v1/.
|
|
221
|
+
Keep sources under prayers/<name>/.
|
|
222
|
+
TEXT
|
|
215
223
|
"manifest" => "print canonical Prayfile JSON\n\nUsage: pray manifest",
|
|
216
224
|
"package" => "build a distributable prayer archive\n\nUsage: pray package",
|
|
217
225
|
"version" => <<~TEXT.strip,
|
data/lib/pray/git_materialize.rb
CHANGED
data/lib/pray/git_run.rb
CHANGED
|
@@ -5,8 +5,37 @@ require_relative "error"
|
|
|
5
5
|
|
|
6
6
|
module Pray
|
|
7
7
|
module GitRun
|
|
8
|
+
# Mirrors git's own sanitize_repo_env: `git rev-parse --local-env-vars` minus
|
|
9
|
+
# GIT_CONFIG_PARAMETERS and GIT_CONFIG_COUNT. Git exports these to hooks, so
|
|
10
|
+
# pray started from a hook would otherwise run every cache command against the
|
|
11
|
+
# host repository. The two config variables pass through, as they do when git
|
|
12
|
+
# enters a submodule, because callers such as CI jobs use them to hand git
|
|
13
|
+
# credentials or URL rewrites, and they cannot select a repository.
|
|
14
|
+
REPOSITORY_LOCAL_VARIABLES = %w[
|
|
15
|
+
GIT_ALTERNATE_OBJECT_DIRECTORIES
|
|
16
|
+
GIT_CONFIG
|
|
17
|
+
GIT_OBJECT_DIRECTORY
|
|
18
|
+
GIT_DIR
|
|
19
|
+
GIT_WORK_TREE
|
|
20
|
+
GIT_IMPLICIT_WORK_TREE
|
|
21
|
+
GIT_GRAFT_FILE
|
|
22
|
+
GIT_INDEX_FILE
|
|
23
|
+
GIT_NO_REPLACE_OBJECTS
|
|
24
|
+
GIT_REPLACE_REF_BASE
|
|
25
|
+
GIT_PREFIX
|
|
26
|
+
GIT_SHALLOW_FILE
|
|
27
|
+
GIT_COMMON_DIR
|
|
28
|
+
].freeze
|
|
29
|
+
|
|
8
30
|
module_function
|
|
9
31
|
|
|
32
|
+
# Process.spawn merges this hash into the inherited environment, so a nil
|
|
33
|
+
# value is what removes a variable. Credential, SSH, proxy and global config
|
|
34
|
+
# variables still pass through.
|
|
35
|
+
def git_env(extra = {})
|
|
36
|
+
REPOSITORY_LOCAL_VARIABLES.to_h { |name| [name, nil] }.merge(extra)
|
|
37
|
+
end
|
|
38
|
+
|
|
10
39
|
def run_git(cwd, *arguments)
|
|
11
40
|
output, status = capture_git(cwd, *arguments)
|
|
12
41
|
return if status.success?
|
|
@@ -20,7 +49,7 @@ module Pray
|
|
|
20
49
|
end
|
|
21
50
|
|
|
22
51
|
def capture_git(cwd, *arguments)
|
|
23
|
-
env =
|
|
52
|
+
env = git_env("GIT_TERMINAL_PROMPT" => "0")
|
|
24
53
|
Open3.capture2e(
|
|
25
54
|
env,
|
|
26
55
|
"git",
|
data/lib/pray/git_store.rb
CHANGED
|
@@ -73,6 +73,7 @@ module Pray
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def ensure_git_remote_origin(repository, clone_url)
|
|
76
|
+
require_own_git_dir(repository)
|
|
76
77
|
if GitRun.try_run_git(repository, "remote", "get-url", "origin")
|
|
77
78
|
GitRun.run_git(repository, "remote", "set-url", "origin", clone_url)
|
|
78
79
|
else
|
|
@@ -80,6 +81,29 @@ module Pray
|
|
|
80
81
|
end
|
|
81
82
|
end
|
|
82
83
|
|
|
84
|
+
# Git searches parent directories when `repository` is not a valid git
|
|
85
|
+
# directory, so a damaged cache inside another checkout would otherwise
|
|
86
|
+
# rewrite that checkout's origin.
|
|
87
|
+
def require_own_git_dir(repository)
|
|
88
|
+
output, status = GitRun.capture_git(repository, "rev-parse", "--absolute-git-dir")
|
|
89
|
+
resolved = status.success? ? output.strip : ""
|
|
90
|
+
own = [repository, File.join(repository, ".git")].any? do |candidate|
|
|
91
|
+
real_path(candidate) && real_path(candidate) == real_path(resolved)
|
|
92
|
+
end
|
|
93
|
+
return if own
|
|
94
|
+
|
|
95
|
+
raise Error.resolution(
|
|
96
|
+
"git cache #{repository} is not a usable git repository (git resolved #{resolved.inspect}). " \
|
|
97
|
+
"Remove it and run the command again."
|
|
98
|
+
)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def real_path(path)
|
|
102
|
+
File.realpath(path)
|
|
103
|
+
rescue SystemCallError
|
|
104
|
+
nil
|
|
105
|
+
end
|
|
106
|
+
|
|
83
107
|
def fetch_origin_tip(db, clone_url)
|
|
84
108
|
ensure_git_remote_origin(db, clone_url)
|
|
85
109
|
unless GitRun.try_run_git(db, "fetch", "--depth", "1", "--filter=blob:none", "origin")
|
data/lib/pray/registry.rb
CHANGED
|
@@ -165,9 +165,9 @@ module Pray
|
|
|
165
165
|
|
|
166
166
|
def publish_timestamp_from_value(value)
|
|
167
167
|
timestamp = case value
|
|
168
|
+
when nil then return nil
|
|
168
169
|
when Integer then value
|
|
169
|
-
when String
|
|
170
|
-
value.match?(/\A\d+\z/) ? value.to_i : Time.iso8601(value).to_i
|
|
170
|
+
when String then value.match?(/\A\d+\z/) ? value.to_i : Time.iso8601(value).to_i
|
|
171
171
|
end
|
|
172
172
|
unless timestamp&.between?(0, 253_402_300_799)
|
|
173
173
|
raise Error.integrity("registry published_at must be whole UTC Unix seconds")
|
data/lib/pray/trust_ops.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "json"
|
|
4
|
+
require_relative "git_run"
|
|
4
5
|
|
|
5
6
|
module Pray
|
|
6
7
|
module Trust
|
|
@@ -189,7 +190,7 @@ module Pray
|
|
|
189
190
|
|
|
190
191
|
def git_format(repository, format)
|
|
191
192
|
output = IO.popen(
|
|
192
|
-
["git", "-C", repository, "log", "-1", "--format=#{format}"],
|
|
193
|
+
[GitRun.git_env, "git", "-C", repository, "log", "-1", "--format=#{format}"],
|
|
193
194
|
err: File::NULL, &:read
|
|
194
195
|
)
|
|
195
196
|
return "" unless $?.success?
|
data/lib/pray/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pray-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.21.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrei Makarov
|
|
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
240
240
|
- !ruby/object:Gem::Version
|
|
241
241
|
version: '0'
|
|
242
242
|
requirements: []
|
|
243
|
-
rubygems_version:
|
|
243
|
+
rubygems_version: 3.6.9
|
|
244
244
|
specification_version: 4
|
|
245
245
|
summary: Package manager for the language placed before inference (Prayfile)
|
|
246
246
|
test_files: []
|