Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unset ruby envs in openstudio_cli.rb #4068

Merged
merged 5 commits into from
Sep 21, 2020
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions src/cli/openstudio_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,14 @@ def split_main_and_subcommand(argv, command_list)
# parse the main args, those that come before the sub command
def parse_main_args(main_args)

# Unset RUBY ENVs if previously set (e.g. rvm sets these in shell)

ENV.delete('GEM_HOME') if ENV['GEM_HOME']
ENV.delete('GEM_PATH') if ENV['GEM_PATH']
ENV.delete('BUNDLE_GEMFILE') if ENV['BUNDLE_GEMFILE']
ENV.delete('BUNDLE_PATH') if ENV['BUNDLE_PATH']
ENV.delete('BUNDLE_WITHOUT') if ENV['BUNDLE_WITHOUT']

$logger.debug "Parsing main_args #{main_args}"

# verbose already handled
Expand Down Expand Up @@ -396,11 +404,6 @@ def parse_main_args(main_args)
ENV['BUNDLE_GEMFILE'] = gemfile
use_bundler = true

elsif ENV['BUNDLE_GEMFILE']
# no argument but env var is set
$logger.info "ENV['BUNDLE_GEMFILE'] set to '#{ENV['BUNDLE_GEMFILE']}'"
use_bundler = true

end

if main_args.include? '--bundle_path'
Expand All @@ -413,10 +416,6 @@ def parse_main_args(main_args)
$logger.info "Setting BUNDLE_PATH to #{bundle_path}"
ENV['BUNDLE_PATH'] = bundle_path

elsif ENV['BUNDLE_PATH']
# no argument but env var is set
$logger.info "ENV['BUNDLE_PATH'] set to '#{ENV['BUNDLE_PATH']}'"

elsif use_bundler
# bundle was requested but bundle_path was not provided
$logger.warn "Bundle activated but ENV['BUNDLE_PATH'] is not set"
Expand All @@ -436,10 +435,6 @@ def parse_main_args(main_args)
$logger.info "Setting BUNDLE_WITHOUT to #{bundle_without}"
ENV['BUNDLE_WITHOUT'] = bundle_without

elsif ENV['BUNDLE_WITHOUT']
# no argument but env var is set
$logger.info "ENV['BUNDLE_WITHOUT'] set to '#{ENV['BUNDLE_WITHOUT']}'"

elsif use_bundler
# bundle was requested but bundle_path was not provided
$logger.info "Bundle activated but ENV['BUNDLE_WITHOUT'] is not set"
Expand Down