Sha256: 888293c92b8fdabd20e2e6681b091b3165b16776fc9e44c3ef009508a2e699da

Contents?: true

Size: 884 Bytes

Versions: 15

Compression:

Stored size: 884 Bytes

Contents

# frozen_string_literal: true

require "fileutils"

module Jets
  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"
      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

15 entries across 15 versions & 1 rubygems

Version Path
jets-5.0.13 lib/jets/dev_caching.rb
jets-5.0.12 lib/jets/dev_caching.rb
jets-5.0.11 lib/jets/dev_caching.rb
jets-5.0.10 lib/jets/dev_caching.rb
jets-5.0.9 lib/jets/dev_caching.rb
jets-5.0.8 lib/jets/dev_caching.rb
jets-5.0.7 lib/jets/dev_caching.rb
jets-5.0.6 lib/jets/dev_caching.rb
jets-5.0.5 lib/jets/dev_caching.rb
jets-5.0.4 lib/jets/dev_caching.rb
jets-5.0.3 lib/jets/dev_caching.rb
jets-5.0.2 lib/jets/dev_caching.rb
jets-5.0.1 lib/jets/dev_caching.rb
jets-5.0.0 lib/jets/dev_caching.rb
jets-5.0.0.beta1 lib/jets/dev_caching.rb