aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands/dev_cache.rb
blob: 43675c0e69b77e0e497b25bb556ebdf5e7e73c44 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'rails/commands/command'

module Rails
  module Commands
    # This is a wrapper around the Rails dev:cache command
    class DevCache < Command
      set_banner :dev_cache, 'Toggle development mode caching on/off'      
      def dev_cache
        if File.exist? 'tmp/caching-dev.txt'
          File.delete 'tmp/caching-dev.txt'
          puts 'Development mode is no longer being cached.'
        else
          FileUtils.touch 'tmp/caching-dev.txt'
          puts 'Development mode is now being cached.'
        end

        FileUtils.touch 'tmp/restart.txt'
      end
    end
  end
end