Sha256: b1a3133ed075dca43dc533c46c3af5a0aa3e70e92448db08636946ce4e0c74e7

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

class MultiRubyRunner
  class VersionManager

    # Represents the [rbenv](https://github.com/rbenv/rbenv) ruby version manager.
    class Rbenv < VersionManager

      # See MultiRubyRunner#execute_command_in_directory
      # @return [Hash]
      #     {
      #       entire_command: includes shell invocation,
      #                       ruby version manager activation and command
      #       blocking: Boolean
      #       environment_overrides: {}
      #     }
      def compute_process_args(command_string, directory, options)
        shell_command_string = [
          "cd #{ directory }", # cd into the directory containing .ruby-version file
          %(eval "$(rbenv init -)"), # let rbenv update the environment (particularly PATH)
          command_string, # execute command
        ].join('; ')
        # For rbenv we just have to reset RBENV_VERSION and override RBENV_DIR
        # to get the ruby environment specified in `.ruby-version` in directory.
        {
          entire_command: [
            options[:shell_invocation],
            shell_command_string,
          ].join(' '),
          blocking: options[:blocking],
          environment_overrides: {
            'RBENV_VERSION' => nil,
            'RBENV_DIR' => directory,
          },
        }
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
multi_ruby_runner-1.0.5 lib/multi_ruby_runner/version_manager/rbenv.rb
multi_ruby_runner-1.0.4 lib/multi_ruby_runner/version_manager/rbenv.rb
multi_ruby_runner-1.0.3 lib/multi_ruby_runner/version_manager/rbenv.rb
multi_ruby_runner-1.0.2 lib/multi_ruby_runner/version_manager/rbenv.rb