regolith 0.1.21 → 0.1.22
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 +29 -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: 5fa276472ded40f3c9b79460cc8c603063bba90b2c9f3fe678b96671c519e2e5
|
4
|
+
data.tar.gz: 05a30e0848e755bc2e55d4e83dcdca7b81593ab6c9ecb7a3d5b26baaa086fc31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57a83ef606eace382435a56faaa26c2dff33319d4bf32a2e0822c7192f8b31f80517e202f48d7964d95b6706e1b595a1d267f2b3fe8fa6ef3d5c5a767af1aa4f
|
7
|
+
data.tar.gz: f8a8f96681e5453b855d1b4158f59bb5de2646c8b28e7231a7d83476dfaba2a70dcadc5f8d2114475b9abd588ef9295617fd62136ad57870874788637a3928e2
|
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)
|
@@ -118,7 +118,7 @@ module Regolith
|
|
118
118
|
|
119
119
|
# Overwrite Gemfile before bundle install
|
120
120
|
puts "🔧 Overwriting Gemfile to remove sqlite3 and other defaults..."
|
121
|
-
|
121
|
+
|
122
122
|
major_minor = `ruby -e 'print RUBY_VERSION.split(".")[0..1].join(".")'`.strip
|
123
123
|
|
124
124
|
custom_gemfile = <<~GEMFILE
|
@@ -137,7 +137,6 @@ module Regolith
|
|
137
137
|
gem "rubocop-rails-omakase", require: false
|
138
138
|
end
|
139
139
|
|
140
|
-
# Regolith vendored gem so the container can build without network access to your local gem
|
141
140
|
gem "regolith", path: "vendor/regolith"
|
142
141
|
GEMFILE
|
143
142
|
|
@@ -160,7 +159,6 @@ module Regolith
|
|
160
159
|
end
|
161
160
|
|
162
161
|
patch_rails_app(service_dir, service_name, port)
|
163
|
-
patch_bootsnap(service_dir)
|
164
162
|
|
165
163
|
config['services'][service_name] = {
|
166
164
|
'port' => port,
|
@@ -174,12 +172,37 @@ module Regolith
|
|
174
172
|
puts "→ Next: regolith generate service <another_service> or regolith server"
|
175
173
|
end
|
176
174
|
|
175
|
+
# --- New helper to make Bootsnap optional ---
|
176
|
+
def make_bootsnap_optional(service_dir)
|
177
|
+
boot_rb_path = File.join(service_dir, "config", "boot.rb")
|
178
|
+
return unless File.exist?(boot_rb_path)
|
179
|
+
|
180
|
+
boot = File.read(boot_rb_path)
|
181
|
+
patched = boot.sub(
|
182
|
+
/^\s*require\s+["']bootsnap\/setup["']\s*$/,
|
183
|
+
<<~'RUBY'.strip
|
184
|
+
begin
|
185
|
+
require "bootsnap/setup"
|
186
|
+
rescue LoadError
|
187
|
+
warn "[regolith] bootsnap not found; continuing without it"
|
188
|
+
end
|
189
|
+
RUBY
|
190
|
+
)
|
191
|
+
|
192
|
+
if patched != boot
|
193
|
+
File.write(boot_rb_path, patched)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
177
197
|
def patch_rails_app(service_dir, service_name, port)
|
178
198
|
initializer_dir = "#{service_dir}/config/initializers"
|
179
199
|
FileUtils.mkdir_p(initializer_dir)
|
180
200
|
File.write("#{initializer_dir}/regolith.rb", generate_regolith_initializer(service_name))
|
181
201
|
File.write("#{service_dir}/Dockerfile", generate_dockerfile)
|
182
202
|
|
203
|
+
# Call the Bootsnap patcher here
|
204
|
+
make_bootsnap_optional(service_dir)
|
205
|
+
|
183
206
|
app_rb_path = "#{service_dir}/config/application.rb"
|
184
207
|
app_rb_content = File.read(app_rb_path)
|
185
208
|
|
@@ -205,26 +228,6 @@ module Regolith
|
|
205
228
|
File.write(app_rb_path, app_rb_content)
|
206
229
|
end
|
207
230
|
|
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
231
|
def start_server
|
229
232
|
unless File.exist?('docker-compose.yml')
|
230
233
|
puts "❌ Error: Not in a Regolith app directory"
|
@@ -262,7 +265,7 @@ module Regolith
|
|
262
265
|
end
|
263
266
|
|
264
267
|
def load_regolith_config
|
265
|
-
return
|
268
|
+
return { 'services' => {} } unless File.exist?('config/regolith.yml')
|
266
269
|
config = YAML.load_file('config/regolith.yml') || {}
|
267
270
|
config['services'] ||= {}
|
268
271
|
config
|
@@ -410,4 +413,4 @@ module Regolith
|
|
410
413
|
HELP
|
411
414
|
end
|
412
415
|
end
|
413
|
-
end
|
416
|
+
end
|
data/lib/regolith/version.rb
CHANGED