Module: AppPreloader

Defined in:
lib/preload.rb

Class Method Summary collapse

Class Method Details

.copy_static_filesObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/preload.rb', line 13

def self.copy_static_files
  # Copy template files
  puts ">> Copying static system files..."
  YARD::Templates::Engine.template(:default, :fulldoc, :html).full_paths.each do |path|
    %w(css js images).each do |ext|
      srcdir, dstdir = File.join(path, ext), File.join('public', ext)
      next unless File.directory?(srcdir)
      system "mkdir -p #{dstdir} && cp #{srcdir}/* #{dstdir}/"
    end
  end
end

.preload!Object



6
7
8
9
10
11
# File 'lib/preload.rb', line 6

def self.preload!
  copy_static_files
  start_update_gems_timer
  GC.compact
  DB.disconnect
end

.start_update_gems_timerObject



25
26
27
28
29
30
31
32
# File 'lib/preload.rb', line 25

def self.start_update_gems_timer
  Thread.new do
    loop do
      fork { GemUpdater.update_remote_gems display: true }
      sleep 600
    end
  end
end