Module: Rails::DevCaching

Defined in:
railties/lib/rails/dev_caching.rb

Overview

:nodoc:

Constant Summary collapse

FILE =
'tmp/caching-dev.txt'

Class Method Summary collapse

Class Method Details

.enable_by_argument(caching) ⇒ Object


23
24
25
26
27
28
29
30
31
# File 'railties/lib/rails/dev_caching.rb', line 23

def enable_by_argument(caching)
  FileUtils.mkdir_p('tmp')

  if caching
    create_cache_file
  elsif caching == false && File.exist?(FILE)
    delete_cache_file
  end
end

.enable_by_fileObject


8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'railties/lib/rails/dev_caching.rb', line 8

def enable_by_file
  FileUtils.mkdir_p('tmp')

  if File.exist?(FILE)
    delete_cache_file
    puts 'Development mode is no longer being cached.'
  else
    create_cache_file
    puts 'Development mode is now being cached.'
  end

  FileUtils.touch 'tmp/restart.txt'
  FileUtils.rm_f('tmp/pids/server.pid')
end