加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何加快Ruby / Rake任务的速度

发布时间:2020-12-16 19:13:49 所属栏目:百科 来源:网络整理
导读:rake –tasks需要大约18秒才能运行.这只是加载所有任务所需的时间,因此我定义的任何任务至少需要花费这么多时间来运行: $time rake --tasksrake db:clean # Cleaning up databaserake passenger:restart # Restart Applicationrake spec # Run specsreal 0m
rake –tasks需要大约18秒才能运行.这只是加载所有任务所需的时间,因此我定义的任何任务至少需要花费这么多时间来运行:
$time rake --tasks
rake db:clean           # Cleaning up database
rake passenger:restart  # Restart Application
rake spec               # Run specs

real    0m18.816s
user    0m7.306s
sys 0m5.665s

我的Rakefile:

$: << "."
require "rubygems"
require "rspec/core/rake_task"

desc "Run those specs"
task :spec do
  RSpec::Core::RakeTask.new(:spec) do |t|
    t.rspec_opts = %w{--colour --format progress}
    t.pattern = 'spec/*_spec.rb'
  end
end

task :default  => :spec

知道为什么rake需要多次?
谢谢

解决方法

试试 spring

命令行将如下所示:

spring rake -T

第一次运行需要更多时间,但后续运行速度非常快.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读