Sha256: 66b02f511f1ff5d5633ddb0716678751eaa470008845c5a897421b10fe4c1097

Contents?: true

Size: 900 Bytes

Versions: 31

Compression:

Stored size: 900 Bytes

Contents

require 'fileutils'

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

Version data entries

31 entries across 31 versions & 4 rubygems

Version Path
railties-5.0.7.2 lib/rails/dev_caching.rb
railties-5.0.7.1 lib/rails/dev_caching.rb
railties-5.0.7 lib/rails/dev_caching.rb
railties-5.0.6 lib/rails/dev_caching.rb
railties-5.0.6.rc1 lib/rails/dev_caching.rb
railties-5.0.5 lib/rails/dev_caching.rb
railties-5.0.5.rc2 lib/rails/dev_caching.rb
railties-5.0.5.rc1 lib/rails/dev_caching.rb
railties-5.0.4 lib/rails/dev_caching.rb
railties-5.0.4.rc1 lib/rails/dev_caching.rb
railties-5.0.3 lib/rails/dev_caching.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/railties-5.0.2/lib/rails/dev_caching.rb
railties-5.0.2 lib/rails/dev_caching.rb
railties-5.0.2.rc1 lib/rails/dev_caching.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/railties-5.0.1/lib/rails/dev_caching.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/railties-5.0.1/lib/rails/dev_caching.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/railties-5.0.1/lib/rails/dev_caching.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/railties-5.0.1/lib/rails/dev_caching.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/railties-5.0.1/lib/rails/dev_caching.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/railties-5.0.1/lib/rails/dev_caching.rb