blob: 3c20164f0f0880d70858df739f5d36e5a01a8326 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
module Rails
module DevCaching # :nodoc:
class << self
FILE = 'tmp/caching-dev.txt'
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
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
private
def create_cache_file
FileUtils.touch FILE
end
def delete_cache_file
File.delete FILE
end
end
end
end
|