1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/lib/rails/commands/dev_cache.rb
Kasper Timm Hansen 5da05c3e6b Ditch Commands namespace for base command.
Reading `Rails::Commands::Command` feels excessive. Especially if users can subclass command
to write their own commands — which I'd like to aim for.

Switch to `Rails::Command` before we get too far into things.
2015-12-06 14:23:28 +01:00

21 lines
583 B
Ruby

require 'rails/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