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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d51accf157104ea0b6ab312e0fe50aab958ffabc6d1842eb729bf9427c42372
4
- data.tar.gz: 97c01c1755ae4b0958419f40ae7d27d4cd81557d6b2bd96fe042e80e00ae50b5
3
+ metadata.gz: ae1510b21cf1b33c253babc803824ea14ed535b6c296ad2b5d2758771294d5f0
4
+ data.tar.gz: a634dd8065bc537c53a25f457921f6303c416c1bf6e2c1195681e1f1a71b925d
5
5
  SHA512:
6
- metadata.gz: 63dbabbba215b0b6b0fe62df1937dd84c94e80ef35527e79dd1c2e1e500a0f4f18df8238183ec3d18d1598f186669af7b9e3b5404e07fb72196edf00ffeac943
7
- data.tar.gz: d37ff6f15af79b03590604e55ef6a6e3a2ceab65de0f158e06b218c45e168948755e01488994d250ceddce5574e708617e73ad5621a644891eeb13ff05e0dff2
6
+ metadata.gz: 2e3ab7c0d56e5a6f5c0f8a57078fad1fdf3749e254e551fd1372453711175a6ed0f74f0ce3896ddf0405b1c137cc7ede8da34e32a7923d1dbaa213b3fed7789d
7
+ data.tar.gz: e604aacfd2c70ce0bc0a20c25743b956755911ac277df64e3a6c5facefdf57ab78c38e35fc1478d8fe72cd6c821e17f292f3a8fe842e9d2351b246763f7e12de
@@ -63,79 +63,77 @@ module Railpack
63
63
 
64
64
  private
65
65
 
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"
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
- def execute!(command_array)
90
- stdout, stderr, status = Open3.capture3(*command_array)
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
- unless status.success?
93
- command_string = Shellwords.join(command_array)
91
+ protected
94
92
 
95
- error_msg = "Command failed"
96
- error_msg += " (exit status: #{status.exitstatus})" if status.exitstatus
97
- error_msg += " (terminated by signal: #{status.termsig})" if status.termsig
98
- error_msg += ": #{command_string}"
93
+ def execute(command_array)
94
+ system(*command_array)
95
+ end
99
96
 
100
- # Include stderr output for debugging (truncate if too long)
101
- if stderr && !stderr.empty?
102
- stderr_lines = stderr.split("\n")
103
- if stderr_lines.size > 10
104
- stderr_preview = stderr_lines.first(5).join("\n") + "\n... (#{stderr_lines.size - 5} more lines)"
105
- else
106
- stderr_preview = stderr
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
- raise Error, error_msg
112
- end
113
-
114
- status.success?
115
- end
119
+ raise Error, error_msg
120
+ end
116
121
 
117
- # Build full command args by merging config flags/args with passed args
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
- private
131
-
132
- def current_env
133
- if defined?(Rails) && Rails.respond_to?(:env)
134
- Rails.env
135
- else
136
- :development
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
- def detect_package_manager
174
- return "yarn" if File.exist?("yarn.lock")
175
- return "pnpm" if File.exist?("pnpm-lock.yaml") || File.exist?("pnpm-workspace.yaml")
176
- "npm" # default fallback
177
- end
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
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Railpack
4
- # Hook system using Rails-style mattr_accessor patterns
5
4
  module Hooks
6
5
  extend ActiveSupport::Concern
7
6
 
@@ -1,3 +1,3 @@
1
1
  module Railpack
2
- VERSION = "1.6.0"
2
+ VERSION = "1.6.1"
3
3
  end
data/lib/railpack.rb CHANGED
@@ -1,4 +1,3 @@
1
- # Railpack - Multi-bundler asset pipeline for Rails
2
1
  require 'logger'
3
2
 
4
3
  require 'active_support/concern'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - 21tycoons LLC