繁体   English   中英

rails 3.0.12 更新 - 为什么这个 gem 的 rake 任务没有加载?

[英]rails 3.0.12 update - why are the rake tasks of this gem not loaded?

我正在将 Rails 2.x 应用程序更新到 Rails 3.0.12。

这个应用程序使用引导程序 gem 来“播种”数据库。 gem 的原始分支似乎已停止在 rails 2.x 分支中,但我发现另一个分支(理论上)与 rails 3.2 兼容(请注意我正在更新到 3.0.12,而不是 3.2)。

所以这就是我的 Gemfile 现在的内容:

gem 'bootstrapper', :git => 'git://github.com/vivrass/bootstrapper.git'

运行 bundle update 后,这似乎工作...除了 gem 应该添加一个名为rake db:bootstrap的新 rake 任务,并且当我执行rake -T db时它不会出现(我将其别名为bundle exec rake -T db通过 oh-my-zsh bundle exec rake -T db )。

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,根据这篇文章,gem 似乎在做正确的事情: - 它有一个加载rake 文件railtie.rb文件 - railtie.rb 文件包含在lib/bootstraper 中。文件

然而,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 项目有关。

好的,找到问题了。

旧的 (rails 2.x) 引导程序 gem 需要一个名为lib/tasks/bootstrapper.rake的文件。 我在我的 Rails 项目中仍然有那个文件,它正在处理 rake 任务。 删除文件解决了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM