Sha256: 01b1f04879214ea092e650309a905577b4c1510e933bd505d6e400fabd29b823

Contents?: true

Size: 762 Bytes

Versions: 8

Compression:

Stored size: 762 Bytes

Contents

module Frizz
  class Local
    def initialize(root_path)
      @root_path = root_path
    end

    def files
      @files ||= begin
        Dir.chdir(root_path) do
          Dir["**/*"].map do |local_path|
            File.new(expand_path(local_path), local_path) unless ::File.directory?(local_path)
          end.compact
        end
      end
    end

    def file_for(local_path)
      ::File.read expand_path(local_path)
    end

    private

    attr_reader :root_path

    def expand_path(local_path)
      ::File.join root_path, local_path
    end

    class File
      attr_reader :path, :key

      def initialize(path, key)
        @path = path
        @key = key
      end

      def checksum
        Digest::MD5.file(path)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
frizz-1.5.0 lib/frizz/local.rb
frizz-1.4.4 lib/frizz/local.rb
frizz-1.4.3 lib/frizz/local.rb
frizz-1.3.3 lib/frizz/local.rb
frizz-1.3.2 lib/frizz/local.rb
frizz-1.2.2 lib/frizz/local.rb
frizz-1.2.1 lib/frizz/local.rb
frizz-1.1.1 lib/frizz/local.rb