Module: Herve

Defined in:
lib/herve.rb,
lib/herve/cli.rb,
lib/herve/ruby.rb,
lib/herve/cache.rb,
lib/herve/config.rb,
lib/herve/release.rb,
lib/herve/version.rb,
lib/herve/cache/entry.rb,
lib/herve/cache/shard.rb,
lib/herve/ruby/engine.rb,
lib/herve/ruby/request.rb,
lib/herve/cache/timestamp.rb,
lib/herve/cli/gem_command.rb,
lib/herve/cli/ruby_commands.rb,
lib/herve/cli/shell_commands.rb,
lib/herve/cli/ruby_commands/pin.rb,
lib/herve/cli/ruby_commands/run.rb,
lib/herve/cli/ruby_commands/find.rb,
lib/herve/cli/ruby_commands/list.rb,
lib/herve/cli/shell_commands/env.rb,
lib/herve/cli/shell_commands/init.rb,
lib/herve/cli/ruby_commands/install.rb,
lib/herve/cli/ruby_commands/uninstall.rb,
lib/herve/cli/shell_commands/completion.rb

Defined Under Namespace

Modules: CLI Classes: Cache, CacheError, Config, ConfigError, Error, Ruby, RubyError, Version, VersionError

Constant Summary collapse

DEFAULT_RUBIES =
"$HOME/.rubies"
ENV_VARS =
(%w[RUBY_ROOT RUBY_ENGINE RUBY_VERSION RUBYLIB RUBYOPT] +
ENV.keys.select { |v| v.start_with?("GEM_") || v.start_with?("BUNDLE") }).freeze
RELEASES_URL =

Base URL to fetch releases

"https://api.github.com"
VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.expand_path(path) ⇒ Pathname

Expand a path containing environment variables

Parameters:

  • path (String)

Returns:

  • (Pathname)

    expanded path, or path if nothing to expand



12
13
14
15
16
17
18
19
# File 'lib/herve.rb', line 12

def self.expand_path(path)
  return Pathname.new(path) unless path.include?("$")

  new_path = path.gsub(/\$\w+/) do |envvar|
    ENV[envvar[1..]] || ""
  end
  Pathname.new(new_path)
end