pandoc_wasm 1.0.1 → 1.0.2
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 +6 -0
- data/lib/pandoc_wasm/downloader.rb +17 -31
- data/lib/pandoc_wasm/version.rb +1 -1
- data/lib/pandoc_wasm.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e2a92cf9f4e9346c16d9a6afd6601837b50919fffb585796649448998e9c8fb
|
|
4
|
+
data.tar.gz: 2a7e0869dc0b5687582af570f870b2e3577be3259ae7f00f3c62377014b5e33a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 188d20ae2dc70cbd91bffacc364810ab8f557f71d3e7f00926b8d93a728ba5608f5bb5ed782c36b0d7029adeb45ce3b5771de61a6e48a7c96b919ea0a61569b6
|
|
7
|
+
data.tar.gz: 8f5ac3435566cad7a936bfdd4b9b0df5d2ef77c6b51638df03dc4412c2df543c787974963594d534a0f7fff8fe0744ee72d0350d1ab3ec7473c6158797c39191
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.0.2] - 2026-02-12
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Fix redirect handling in downloader that prevented asset downloads from GitHub Releases (HTTP 302 not followed).
|
|
15
|
+
|
|
10
16
|
## [1.0.1] - 2026-02-10
|
|
11
17
|
|
|
12
18
|
### Fixed
|
|
@@ -11,7 +11,10 @@ module PandocWasm
|
|
|
11
11
|
REPO_NAME = 'pandoc-wasm'
|
|
12
12
|
ASSET_NAME = 'pandoc.wasm'
|
|
13
13
|
|
|
14
|
-
# Download pandoc.wasm from the
|
|
14
|
+
# Download pandoc.wasm from the GitHub Release matching the gem version.
|
|
15
|
+
#
|
|
16
|
+
# The release tag is derived from PandocWasm::VERSION (e.g. "1.0.1" -> "v1.0.1"),
|
|
17
|
+
# so the downloaded binary always matches the installed gem version.
|
|
15
18
|
#
|
|
16
19
|
# @param to [String] absolute path where the binary will be written
|
|
17
20
|
# @return [true] on success
|
|
@@ -21,7 +24,7 @@ module PandocWasm
|
|
|
21
24
|
FileUtils.mkdir_p(File.dirname(target))
|
|
22
25
|
|
|
23
26
|
begin
|
|
24
|
-
tag =
|
|
27
|
+
tag = release_tag
|
|
25
28
|
download_asset(tag, target)
|
|
26
29
|
true
|
|
27
30
|
rescue StandardError => e
|
|
@@ -31,34 +34,15 @@ module PandocWasm
|
|
|
31
34
|
end
|
|
32
35
|
end
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
#
|
|
37
|
-
def self.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
|
41
|
-
http.use_ssl = true
|
|
42
|
-
http.read_timeout = 30
|
|
43
|
-
|
|
44
|
-
request = Net::HTTP::Get.new(uri)
|
|
45
|
-
request['User-Agent'] = 'pandoc-wasm-ruby-downloader'
|
|
46
|
-
request['Accept'] = 'application/vnd.github.v3+json'
|
|
47
|
-
|
|
48
|
-
response = http.request(request)
|
|
49
|
-
|
|
50
|
-
case response.code
|
|
51
|
-
when '200'
|
|
52
|
-
release = JSON.parse(response.body)
|
|
53
|
-
release['tag_name']
|
|
54
|
-
when '404'
|
|
55
|
-
version = PandocWasm::VERSION
|
|
56
|
-
"v#{version}"
|
|
57
|
-
else
|
|
58
|
-
raise "GitHub API returned status #{response.code}: #{response.body}"
|
|
59
|
-
end
|
|
37
|
+
# Returns the GitHub release tag matching the current gem version.
|
|
38
|
+
#
|
|
39
|
+
# @return [String] e.g. "v1.0.1"
|
|
40
|
+
def self.release_tag
|
|
41
|
+
"v#{PandocWasm::VERSION}"
|
|
60
42
|
end
|
|
61
43
|
|
|
44
|
+
private
|
|
45
|
+
|
|
62
46
|
# Download the asset from a GitHub Release to the given target path
|
|
63
47
|
def self.download_asset(tag, target)
|
|
64
48
|
uri = URI("https://api.github.com/repos/#{REPO_OWNER}/#{REPO_NAME}/releases/tags/#{tag}")
|
|
@@ -95,6 +79,8 @@ module PandocWasm
|
|
|
95
79
|
|
|
96
80
|
File.open(target, 'wb') do |file|
|
|
97
81
|
loop do
|
|
82
|
+
redirected = false
|
|
83
|
+
|
|
98
84
|
download_http = Net::HTTP.new(download_uri.host, download_uri.port)
|
|
99
85
|
download_http.use_ssl = (download_uri.scheme == 'https')
|
|
100
86
|
download_http.read_timeout = 300
|
|
@@ -109,17 +95,17 @@ module PandocWasm
|
|
|
109
95
|
redirects += 1
|
|
110
96
|
raise "Too many redirects" if redirects > max_redirects
|
|
111
97
|
download_uri = URI(dl_response['location'])
|
|
112
|
-
|
|
98
|
+
redirected = true
|
|
113
99
|
when Net::HTTPSuccess
|
|
114
100
|
dl_response.read_body do |chunk|
|
|
115
101
|
file.write(chunk)
|
|
116
102
|
end
|
|
117
103
|
else
|
|
118
|
-
raise "Failed to download asset: #{dl_response.code}"
|
|
104
|
+
raise "Failed to download asset: HTTP #{dl_response.code}"
|
|
119
105
|
end
|
|
120
106
|
end
|
|
121
107
|
|
|
122
|
-
break
|
|
108
|
+
break unless redirected
|
|
123
109
|
end
|
|
124
110
|
end
|
|
125
111
|
|
data/lib/pandoc_wasm/version.rb
CHANGED
data/lib/pandoc_wasm.rb
CHANGED
|
@@ -30,7 +30,7 @@ module PandocWasm
|
|
|
30
30
|
@runtime || 'wasmtime'
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
# Download the .wasm binary from the
|
|
33
|
+
# Download the .wasm binary from the GitHub Release matching the gem version.
|
|
34
34
|
# Creates intermediate directories if needed.
|
|
35
35
|
#
|
|
36
36
|
# @return [true] on success
|