Sha256: de1bcc5b1eb9e94b0b8aa2a800dc3513cb07102f61950b895dd43d773bf0f307

Contents?: true

Size: 990 Bytes

Versions: 37

Compression:

Stored size: 990 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)
            File.open(config).read.gsub(/^/,'    ')
          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

37 entries across 37 versions & 1 rubygems

Version Path
octopress-ink-1.0.0.rc.38 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.37 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.36 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.35 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.34 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.33 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.32 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.31 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.30 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.29 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.28 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.27 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.26 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.25 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.24 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.23 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.22 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.21 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.20 lib/octopress-ink/assets/config.rb
octopress-ink-1.0.0.rc.19 lib/octopress-ink/assets/config.rb