railpack 1.6.0 → 1.6.1
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/railpack/bundler.rb +64 -66
- data/lib/railpack/hooks.rb +0 -1
- data/lib/railpack/version.rb +1 -1
- data/lib/railpack.rb +0 -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: ae1510b21cf1b33c253babc803824ea14ed535b6c296ad2b5d2758771294d5f0
|
|
4
|
+
data.tar.gz: a634dd8065bc537c53a25f457921f6303c416c1bf6e2c1195681e1f1a71b925d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e3ab7c0d56e5a6f5c0f8a57078fad1fdf3749e254e551fd1372453711175a6ed0f74f0ce3896ddf0405b1c137cc7ede8da34e32a7923d1dbaa213b3fed7789d
|
|
7
|
+
data.tar.gz: e604aacfd2c70ce0bc0a20c25743b956755911ac277df64e3a6c5facefdf57ab78c38e35fc1478d8fe72cd6c821e17f292f3a8fe842e9d2351b246763f7e12de
|
data/lib/railpack/bundler.rb
CHANGED
|
@@ -63,79 +63,77 @@ module Railpack
|
|
|
63
63
|
|
|
64
64
|
private
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
def bundler_command_overrides
|
|
67
|
+
return {} unless config.respond_to?(:bundler_command_overrides)
|
|
68
|
+
|
|
69
|
+
begin
|
|
70
|
+
config.bundler_command_overrides(current_env) || {}
|
|
71
|
+
rescue NoMethodError, KeyError, TypeError, ArgumentError => e
|
|
72
|
+
# Log warning for legitimate config issues, but don't crash
|
|
73
|
+
if defined?(Rails) && Rails.logger
|
|
74
|
+
Rails.logger.warn "Railpack: Invalid bundler_command_overrides config (#{e.class}: #{e.message}) - using defaults"
|
|
75
|
+
end
|
|
76
|
+
{}
|
|
77
|
+
rescue => e
|
|
78
|
+
# Re-raise unexpected errors (don't hide bugs)
|
|
79
|
+
raise e
|
|
75
80
|
end
|
|
76
|
-
{}
|
|
77
|
-
rescue => e
|
|
78
|
-
# Re-raise unexpected errors (don't hide bugs)
|
|
79
|
-
raise e
|
|
80
81
|
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
protected
|
|
84
|
-
|
|
85
|
-
def execute(command_array)
|
|
86
|
-
system(*command_array)
|
|
87
|
-
end
|
|
88
82
|
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
def current_env
|
|
84
|
+
if defined?(Rails) && Rails.respond_to?(:env)
|
|
85
|
+
Rails.env
|
|
86
|
+
else
|
|
87
|
+
:development
|
|
88
|
+
end
|
|
89
|
+
end
|
|
91
90
|
|
|
92
|
-
|
|
93
|
-
command_string = Shellwords.join(command_array)
|
|
91
|
+
protected
|
|
94
92
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
error_msg += ": #{command_string}"
|
|
93
|
+
def execute(command_array)
|
|
94
|
+
system(*command_array)
|
|
95
|
+
end
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
97
|
+
def execute!(command_array)
|
|
98
|
+
stdout, stderr, status = Open3.capture3(*command_array)
|
|
99
|
+
|
|
100
|
+
unless status.success?
|
|
101
|
+
command_string = Shellwords.join(command_array)
|
|
102
|
+
|
|
103
|
+
error_msg = "Command failed"
|
|
104
|
+
error_msg += " (exit status: #{status.exitstatus})" if status.exitstatus
|
|
105
|
+
error_msg += " (terminated by signal: #{status.termsig})" if status.termsig
|
|
106
|
+
error_msg += ": #{command_string}"
|
|
107
|
+
|
|
108
|
+
# Include stderr output for debugging (truncate if too long)
|
|
109
|
+
if stderr && !stderr.empty?
|
|
110
|
+
stderr_lines = stderr.split("\n")
|
|
111
|
+
if stderr_lines.size > 10
|
|
112
|
+
stderr_preview = stderr_lines.first(5).join("\n") + "\n... (#{stderr_lines.size - 5} more lines)"
|
|
113
|
+
else
|
|
114
|
+
stderr_preview = stderr
|
|
115
|
+
end
|
|
116
|
+
error_msg += "\n\nSTDERR:\n#{stderr_preview}"
|
|
107
117
|
end
|
|
108
|
-
error_msg += "\n\nSTDERR:\n#{stderr_preview}"
|
|
109
|
-
end
|
|
110
118
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
status.success?
|
|
115
|
-
end
|
|
119
|
+
raise Error, error_msg
|
|
120
|
+
end
|
|
116
121
|
|
|
117
|
-
|
|
118
|
-
def build_command_args(operation, args = [])
|
|
119
|
-
env = current_env
|
|
120
|
-
if config.respond_to?("#{operation}_args")
|
|
121
|
-
config_args = config.send("#{operation}_args", env) || []
|
|
122
|
-
config_flags = config.send("#{operation}_flags", env) || []
|
|
123
|
-
config_args + config_flags + args
|
|
124
|
-
else
|
|
125
|
-
# Fallback for hash configs (used in tests)
|
|
126
|
-
args
|
|
122
|
+
status.success?
|
|
127
123
|
end
|
|
128
|
-
end
|
|
129
124
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
125
|
+
# Build full command args by merging config flags/args with passed args
|
|
126
|
+
def build_command_args(operation, args = [])
|
|
127
|
+
env = current_env
|
|
128
|
+
if config.respond_to?("#{operation}_args")
|
|
129
|
+
config_args = config.send("#{operation}_args", env) || []
|
|
130
|
+
config_flags = config.send("#{operation}_flags", env) || []
|
|
131
|
+
config_args + config_flags + args
|
|
132
|
+
else
|
|
133
|
+
# Fallback for hash configs (used in tests)
|
|
134
|
+
args
|
|
135
|
+
end
|
|
137
136
|
end
|
|
138
|
-
end
|
|
139
137
|
end
|
|
140
138
|
|
|
141
139
|
# Intermediate base class for NPM-based bundlers (esbuild, rollup, webpack)
|
|
@@ -170,10 +168,10 @@ module Railpack
|
|
|
170
168
|
|
|
171
169
|
private
|
|
172
170
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
171
|
+
def detect_package_manager
|
|
172
|
+
return "yarn" if File.exist?("yarn.lock")
|
|
173
|
+
return "pnpm" if File.exist?("pnpm-lock.yaml") || File.exist?("pnpm-workspace.yaml")
|
|
174
|
+
"npm" # default fallback
|
|
175
|
+
end
|
|
178
176
|
end
|
|
179
177
|
end
|
data/lib/railpack/hooks.rb
CHANGED
data/lib/railpack/version.rb
CHANGED
data/lib/railpack.rb
CHANGED