在 Gemfile 中设置环境以基于自定义文件捆绑安装/更新
大家好 我构建了一个 sinatra 应用程序,用于捆绑的主要文件如下,
environment.rb
require 'sinatra'
require 'sequel'
ENV['RACK_ENV'] = 'development'
configure :production do
#do something
end
configure :development, :test do
#do something
end
Gemfile
gem 'sinatra'
gem 'sequel'
gem 'pg', :group => :production
gem 'sqlite3', :group => [:development, :test]
那么,如何让捆绑包根据我的environment.rb 文件中的 ENV['RACK_ENV'] 安装。
hi, all
I build a sinatra app, the main files for bundling as the following,
environment.rb
require 'sinatra'
require 'sequel'
ENV['RACK_ENV'] = 'development'
configure :production do
#do something
end
configure :development, :test do
#do something
end
Gemfile
gem 'sinatra'
gem 'sequel'
gem 'pg', :group => :production
gem 'sqlite3', :group => [:development, :test]
So, how to let the bundle install based on the ENV['RACK_ENV'] in my environment.rb file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当执行捆绑器要求时,您可以指定需要哪些组。
例如:
有关捆绑程序站点 gemfile 规范的更多信息,请参见此处。
When doing a bundler require you can specify which groups to be required.
For example:
More info on the bundler site gemfile specifications found here.