Sha256: 4b7b25869738510d86159b89afc7863e3665518fdda0c72263aa6c9bb94e294f

Contents?: true

Size: 846 Bytes

Versions: 3

Compression:

Stored size: 846 Bytes

Contents

module Fontcustom
  class Manifest
    include Utility

    attr_accessor :manifest

    def initialize(options)
      @options = options
      update_or_create_manifest
    end

    def update_or_create_manifest
      if File.exists? @options[:manifest]
        update_manifest
      else
        create_manifest
      end
    end

    private

    def update_manifest
      @manifest = get_manifest
      if @manifest[:options] != @options
        @manifest[:options] = @options
        save_manifest
      end
    end

    def create_manifest
      @manifest = {
        :checksum => { :current => "", :previous => "" },
        :fonts => [],
        :glyphs => {},
        :options => @options,
        :templates => []
      }
      json = JSON.pretty_generate @manifest
      write_file @options[:manifest], json, :create
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fontcustom-1.3.0.beta3 lib/fontcustom/manifest.rb
fontcustom-1.3.0.beta2 lib/fontcustom/manifest.rb
fontcustom-1.3.0.beta lib/fontcustom/manifest.rb