Tag: rake

使用捆绑EXR耙或只是耙?

我学习Rails只使用rake命令,如rake db:migrate ; 不过,我读到,我应该使用bundle exec rake …而不是简单的rake 。 现在我很困惑要使用哪个。 我应该使用bundle exec rake而不是简单的rake或者它只是一个偏好的东西? 任何有识之士将不胜感激! 谢谢!

在rspec中运行rubydebugging?

我试图让Rubydebugging器运行在我的规范之一: describe User do it "should be valid" do debugger User.new.should be_valid end end 当我运行rspec时,我得到: debugger statement ignored, use -d or –debug option to enable debugging 我已经尝试了以下内容: rake spec –debug rake spec –debug –trace rake spec:models –debug bundle exec rspec –debug bundle exec rspec –debug spec/models/ bundle exec rspec –d spec/models/ bundle exec "rspec –debug" […]

Ruby on Rails:如何使用rake db恢复迁移:migrate?

安装devise模型后,我得到了这个。 class DeviseCreateUsers < ActiveRecord::Migration def self.up create_table(:users) do |t| t.database_authenticatable :null => false t.recoverable t.rememberable t.trackable # t.encryptable # t.confirmable # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both # t.token_authenticatable t.timestamps end add_index :users, :email, :unique => true add_index :users, :reset_password_token, :unique => true # add_index :users, :confirmation_token, :unique => true # add_index :users, […]

全局访问Rake DSL方法已被弃用

我正在通过Ruby on Rails 3教程书,并在命令行上键入以下内容: rake db:migrate 其中产生了以下警告。 WARNING: Global access to Rake DSL methods is deprecated. Please Include … Rake::DSL into classes and modules which use the Rake DSL methods. WARNING: DSL method DemoApp::Application#task called at /Users/imac/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks' 我不知道该怎么做或如何使用它。 我不知道Rake的其他命令。 我该如何解决这个问题?

“无法find捆绑器”错误

当我尝试bundler update我得到这个错误: .rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [rake-0.8.7, rake-0.8.7, rubygems-update-1.8.4] (Gem::LoadError) 我是Ruby的新手,有人能告诉我这是什么原因吗? Rake 0.8.7被安装。

如何使用rake db:migrate只回滚一个步骤

在db/migrate文件夹中添加迁移文件并运行rake db:migrate ,我想回到上一步,我认为使用VERSION=n是正确的方法,但是我不知道正确的值ñ使用。 有没有任何命令来检查当前的n值? 如果有人可以提供关于如何使用rake db:migrate完整说明,那将是非常好的。

做铁轨耙任务提供访问ActiveRecord模型?

我试图创build一个自定义耙任务,但似乎我没有访问我的模型。 我认为这是隐式地包含在rails任务中的东西。 我在lib / tasks / test.rake中有以下代码: namespace :test do task :new_task do puts Parent.all.inspect end end 这里是我的父母模型的样子: class Parent < ActiveRecord::Base has_many :children end 这是一个非常简单的例子,但我得到以下错误: /> rake test:new_task (in /Users/arash/Documents/dev/soft_deletes) rake aborted! uninitialized constant Parent (See full trace by running task with –trace) 有任何想法吗? 谢谢

铁路的cron工作:最佳实践?

在Rails环境中运行计划任务的最佳方式是什么? 脚本/亚军? 耙?

bundle exec rake是什么意思?

bundle exec rake db:migrate是什么意思? 或者只是一般bundle exec rake <command> ? 我明白, bundle照顾维护Gemfile中的东西。 我知道“exec”这个词的意思。 我明白, rake保持所有不同的脚本你可以做的事情,我知道db:migrate是其中之一。 我只是不知道这些词汇在一起做什么。 为什么应该使用bundle执行rake来执行数据库迁移?

如何将命令行参数传递给rake任务

我有一个耙子任务,需要插入一个值到多个数据库。 我想通过命令行或其他 rake任务将此值传递给rake任务。 我该怎么做?