Sha256: 57ca08df08b48af3339de321bf67d2d9ad453eeedce1f45918bb157c24d48f98
Contents?: true
Size: 797 Bytes
Versions: 20
Compression:
Stored size: 797 Bytes
Contents
require 'yaml' REDIRECTS_FILE = '.redirects.gollum' module Gollum module Redirects def stale? @current_head != get_head_sha end def init(wiki) @wiki = wiki @current_head = get_head_sha end def load file = @wiki.file(REDIRECTS_FILE) redirects = {} if file begin redirects = YAML.load(file.raw_data) rescue YAML::Error # TODO handle error end end self.clear self.merge!(redirects) end def dump(commit=nil) commit = {} if commit.nil? @wiki.overwrite_file(REDIRECTS_FILE, self.to_yaml, commit) end def get_head_sha @wiki.repo.head ? @wiki.repo.head.commit.sha : nil end end # Redirects Module end # Gollum Module
Version data entries
20 entries across 20 versions & 1 rubygems