Module: Rails::DevCaching

Defined in:
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



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

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



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

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"
end