【发布时间】:2013-08-05 04:50:25
【问题描述】:
在 rake 任务之前或之后添加 RAILS_ENV 有什么区别?以下是我的暂存环境中的示例:
-
在 rake 任务之后添加
RAILS_ENV。这引发了一个错误,其原因是默认接受
development环境而不是devutility作为环境。$bundle exec rake -T RAILS_ENV=devutility $rake aborted! $cannot load such file -- rack/bug -
在 rake 任务前添加
RAILS_ENV这有效并列出了所有可用的 rake 任务。
$RAILS_ENV=devutility bundle exec rake -T rake about # List versions of all Rails frameworks and the environment rake assets:clean # Remove compiled assets rake assets:precompile # Compile all the assets named in config.assets.precompile rake bourbon:install[sass_path] # Move files to the Rails assets directory rake ci # Continuous Integration build (simplecov-rcov and deploy) rake cucumber # Alias for cucumber:ok rake cucumber:all # Run all features rake cucumber:ok # Run features that should pass rake cucumber:rerun # Record failing features and run only them if any exist rake cucumber:wip # Run features that are being worked on rake db:create # Create the database from DATABASE_URL or config/database.yml for the current Rails.env (use db:create:all to create all dbs in the config) rake db:data:dump .................... ..............
【问题讨论】:
标签: ruby-on-rails ruby rake environment-variables ruby-on-rails-4