mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Add gem env user_gemhome
and gem env user_gemdir
14d3f80df6
This commit is contained in:
parent
f0fab24241
commit
a16de43f23
2 changed files with 25 additions and 0 deletions
|
@ -10,6 +10,7 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
|
||||||
args = <<-EOF
|
args = <<-EOF
|
||||||
home display the path where gems are installed. Aliases: gemhome, gemdir, GEM_HOME
|
home display the path where gems are installed. Aliases: gemhome, gemdir, GEM_HOME
|
||||||
path display path used to search for gems. Aliases: gempath, GEM_PATH
|
path display path used to search for gems. Aliases: gempath, GEM_PATH
|
||||||
|
user_gemhome display the path where gems are installed when `--user-install` is given. Aliases: user_gemdir
|
||||||
version display the gem format version
|
version display the gem format version
|
||||||
remotesources display the remote gem servers
|
remotesources display the remote gem servers
|
||||||
platform display the supported gem platforms
|
platform display the supported gem platforms
|
||||||
|
@ -80,6 +81,8 @@ lib/rubygems/defaults/operating_system.rb
|
||||||
Gem.dir
|
Gem.dir
|
||||||
when /^gempath/, /^path/, /^GEM_PATH/ then
|
when /^gempath/, /^path/, /^GEM_PATH/ then
|
||||||
Gem.path.join(File::PATH_SEPARATOR)
|
Gem.path.join(File::PATH_SEPARATOR)
|
||||||
|
when /^user_gemdir/, /^user_gemhome/ then
|
||||||
|
Gem.user_dir
|
||||||
when /^remotesources/ then
|
when /^remotesources/ then
|
||||||
Gem.sources.to_a.join("\n")
|
Gem.sources.to_a.join("\n")
|
||||||
when /^platform/ then
|
when /^platform/ then
|
||||||
|
|
|
@ -65,6 +65,28 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
|
||||||
assert_equal '', @ui.error
|
assert_equal '', @ui.error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_execute_user_gemdir
|
||||||
|
@cmd.send :handle_options, %w[user_gemdir]
|
||||||
|
|
||||||
|
use_ui @ui do
|
||||||
|
@cmd.execute
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_equal "#{Gem.user_dir}\n", @ui.output
|
||||||
|
assert_equal '', @ui.error
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_execute_user_gemhome
|
||||||
|
@cmd.send :handle_options, %w[user_gemhome]
|
||||||
|
|
||||||
|
use_ui @ui do
|
||||||
|
@cmd.execute
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_equal "#{Gem.user_dir}\n", @ui.output
|
||||||
|
assert_equal '', @ui.error
|
||||||
|
end
|
||||||
|
|
||||||
def test_execute_gempath
|
def test_execute_gempath
|
||||||
@cmd.send :handle_options, %w[gempath]
|
@cmd.send :handle_options, %w[gempath]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue