Sha256: 171e243fbba87dd29b13f7b8772cdcff77fe0d549774014c36fa2b312333f9fc

Contents?: true

Size: 762 Bytes

Versions: 7

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.open 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

7 entries across 7 versions & 1 rubygems

Version Path
frizz-1.1.0 lib/frizz/local.rb
frizz-1.0.1 lib/frizz/local.rb
frizz-1.0.0 lib/frizz/local.rb
frizz-0.0.4 lib/frizz/local.rb
frizz-0.0.3 lib/frizz/local.rb
frizz-0.0.2 lib/frizz/local.rb
frizz-0.0.1 lib/frizz/local.rb