Skip to content

Commit f2294e5

Browse files
committed
Override the stripe gem to inject our certificate
1 parent 20afa9c commit f2294e5

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

overrides/gems/stripe.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Remove this module from LOAD_PATH, so we can load the real one
2+
gem_override_path = File.expand_path(__dir__)
3+
$LOAD_PATH.reject! { |path| File.expand_path(path) == gem_override_path }
4+
5+
# Load stripe, and inject our certificate
6+
require 'stripe'
7+
Stripe.ca_bundle_path=ENV['SSL_CERT_FILE']
8+
9+
# Put this override directory back on LOAD_PATH
10+
$LOAD_PATH.unshift(gem_override_path)

src/interceptors/fresh-terminal.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const OVERRIDE_BIN_PATH = path.join(OVERRIDES_DIR, 'path');
3030
const POSIX_OVERRIDE_BIN_PATH = process.platform === 'win32'
3131
? OVERRIDE_BIN_PATH.replace(/\\/g, '/').replace(/^(\w+):/, (_all, driveLetter) => `/${driveLetter.toLowerCase()}`)
3232
: OVERRIDE_BIN_PATH;
33+
const OVERRIDE_RUBYGEMS_PATH = path.join(OVERRIDES_DIR, 'gems');
3334

3435
interface SpawnArgs {
3536
command: string;
@@ -267,7 +268,11 @@ export class TerminalInterceptor implements Interceptor {
267268
'HTTP_TOOLKIT_ACTIVE': 'true',
268269

269270
// Prepend our bin overrides into $PATH
270-
'PATH': `${OVERRIDE_BIN_PATH}${PATH_VAR_SEPARATOR}${process.env.PATH}`
271+
'PATH': `${OVERRIDE_BIN_PATH}${PATH_VAR_SEPARATOR}${process.env.PATH}`,
272+
// Prepend our Ruby gem overrides into $LOAD_PATH
273+
'RUBYLIB': process.env.RUBYLIB
274+
? `${OVERRIDE_RUBYGEMS_PATH}:${process.env.RUBYLIB}`
275+
: OVERRIDE_RUBYGEMS_PATH
271276
}),
272277
cwd: process.env.HOME || process.env.USERPROFILE
273278
}));

0 commit comments

Comments
 (0)