Skip to content
This repository was archived by the owner on Dec 8, 2025. It is now read-only.

Commit 8327ac8

Browse files
authored
Merge pull request #9 from fac/update-to-upstream
Merge upstream into main
2 parents 1b553a0 + c2e1f2d commit 8327ac8

126 files changed

Lines changed: 2790 additions & 578 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/build-gems.yml‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,68 @@ jobs:
101101
path: pkg/*.gem
102102
if-no-files-found: error
103103
retention-days: 7
104+
105+
push:
106+
name: Push gems with trusted publishing
107+
if: github.event_name == 'release' && github.repository_owner == 'marcoroth'
108+
needs: build
109+
timeout-minutes: 30
110+
runs-on: ubuntu-latest
111+
permissions:
112+
contents: write
113+
id-token: write
114+
strategy:
115+
fail-fast: false
116+
matrix:
117+
target:
118+
- default
119+
- aarch64-linux-gnu
120+
- x86_64-linux-gnu
121+
- x86_64-linux-musl
122+
- aarch64-linux-musl
123+
- x86_64-darwin
124+
- arm64-darwin
125+
- arm-linux-gnu
126+
- arm-linux-musl
127+
- x86-linux-gnu
128+
- x86-linux-musl
129+
steps:
130+
- uses: actions/checkout@v4
131+
with:
132+
fetch-depth: 0
133+
134+
# Vendor the attestation patch from rubygems/release-gem
135+
- name: Vendor release-gem patch
136+
uses: actions/checkout@v4
137+
with:
138+
repository: rubygems/release-gem
139+
ref: a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1
140+
path: .github/_release-gem
141+
142+
- name: Setup Ruby
143+
uses: ruby/setup-ruby@v1
144+
with:
145+
ruby-version: '3.4'
146+
bundler-cache: false
147+
148+
- name: Download gem artifacts
149+
uses: actions/download-artifact@v4
150+
with:
151+
name: gem-${{ matrix.target }}
152+
path: pkg/
153+
154+
- name: Configure trusted publishing credentials
155+
uses: rubygems/configure-rubygems-credentials@v1.0.0
156+
157+
- name: Push gem with Sigstore attestation
158+
env:
159+
# Preload the attestation patch so `gem push` generates & attaches the bundle
160+
RUBYOPT: "-r${{ github.workspace }}/.github/_release-gem/rubygems-attestation-patch.rb"
161+
run: |
162+
cd pkg
163+
for gem_file in *.gem; do
164+
if [ -f "$gem_file" ]; then
165+
echo "Pushing $gem_file"
166+
gem push "$gem_file"
167+
fi
168+
done

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ vendor/*
7878
vendor/bundle/*
7979
vendor/cache/*
8080

81+
# Prism Vendor
82+
vendor/prism/*
83+
8184
# Bundled .gem files
8285
pkg/*
8386

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ If you encounter any issues when following along with this file please dont hesi
1212
- [**Clang 19**](https://clang.llvm.org): The compiler used to build this project.
1313
- [**Clang Format 19**](https://clang.llvm.org/docs/ClangFormat.html): For formatting the project.
1414
- [**Clang Tidy 19**](https://clang.llvm.org/extra/clang-tidy/): For linting the project.
15-
- [**Prism Ruby Parser v1.4.0**](https://github.com/ruby/prism/releases/tag/v1.4.0): We use Prism for Parsing the Ruby Source Code in the HTML+ERB files.
15+
- [**Prism Ruby Parser v1.5.1**](https://github.com/ruby/prism/releases/tag/v1.5.1): We use Prism for Parsing the Ruby Source Code in the HTML+ERB files.
1616
- [**Ruby**](https://www.ruby-lang.org/en/): We need Ruby as a dependency for `bundler`.
1717
- [**Bundler**](https://bundler.io): We are using `bundler` to build [`prism`](https://github.com/ruby/prism) from source so we can build `herb` against it.
1818
- [**Emscripten**](https://emscripten.org): For the WebAssembly build of `libherb` so it can be used in the browser using the [`@herb-tools/browser`](https://github.com/marcoroth/herb/blob/main/javascript/packages/browser) package.
@@ -159,4 +159,3 @@ The integration was successful if you see:
159159
160160
Integration successful!
161161
```
162-

‎Gemfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ source "https://rubygems.org"
44

55
gemspec
66

7-
gem "prism", github: "ruby/prism", tag: "v1.4.0"
7+
gem "prism", github: "ruby/prism", tag: "v1.5.1"
88

99
gem "actionview", "~> 8.0"
1010
gem "lz_string"

‎Gemfile.lock‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ GIT
99

1010
GIT
1111
remote: https://github.com/ruby/prism.git
12-
revision: 266f83de6a2b0c1557404dde33ad3d41ceba7043
13-
tag: v1.4.0
12+
revision: 23f16d31a7c57c4b927e1e3ec8f1281b45e7cb9f
13+
tag: v1.5.1
1414
specs:
15-
prism (1.4.0)
15+
prism (1.5.1)
1616

1717
PATH
1818
remote: .
1919
specs:
20-
herb (0.7.0)
20+
herb (0.7.4)
2121

2222
GEM
2323
remote: https://rubygems.org/

‎Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ clean:
101101
rm -f $(exec) $(test_exec) $(lib_name) $(shared_lib_name) $(ruby_extension)
102102
rm -rf $(objects) $(test_objects) $(extension_objects) lib/herb/*.bundle tmp
103103
rm -rf $(prism_path)
104+
rake prism:clean
104105

105106
bundle_install:
106107
bundle install
@@ -110,6 +111,7 @@ templates: bundle_install
110111

111112
prism: bundle_install
112113
cd $(prism_path) && ruby templates/template.rb && make static && cd -
114+
rake prism:vendor
113115

114116
format:
115117
$(clang_format) -i $(project_and_extension_files)

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Commands:
9999
bundle exec herb version Prints the versions of the Herb gem and the libherb library.
100100
```
101101

102-
For detailed information, like how you can use Herb progamatiacally in Ruby and JavaScript, visit the [documentation site](https://herb-tools.dev/bindings/ruby/reference).
102+
For detailed information, like how you can use Herb programatically in Ruby and JavaScript, visit the [documentation site](https://herb-tools.dev/bindings/ruby/reference).
103103

104104

105105
## Background and Talk

‎Rakefile‎

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,51 @@ task :templates do
128128
end
129129
end
130130

131+
prism_vendor_path = "vendor/prism"
132+
133+
namespace :prism do
134+
desc "Setup and vendor Prism"
135+
task :vendor do
136+
Rake::Task["prism:clean"].execute
137+
138+
prism_bundle_path = `bundle show prism`.chomp
139+
140+
puts prism_bundle_path
141+
142+
if prism_bundle_path.empty?
143+
puts "Make sure to run `bundle install` in the herb project directory first"
144+
exit 1
145+
end
146+
147+
FileUtils.mkdir_p(prism_vendor_path)
148+
149+
files = [
150+
"config.yml",
151+
"Rakefile",
152+
"src/",
153+
"include/",
154+
"templates/"
155+
]
156+
157+
files.each do |file|
158+
vendored_file_path = prism_vendor_path + "/#{file}"
159+
puts "Vendoring '#{file}' Prism file to #{vendored_file_path}"
160+
FileUtils.cp_r(prism_bundle_path + "/#{file}", prism_vendor_path)
161+
end
162+
end
163+
164+
desc "Clean vendored Prism in vendor/prism/"
165+
task :clean do
166+
puts "Cleaning up vendored Prism at #{prism_vendor_path}..."
167+
begin
168+
FileUtils.rm_r(prism_vendor_path)
169+
puts "Cleaned up vendored Prism."
170+
rescue Errno::ENOENT
171+
puts "Vendored prism at: #{prism_vendor_path} didn't exist. Skipping."
172+
end
173+
end
174+
end
175+
131176
namespace :templates do
132177
desc "Watch template files and regenerate on changes"
133178
task :watch do
@@ -199,4 +244,4 @@ task rbs_inline: :templates do
199244
end
200245
end
201246

202-
task default: [:templates, :make, :compile, :test]
247+
task default: [:templates, "prism:vendor", :make, :compile, :test]

‎docs/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
"fetch:contributors": "mkdir -p .vitepress/data/ && gh api -X get https://api.github.com/repos/marcoroth/herb/contributors > .vitepress/data/contributors.json"
2020
},
2121
"dependencies": {
22-
"@herb-tools/browser": "0.7.0",
23-
"@herb-tools/core": "0.7.0",
24-
"@herb-tools/node": "0.7.0"
22+
"@herb-tools/browser": "0.7.4",
23+
"@herb-tools/core": "0.7.4",
24+
"@herb-tools/node": "0.7.4"
2525
},
2626
"devDependencies": {
2727
"@shikijs/vitepress-twoslash": "^3.4.2",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<% # This file contains a comment before other content %>
2+
<div>Hey there</div>

0 commit comments

Comments
 (0)