regolith 0.1.21 → 0.1.23
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/lib/regolith/cli.rb +30 -26
- data/lib/regolith/version.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: 41ea8405c6a144230c7f4be3a1e2605cc2f80f05524850bad3e680e37d4187b4
|
4
|
+
data.tar.gz: c4ba815538da010c8f3b23b3b27b2c84b107d1d3ad64c267a7d0efe5c6ce4487
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2b4ca0d0e63b168706b29a54cb5344b7fe1a83cbc184773f848eafd73155aba7ed0748177ae22fab09c9e0c9df6c55ab0bf685e27104d9713831290fa1fe7d8
|
7
|
+
data.tar.gz: 757cf66d57106245541095029d9aea8f24b43aaae2a231afabc715dc3546308509c6f5077c631fe7722ed066150f9f586dc21a1bbba17a5a1bb7b0fd622bd1d6
|
data/lib/regolith/cli.rb
CHANGED
@@ -69,7 +69,7 @@ module Regolith
|
|
69
69
|
File.write('docker-compose.yml', generate_docker_compose(app_name))
|
70
70
|
File.write('Makefile', generate_makefile)
|
71
71
|
File.write('.bin/regolith', generate_regolith_shim)
|
72
|
-
FileUtils.chmod(
|
72
|
+
FileUtils.chmod(0755, '.bin/regolith')
|
73
73
|
end
|
74
74
|
|
75
75
|
def generate_resource(resource_type, resource_name)
|
@@ -116,9 +116,13 @@ module Regolith
|
|
116
116
|
exit 1
|
117
117
|
end
|
118
118
|
|
119
|
+
# Fix bootsnap issue IMMEDIATELY after rails new
|
120
|
+
puts "🔧 Making bootsnap optional..."
|
121
|
+
make_bootsnap_optional(service_dir)
|
122
|
+
|
119
123
|
# Overwrite Gemfile before bundle install
|
120
124
|
puts "🔧 Overwriting Gemfile to remove sqlite3 and other defaults..."
|
121
|
-
|
125
|
+
|
122
126
|
major_minor = `ruby -e 'print RUBY_VERSION.split(".")[0..1].join(".")'`.strip
|
123
127
|
|
124
128
|
custom_gemfile = <<~GEMFILE
|
@@ -137,7 +141,6 @@ module Regolith
|
|
137
141
|
gem "rubocop-rails-omakase", require: false
|
138
142
|
end
|
139
143
|
|
140
|
-
# Regolith vendored gem so the container can build without network access to your local gem
|
141
144
|
gem "regolith", path: "vendor/regolith"
|
142
145
|
GEMFILE
|
143
146
|
|
@@ -160,7 +163,6 @@ module Regolith
|
|
160
163
|
end
|
161
164
|
|
162
165
|
patch_rails_app(service_dir, service_name, port)
|
163
|
-
patch_bootsnap(service_dir)
|
164
166
|
|
165
167
|
config['services'][service_name] = {
|
166
168
|
'port' => port,
|
@@ -174,6 +176,28 @@ module Regolith
|
|
174
176
|
puts "→ Next: regolith generate service <another_service> or regolith server"
|
175
177
|
end
|
176
178
|
|
179
|
+
# --- Helper to make Bootsnap optional ---
|
180
|
+
def make_bootsnap_optional(service_dir)
|
181
|
+
boot_rb_path = File.join(service_dir, "config", "boot.rb")
|
182
|
+
return unless File.exist?(boot_rb_path)
|
183
|
+
|
184
|
+
boot = File.read(boot_rb_path)
|
185
|
+
patched = boot.sub(
|
186
|
+
/^\s*require\s+["']bootsnap\/setup["']\s*$/,
|
187
|
+
<<~'RUBY'.strip
|
188
|
+
begin
|
189
|
+
require "bootsnap/setup"
|
190
|
+
rescue LoadError
|
191
|
+
warn "[regolith] bootsnap not found; continuing without it"
|
192
|
+
end
|
193
|
+
RUBY
|
194
|
+
)
|
195
|
+
|
196
|
+
if patched != boot
|
197
|
+
File.write(boot_rb_path, patched)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
177
201
|
def patch_rails_app(service_dir, service_name, port)
|
178
202
|
initializer_dir = "#{service_dir}/config/initializers"
|
179
203
|
FileUtils.mkdir_p(initializer_dir)
|
@@ -205,26 +229,6 @@ module Regolith
|
|
205
229
|
File.write(app_rb_path, app_rb_content)
|
206
230
|
end
|
207
231
|
|
208
|
-
# ---- Bootsnap Patch: make it optional & non-fatal ----
|
209
|
-
def patch_bootsnap(service_dir)
|
210
|
-
boot_path = File.join(service_dir, "config", "boot.rb")
|
211
|
-
return unless File.exist?(boot_path)
|
212
|
-
|
213
|
-
content = File.read(boot_path)
|
214
|
-
|
215
|
-
# Remove any unconditional bootsnap require and replace with guarded load
|
216
|
-
content.gsub!(/^\s*require\s+["']bootsnap\/setup["']\s*$/, <<~RUBY.strip)
|
217
|
-
begin
|
218
|
-
require "bootsnap/setup"
|
219
|
-
rescue LoadError
|
220
|
-
warn "[regolith] bootsnap not found; continuing without it"
|
221
|
-
end
|
222
|
-
RUBY
|
223
|
-
|
224
|
-
File.write(boot_path, content)
|
225
|
-
end
|
226
|
-
# ------------------------------------------------------
|
227
|
-
|
228
232
|
def start_server
|
229
233
|
unless File.exist?('docker-compose.yml')
|
230
234
|
puts "❌ Error: Not in a Regolith app directory"
|
@@ -262,7 +266,7 @@ module Regolith
|
|
262
266
|
end
|
263
267
|
|
264
268
|
def load_regolith_config
|
265
|
-
return
|
269
|
+
return { 'services' => {} } unless File.exist?('config/regolith.yml')
|
266
270
|
config = YAML.load_file('config/regolith.yml') || {}
|
267
271
|
config['services'] ||= {}
|
268
272
|
config
|
@@ -410,4 +414,4 @@ module Regolith
|
|
410
414
|
HELP
|
411
415
|
end
|
412
416
|
end
|
413
|
-
end
|
417
|
+
end
|
data/lib/regolith/version.rb
CHANGED