Skip to content

Commit 2a1883e

Browse files
committed
Cleanup
1 parent 8b8f77b commit 2a1883e

File tree

5 files changed

+57
-23
lines changed

5 files changed

+57
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ gem install herb
8686
To test a branch before it's released (e.g. from a fork), add both `prism` and `herb` to your Gemfile:
8787

8888
```ruby
89-
gem "prism", "~> 1.9"
89+
gem "prism", github: "ruby/prism", tag: "v1.9.0"
9090
gem "herb", github: "fork/herb", branch: "my-branch"
9191
```
9292

Steepfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ target :lib do
1616
ignore "lib/herb/cli.rb"
1717
ignore "lib/herb/project.rb"
1818
ignore "lib/herb/engine/error_formatter.rb"
19+
ignore "lib/herb/bootstrap.rb"
1920
end

ext/herb/extconf.rb

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,34 @@
44
require_relative "../../lib/herb/bootstrap"
55

66
extension_name = "herb"
7-
git_build = false
87

9-
unless Herb::Bootstrap.templates_generated?
10-
puts "Generated files not found — running template generation..."
11-
git_build = true
12-
Herb::Bootstrap.generate_templates
13-
end
8+
if Herb::Bootstrap.git_source?
9+
unless Herb::Bootstrap.templates_generated?
10+
puts "Generated files not found — running template generation..."
11+
Herb::Bootstrap.generate_templates
12+
end
1413

15-
unless Herb::Bootstrap.prism_vendored?
16-
prism_path = Herb::Bootstrap.find_prism_gem_path
14+
unless Herb::Bootstrap.prism_vendored?
15+
prism_path = Herb::Bootstrap.find_prism_gem_path
1716

18-
abort <<~MSG unless prism_path
19-
ERROR: Could not find Prism C source files.
17+
abort <<~MSG unless prism_path
18+
ERROR: Could not find Prism C source files.
2019
21-
When installing Herb from a git source, a git-sourced Prism is required
22-
(the released gem does not include C source files).
20+
When installing Herb from a git source, a git-sourced Prism is required
21+
(the released gem does not include C source files).
2322
24-
Add it to your Gemfile before the herb git reference:
23+
Add it to your Gemfile before the herb git reference:
2524
26-
gem "prism", github: "ruby/prism", tag: "v1.9.0"
27-
gem "herb", github: "...", branch: "..."
25+
gem "prism", github: "ruby/prism", tag: "v1.9.0"
26+
gem "herb", github: "...", branch: "..."
2827
29-
Then run `bundle install` again.
30-
MSG
28+
Then run `bundle install` again.
29+
MSG
3130

32-
puts "Vendoring Prism from #{prism_path}..."
33-
git_build = true
34-
Herb::Bootstrap.vendor_prism(prism_gem_path: prism_path)
35-
end
31+
puts "Vendoring Prism from #{prism_path}..."
32+
Herb::Bootstrap.vendor_prism(prism_gem_path: prism_path)
33+
end
3634

37-
if git_build
3835
root_path = Herb::Bootstrap::ROOT_PATH
3936
sha = `git -C #{root_path} rev-parse --short HEAD 2>/dev/null`.strip
4037

lib/herb/bootstrap.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# frozen_string_literal: true
2+
# typed: false
23

34
require "fileutils"
45

@@ -27,6 +28,10 @@ def self.generate_templates
2728
end
2829
end
2930

31+
def self.git_source?
32+
File.directory?(File.join(ROOT_PATH, ".git"))
33+
end
34+
3035
def self.templates_generated?
3136
File.exist?(File.join(ROOT_PATH, "ext", "herb", "nodes.c"))
3237
end

sig/herb/bootstrap.rbs

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)