Sha256: 94bf1de38524db308f2c0684afa746a900d5a4a4e868a6a4628c67e9cfdd2663

Contents?: true

Size: 926 Bytes

Versions: 2

Compression:

Stored size: 926 Bytes

Contents

module Octopress
  module Ink
    module Assets
      class Config < Asset

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

        def user_dir
          File.join Plugins.site.source, Plugins.custom_dir, @dir
        end

        def local_plugin_path
          File.join Plugins.site.source, @dir, @file
        end

        def read
          config = {}
          if @plugin.type != 'local_plugin'
            default = plugin_path
            if exists? default
              config = YAML.safe_load(File.open(default))
            end
          end
          override = user_path
          if exists? override
            config = config.deep_merge YAML.safe_load(File.open(override))
          end
          config
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
octopress-ink-1.0.0.alpha.33 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.alpha.32 lib/octopress-ink/assets/config.rb