summaryrefslogtreecommitdiff
path: root/lib/scheduler.rb
blob: 0fa7638fd3174a40331a593b9d9af8d1b55c052b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Scheduler
  def perform
    projects = Project.where(always_build: true).all
    projects.each do |project|
      last_build = project.last_build
      next unless last_build

      interval = project.polling_interval
      if (last_build.created_at + interval.hours) < Time.now
        Build.create_from(last_build)
        puts "."
      end
    end
  end
end