如何调用 rake 控制台,这些设置是默认设置的?

How to make a call rake console, these settings are set by default?

如何调用 rake 控制台,默认设置这些设置?

2.3.0: 001> (ENV [ 'BATTLE_NET_REGION'] = 'eu') and (ENV [ 'BATTLE_NET_LOCALE'] = 'ru_RU') and (ENV [ 'BATTLE_NET_KEY'] = 'my_battle_net_key')

rake 任务:

require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task default: :spec

desc 'Open an irb session preloaded with this library'
task :console do
  sh 'irb -rubygems -I lib -r wowrb.rb'
end

您可以将变量添加到 shell 命令:

task :console do
  sh 'BATTLE_NET_REGION=eu BATTLE_NET_LOCALE=ru_RU BATTLE_NET_KEY=my_battle_net_key irb -rubygems -I lib -r wowrb.rb'
end

但是为什么要使用 rake 任务来启动 irb 控制台?直接启动它或使用设置所有变量的小 shell 脚本或别名会更容易吗?