我有一个Rails 3.2.8应用程序,它在我的机器上运行良好,Postgres作为ActiveRecord的db后端。但是,当我将代码部署到EC2服务器时,无论是通过capistrano还是通过将我的项目rsync到EC2实例,rake都不再列出任何db:
任务:
$ 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 doc:app # Generate docs for the app -- also available doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/rdoc-t...
rake load_gml # Load GML source files into the environment database
rake log:clear # Truncates all *.log files in log/ to zero bytes
rake middleware # Prints out your Rack middleware stack
rake notes # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake rails:template # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake rails:update # Update configs and some other initially generated files (or use just update:configs, update:scripts, or u...
rake routes # Print out all defined routes in match order, with names.
rake secret # Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie se...
rake stats # Report code statistics (KLOCs, etc) from the application
rake test # Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:profil...
rake test:recent # Run tests for {:recent=>"test:prepare"} / Test recent changes
rake test:single # Run tests for {:single=>"test:prepare"}
rake test:uncommitted # Run tests for {:uncommitted=>"test:prepare"} / Test changes since last checkin (only Subversion and Git)
rake time:zones:all # Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter,...
rake tmp:clear # Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sock...
rake tmp:create # Creates tmp directories for sessions, cache, sockets, and pids
rake -P
也报告没有db:
个任务。
我猜它是某种依赖性问题,但我无法看到自从我在Bundler Gemfile
中声明我所有的gem依赖项后会发生什么。 Postgres 9.2.1已安装并正常工作,但即使不是,我也不明白为什么rake任务会消失。
任何关于发生了什么的线索都会感激不尽!
答案 0 :(得分:0)
事实证明这很简单:我复制了之前没有使用ActiveRecord的项目中的deploy.rb
文件,因此我没有设置role db:
。我仍然不确定为什么这意味着我的项目的rsync副本也没有任何rake db:
任务,但我不会再花费更多的周期来担心这一点。