buildonce 0.1.0 → 0.14.5
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94f603723c07153ed988e59624408c03454c3b9c244f578acbe6aef68ab5ed35
|
|
4
|
+
data.tar.gz: ee8f17fe19dc4b8e44fdd311d65a57578cfb4f6785915a78c5b716ec4a108a62
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e8061a01f4e1ebaca4121a6a28efcc2950761b82b4efe60a2a4c73326360d93b97d527ecd3515b425b6b1a153f2d7dc208413ebd5fc11d3252c9dd0c37f62b6d
|
|
7
|
+
data.tar.gz: 54c05c97f89e5359110f6b02335af6fc46f72a175ee455f785fdc4f30fe3aea06cde0e8230110d812df13c49ebf52e989f73798a5f94a7a02101c2178e7f9f44
|
data/lib/buildonce.rb
CHANGED
|
@@ -7,6 +7,11 @@ module Once
|
|
|
7
7
|
class Error < StandardError; end
|
|
8
8
|
|
|
9
9
|
ActionResult = Struct.new(:exit_code, :stdout, :stderr, :outputs, keyword_init: true) do
|
|
10
|
+
def initialize(exit_code:, stdout: nil, stderr: nil, outputs: {})
|
|
11
|
+
outputs ||= {}
|
|
12
|
+
super(exit_code: exit_code, stdout: stdout, stderr: stderr, outputs: outputs.dup.freeze)
|
|
13
|
+
end
|
|
14
|
+
|
|
10
15
|
def to_h
|
|
11
16
|
{
|
|
12
17
|
exit_code: exit_code,
|
|
@@ -21,17 +26,12 @@ module Once
|
|
|
21
26
|
|
|
22
27
|
class Cache
|
|
23
28
|
def version
|
|
24
|
-
|
|
25
|
-
return "" if pointer.null?
|
|
26
|
-
|
|
27
|
-
pointer.read_string
|
|
28
|
-
ensure
|
|
29
|
-
Native.once_string_free(pointer) if pointer && !pointer.null?
|
|
29
|
+
read_native_string(Native.once_version)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def digest(bytes)
|
|
33
33
|
buffer = bytes.to_s.b
|
|
34
|
-
pointer =
|
|
34
|
+
pointer = memory_pointer(buffer)
|
|
35
35
|
decode_response(Native.once_digest_bytes(pointer, buffer.bytesize))
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -82,17 +82,33 @@ module Once
|
|
|
82
82
|
decode_response(Native.public_send(function, JSON.generate(request)))
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
+
def memory_pointer(buffer)
|
|
86
|
+
pointer = FFI::MemoryPointer.new(:uint8, [buffer.bytesize, 1].max)
|
|
87
|
+
pointer.put_bytes(0, buffer) unless buffer.empty?
|
|
88
|
+
pointer
|
|
89
|
+
end
|
|
90
|
+
|
|
85
91
|
def decode_response(pointer)
|
|
86
92
|
raise Error, "native Once function returned null" if pointer.null?
|
|
87
93
|
|
|
88
|
-
response = JSON.parse(pointer
|
|
94
|
+
response = JSON.parse(read_native_string(pointer, free: false))
|
|
89
95
|
return response.fetch("value") if response.fetch("status") == "ok"
|
|
90
96
|
|
|
91
97
|
raise Error, response.fetch("message")
|
|
98
|
+
rescue JSON::ParserError, KeyError => e
|
|
99
|
+
raise Error, e.message
|
|
92
100
|
ensure
|
|
93
101
|
Native.once_string_free(pointer) if pointer && !pointer.null?
|
|
94
102
|
end
|
|
95
103
|
|
|
104
|
+
def read_native_string(pointer, free: true)
|
|
105
|
+
raise Error, "native Once function returned null" if pointer.null?
|
|
106
|
+
|
|
107
|
+
pointer.read_string
|
|
108
|
+
ensure
|
|
109
|
+
Native.once_string_free(pointer) if free && pointer && !pointer.null?
|
|
110
|
+
end
|
|
111
|
+
|
|
96
112
|
def normalize_action_result(result)
|
|
97
113
|
result = result.to_h if result.respond_to?(:to_h)
|
|
98
114
|
{
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: buildonce
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.14.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tuist GmbH
|
|
@@ -32,6 +32,10 @@ files:
|
|
|
32
32
|
- lib/buildonce.rb
|
|
33
33
|
- lib/once/native.rb
|
|
34
34
|
- prebuilds/darwin-arm64/libonce.dylib
|
|
35
|
+
- prebuilds/darwin-x64/libonce.dylib
|
|
36
|
+
- prebuilds/linux-arm64/libonce.so
|
|
37
|
+
- prebuilds/linux-x64/libonce.so
|
|
38
|
+
- prebuilds/win32-x64/once.dll
|
|
35
39
|
homepage: https://github.com/tuist/once
|
|
36
40
|
licenses:
|
|
37
41
|
- MIT
|