提交 2157016f 编写于 作者: M Mislav Marohnić

Speed up setting environment variables in Aruba

上级 ce5d8858
......@@ -9,50 +9,53 @@ hub_dir = Dir.mktmpdir('hub_build')
raise 'hub build failed' unless system("./script/build -o #{hub_dir}/hub")
Before do
# speed up load time by skipping RubyGems
set_environment_variable 'RUBYOPT', '--disable-gems' if RUBY_VERSION > '1.9'
# put fakebin on the PATH
set_environment_variable 'PATH', "#{hub_dir}:#{bin_dir}:#{ENV['PATH']}"
# clear out GIT if it happens to be set
set_environment_variable 'GIT', nil
# exclude this project's git directory from use in testing
set_environment_variable 'GIT_CEILING_DIRECTORIES', File.expand_path('../../..', __FILE__)
# sabotage git commands that might try to access a remote host
set_environment_variable 'GIT_PROXY_COMMAND', 'echo'
# avoids reading from current user's "~/.gitconfig"
set_environment_variable 'HOME', expand_path('home')
set_environment_variable 'TMPDIR', expand_path('tmp')
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
set_environment_variable 'XDG_CONFIG_HOME', nil
set_environment_variable 'XDG_CONFIG_DIRS', nil
# used in fakebin/git
set_environment_variable 'HUB_SYSTEM_GIT', system_git
# ensure that api.github.com is actually never hit in tests
set_environment_variable 'HUB_TEST_HOST', 'http://127.0.0.1:0'
# ensure we use fakebin `open` to test browsing
set_environment_variable 'BROWSER', 'open'
# sabotage opening a commit message editor interactively
set_environment_variable 'GIT_EDITOR', 'false'
# reset current localization settings
set_environment_variable 'LANG', nil
set_environment_variable 'LANGUAGE', nil
set_environment_variable 'LC_ALL', 'en_US.UTF-8'
# ignore current user's token
set_environment_variable 'GITHUB_TOKEN', nil
set_environment_variable 'GITHUB_USER', nil
set_environment_variable 'GITHUB_PASSWORD', nil
set_environment_variable 'GITHUB_HOST', nil
author_name = "Hub"
author_email = "hub@test.local"
set_environment_variable 'GIT_AUTHOR_NAME', author_name
set_environment_variable 'GIT_COMMITTER_NAME', author_name
set_environment_variable 'GIT_AUTHOR_EMAIL', author_email
set_environment_variable 'GIT_COMMITTER_EMAIL', author_email
set_environment_variable 'HUB_VERSION', 'dev'
set_environment_variable 'HUB_REPORT_CRASH', 'never'
set_environment_variable 'HUB_PROTOCOL', nil
aruba.environment.update(
# speed up load time by skipping RubyGems
'RUBYOPT' => '--disable-gems',
# put fakebin on the PATH
'PATH' => "#{hub_dir}:#{bin_dir}:#{ENV['PATH']}",
# clear out GIT if it happens to be set
'GIT' => nil,
# exclude this project's git directory from use in testing
'GIT_CEILING_DIRECTORIES' => File.expand_path('../../..', __FILE__),
# sabotage git commands that might try to access a remote host
'GIT_PROXY_COMMAND' => 'echo',
# avoids reading from current user's "~/.gitconfig"
'HOME' => expand_path('home'),
'TMPDIR' => expand_path('tmp'),
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
'XDG_CONFIG_HOME' => nil,
'XDG_CONFIG_DIRS' => nil,
# used in fakebin/git
'HUB_SYSTEM_GIT' => system_git,
# ensure that api.github.com is actually never hit in tests
'HUB_TEST_HOST' => 'http://127.0.0.1:0',
# ensure we use fakebin `open` to test browsing
'BROWSER' => 'open',
# sabotage opening a commit message editor interactively
'GIT_EDITOR' => 'false',
# reset current localization settings
'LANG' => nil,
'LANGUAGE' => nil,
'LC_ALL' => 'en_US.UTF-8',
# ignore current user's token
'GITHUB_TOKEN' => nil,
'GITHUB_USER' => nil,
'GITHUB_PASSWORD' => nil,
'GITHUB_HOST' => nil,
'GIT_AUTHOR_NAME' => author_name,
'GIT_COMMITTER_NAME' => author_name,
'GIT_AUTHOR_EMAIL' => author_email,
'GIT_COMMITTER_EMAIL' => author_email,
'HUB_VERSION' => 'dev',
'HUB_REPORT_CRASH' => 'never',
'HUB_PROTOCOL' => nil,
)
FileUtils.mkdir_p(expand_path('~'))
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册