diff --git a/src/cli/openstudio_cli.rb b/src/cli/openstudio_cli.rb index 304043a734d..33903738651 100644 --- a/src/cli/openstudio_cli.rb +++ b/src/cli/openstudio_cli.rb @@ -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 @@ -361,9 +369,6 @@ def parse_main_args(main_args) remove_indices.reverse_each {|i| main_args.delete_at(i)} if !new_path.empty? - if ENV['GEM_PATH'] - new_path << ENV['GEM_PATH'].to_s - end new_path = new_path.join(File::PATH_SEPARATOR) @@ -396,11 +401,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' @@ -413,10 +413,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" @@ -436,10 +432,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"