RAILS_ENV
在 rake 任务之前或之后添加有什么区别?以下是我的暂存环境中的示例:
RAILS_ENV
在 rake 任务之后添加。这引发了一个错误,其原因是
development
默认接受环境而不是devutility
环境。$bundle exec rake -T RAILS_ENV=devutility $rake aborted! $cannot load such file -- rack/bug
RAILS_ENV
在 rake 任务之前添加这有效并列出了所有可用的 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 .................... ..............