jekyll-data-revised 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e564d57f1221d0dc6a960069f91669fba9febf32945eb74420defd09ffe5955e
4
- data.tar.gz: 9b4cbd5d076f6b713cf3343ae54cb0d130b3bc481fb96e79f7d48da9b47e24d2
3
+ metadata.gz: 8235a1de5929de3afae76827b3d20547fd0ff9837b8aa7d4d3a553a007efc8dd
4
+ data.tar.gz: 5eae835b1f3023ce3e242a8d3e1cadac9a9e2a56d0b335aba3ed3b0587f627bd
5
5
  SHA512:
6
- metadata.gz: 2bfff099d709386204254508622bb5cc49046ad622882e588408192e931012eef956abb55d1e1c741595d385429246130f0ae9682d021bde9351340c1b97993a
7
- data.tar.gz: cc426bbdd5db09e73cc1b258475c9bbe96416a40d70b603653525872261fa85f4c4fff908ce81cb03c93b6e6d9a98f53cbbbb4acd5e44b6fde112068ae381603
6
+ metadata.gz: 0d000fd359099279f80bf071947e8dab18d4d450109c3848fe76186b5f3f180ed4c39bda9d43103378cd8332b901a1b667b8a3bb71fedd9f8f7dbb0b6ac9182a
7
+ data.tar.gz: 5758af8fe853e8948ce9fb0a620c9dabcbe6b8c596199c8505ea0cd583dfa38adf8a18e89026e296de0a9f2034ed1f52865fdc4f861bf9e56f2dfc288c7c01f7
data/README.md CHANGED
@@ -29,6 +29,8 @@ end
29
29
 
30
30
  ## Usage
31
31
 
32
+ **Note:** *This plugin will only run in conjunction with a gem-based Jekyll-theme.*
33
+
32
34
  As long as the plugin-gem has been installed properly, and is included in the Gemfile's `:jekyll_plugins` group, data files supported by Jekyll and present in the `_data` directory at the root of your theme-gem will be read. Their contents will be added to the site's internal data hash, provided, an identical data hash doesn't already exist at the site-source.
33
35
 
34
36
  If the theme-gem also includes a `_config.yml` at its root, then it will be read as well. The resulting config hash will be mixed into the site's existing config hash, filling in where the *keys* are not already defined. In other words, the config file at `source` will override corresponding identical keys in a `_config.yml` within the theme-gem which would in turn override corresponding `DEFAULTS` from Jekyll:
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "jekyll"
4
2
  require "jekyll-data/version"
5
3
 
@@ -16,7 +14,8 @@ require_relative "jekyll/data_path"
16
14
  require_relative "jekyll/theme_drop"
17
15
 
18
16
  # ----------------------------------------------------------------------------
19
- # Modify the current site instance only if it uses a gem-based theme.
17
+ # Modify the current site instance if it uses a gem-based theme else have this
18
+ # plugin disabled.
20
19
  #
21
20
  # if a '_config.yml' is present at the root of theme-gem, it is evaluated and
22
21
  # the extracted hash data is incorprated into the site's config hash.
@@ -25,6 +24,12 @@ Jekyll::Hooks.register :site, :after_reset do |site|
25
24
  if site.theme
26
25
  file = site.in_theme_dir("_config.yml")
27
26
  JekyllData::ThemeConfiguration.reconfigure(site) if File.exist?(file)
27
+ else
28
+ Jekyll.logger.abort_with(
29
+ "JekyllData:",
30
+ "Error! This plugin only works with gem-based jekyll-themes. " \
31
+ "Please disable this plugin to proceed."
32
+ )
28
33
  end
29
34
  end
30
35
 
@@ -38,7 +43,7 @@ end
38
43
  Jekyll::Hooks.register :site, :after_init do |site|
39
44
  if site.theme
40
45
  file = site.in_theme_dir("_config.yml")
41
- Jekyll.logger.debug "Theme Config file:", file if File.exist?(file)
46
+ Jekyll.logger.info "Theme Config file:", file if File.exist?(file)
42
47
  site.reader = JekyllData::Reader.new(site)
43
48
  end
44
49
  end
@@ -1,5 +1,4 @@
1
- # frozen_string_literal: true
2
-
1
+ # encoding: UTF-8
3
2
  require "csv"
4
3
 
5
4
  module JekyllData
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: true
1
+ # encoding: UTF-8
2
2
 
3
3
  module JekyllData
4
4
  class ThemeConfiguration < Jekyll::Configuration
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module JekyllData
4
2
  class ThemeDataReader < Jekyll::DataReader
5
3
  attr_reader :site, :content
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: true
1
+ # encoding: UTF-8
2
2
 
3
3
  module JekyllData
4
4
  class ThemedSiteDrop < Jekyll::Drops::SiteDrop
@@ -9,6 +9,7 @@ module JekyllData
9
9
  def_delegator :@obj, :site_data, :data
10
10
  def_delegators :@obj, :theme
11
11
 
12
- private def_delegator :@obj, :config, :fallback_data
12
+ private
13
+ def_delegator :@obj, :config, :fallback_data
13
14
  end
14
15
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module JekyllData
4
- VERSION = "1.0.0".freeze
2
+ VERSION = "1.0.1".freeze
5
3
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module Jekyll
4
2
  class Command
5
3
  class << self
@@ -1,9 +1,7 @@
1
- # frozen_string_literal: true
2
-
3
1
  module Jekyll
4
2
  class Theme
5
3
  def data_path
6
- @data_path ||= path_for "_data"
4
+ path_for "_data".freeze
7
5
  end
8
6
  end
9
7
  end
@@ -1,18 +1,19 @@
1
- # frozen_string_literal: true
1
+ # encoding: UTF-8
2
2
 
3
3
  module Jekyll
4
4
  module Drops
5
5
  class UnifiedPayloadDrop < Drop
6
+ def site
7
+ @site_drop ||= JekyllData::ThemedSiteDrop.new(@obj)
8
+ end
9
+
6
10
  # Register a namespace to easily call subkeys under <theme-name> key
7
11
  # in the _config.yml within a theme-gem via its bundled templates.
8
12
  # e.g. with this drop, theme-specific variables usually called like
9
13
  # {{ site.minima.date_format }} can be shortened to simply
10
14
  # {{ theme.date_format }}.
11
15
  def theme
12
- @theme_drop ||= begin
13
- config = site.send(:fallback_data)
14
- config[config["theme"]]
15
- end
16
+ @theme_drop ||= site[site.theme.name]
16
17
  end
17
18
  end
18
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-data-revised
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ashwin Maroli
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 0.51.0
95
+ version: 0.47.1
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 0.51.0
102
+ version: 0.47.1
103
103
  description:
104
104
  email:
105
105
  - ashmaroli@gmail.com