【发布时间】:2012-04-21 17:49:38
【问题描述】:
我正在将 rails 2.x 应用程序更新到 rails 3.0.12。
此应用使用引导程序 gem 来“播种”数据库。 gem 的original fork 似乎已经停止在 rails 2.x 分支,但我发现这个(理论上)与 rails 3.2 兼容的另一个分支(请注意,我正在更新到 3.0.12,而不是 3.2) .
这就是我的 Gemfile 现在拥有的:
gem 'bootstrapper', :git => 'git://github.com/vivrass/bootstrapper.git'
运行包更新后,这似乎工作......除了 gem 应该添加一个名为 rake db:bootstrap 的新 rake 任务,并且当我执行 rake -T db 时它不会出现(我已将其别名为bundle exec rake -T db 通过 oh-my-zsh)。
rake db:create # Create the database from config/database.yml for the current Rails.env (use db:crea...
rake db:drop # Drops the database for the current Rails.env (use db:drop:all to drop all databases)
rake db:fixtures:load # Load fixtures into the current environment's database.
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false).
rake db:migrate:status # Display status of migrations
rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n).
rake db:schema:dump # Create a db/schema.rb file that can be portably used against any DB supported by AR
rake db:schema:load # Load a schema.rb file into the database
rake db:seed # Load the seed data from db/seeds.rb
rake db:setup # Create the database, load the schema, and initialize with the seed data (use db:res...
rake db:structure:dump # Dump the database structure to an SQL file
rake db:version # Retrieves the current schema version number
我检查了 repo,根据this post 看来 gem 正在做正确的事情: - 它有一个railtie.rb 文件,用于加载rake file - railtie.rb 文件包含在lib/bootstraper.rb file
然而,rake 任务并没有出现。
将 rake 任务添加到 gem 的过程是否从 rails 3.0.x 更改为 3.2.x?
我正在运行 ruby 1.9.3。
谢谢。
编辑:
我在rails 3.0.12新建了一个空rails项目,在Gemfile上添加了这行,打包后出现rake任务。这可能与我从 rails 2.x 更新而不是创建全新的 rails 3.0.12 项目这一事实有关。
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-3 rubygems rake