Sha256: 9828f2ecfb6906ffa4f1ccfd036e81c9c5c8f37f61f6c5e048369809cc663b9e

Contents?: true

Size: 986 Bytes

Versions: 2

Compression:

Stored size: 986 Bytes

Contents

module Octopress
  module Ink
    module Assets
      class Config < Asset

        def initialize(plugin, path)
          @root = plugin.assets_path
          @plugin = plugin
          @dir = plugin.slug
          @base = ''
          @exists = {}
          @file = path
        end

        # If config plugin config file exists, return contents for list command
        def info
          if exists?(config = plugin_path)
            Ink::Utils.pretty_print_yaml(read)
          else
            "   none"
          end
        end

        def read
          config = {}
          default = plugin_path
          if exists? default
            config = SafeYAML.load_file(default) || {}
          end

          if exists? user_path
            user_config = SafeYAML.load_file(user_path) || {}
            config = Jekyll::Utils.deep_merge_hashes(config, user_config)
          end

          config['permalinks'] ||= {}

          config
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
octopress-ink-1.0.0.rc.40 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.39 lib/octopress-ink/assets/config.rb