jekyll-remote-theme 0.6.0 → 0.6.2

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: e8b60407212cb023740ee7d4258e9a02c862bed37246db406607af4d3e6228e8
4
- data.tar.gz: 448d9d30e4f0e0a2efa300c1ab7bdd8199ff82fcc4afd97264227892d6ab5fe3
3
+ metadata.gz: ba1e01813a5ce456acee22c1b8d44b4a01519ac9f5e166f74d3467969fba91a9
4
+ data.tar.gz: 4fb744361a3b6d742d8d2c7076aa18f3db36a497307b6f0be41faaf923cc1473
5
5
  SHA512:
6
- metadata.gz: 36eacae972f56890144e128ec284067fa33f03f528b4f70047b0c60e4f90e80f04426990a6abb6ea87d1d6cbecac1b12effec5dcafbe89c7eb6abd9d1160c357
7
- data.tar.gz: '0871deb358244f78aa294b171af43415eb0bed1367c3224554992c1723dbae092d48d0bc321c116fd0297b1e22d7847e030599c748a6fef5b5192a9f1ccdfa93'
6
+ metadata.gz: 82e5b4b3d7c85e21563a2a181b37c86b7b9eef0ee6590af3842340ef11553824fe97912f73f1b19a564e8f3837cd540ec43ab95a6cae1b24cb163883e774b9bf
7
+ data.tar.gz: 40538c766c943193571d4409477a279de29bfbbce4cd415f60702ecdb9e8e9d078e76efb12b467df66db5f61a0c47a299bc215b99867401986839d7f8a26fef6
@@ -40,7 +40,7 @@ module Jekyll
40
40
  # On a rebuild, reuse the theme configured by the first run rather than
41
41
  # building a new one, which would create another temp directory.
42
42
  def theme
43
- @theme ||= munged? ? site.theme : Theme.new(raw_theme)
43
+ @theme ||= munged? ? site.theme : Theme.new(raw_theme, site)
44
44
  end
45
45
 
46
46
  def raw_theme
@@ -21,7 +21,10 @@ module Jekyll
21
21
  # 5. /absolute/path/to/theme - an absolute local file path
22
22
  # 6. ../relative/path/to/theme - a relative local file path
23
23
  # 7. ~/path/to/theme - a home directory relative path
24
- def initialize(raw_theme)
24
+ #
25
+ # Local paths are only valid when a site is given and it isn't in safe mode.
26
+ def initialize(raw_theme, site = nil)
27
+ @site = site
25
28
  original_theme = raw_theme.to_s.strip
26
29
  local_path = looks_like_local_path?(original_theme)
27
30
  @raw_theme = local_path ? original_theme : original_theme.downcase
@@ -70,7 +73,9 @@ module Jekyll
70
73
  end
71
74
 
72
75
  def root
73
- @root ||= local_theme? ? expanded_local_path : File.realpath(Dir.mktmpdir(TEMP_PREFIX))
76
+ return (expanded_local_path if local_path_valid?) if local_theme?
77
+
78
+ @root ||= File.realpath(Dir.mktmpdir(TEMP_PREFIX))
74
79
  end
75
80
 
76
81
  def inspect
@@ -84,6 +89,15 @@ module Jekyll
84
89
 
85
90
  private
86
91
 
92
+ # A rejected local theme has no root. Jekyll 3's Theme#initialize resolves
93
+ # the theme's Sass path straight away, so return no paths rather than
94
+ # passing a nil root to Jekyll.sanitized_path.
95
+ def path_for(folder)
96
+ return if root.nil?
97
+
98
+ super
99
+ end
100
+
87
101
  def looks_like_local_path?(path)
88
102
  # Check if it looks like a local path
89
103
  # Supports: /, ./, ../, ~/ (Unix-style) and drive letters (Windows-style)
@@ -94,7 +108,11 @@ module Jekyll
94
108
  @expanded_local_path ||= File.expand_path(@raw_theme)
95
109
  end
96
110
 
111
+ # Local paths can reference any directory on the host, so they're never
112
+ # allowed in safe mode (or without a site to check).
97
113
  def local_path_valid?
114
+ return false if @site.nil? || @site.safe
115
+
98
116
  Dir.exist?(expanded_local_path)
99
117
  end
100
118
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module RemoteTheme
5
- VERSION = "0.6.0"
5
+ VERSION = "0.6.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-remote-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
@@ -271,6 +271,8 @@ dependencies:
271
271
  - - "~>"
272
272
  - !ruby/object:Gem::Version
273
273
  version: '3.0'
274
+ description: Jekyll plugin to build a site with any public GitHub-hosted theme, set
275
+ via the remote_theme config key. Supported on GitHub Pages.
274
276
  email:
275
277
  - ben.balter@github.com
276
278
  executables: []
@@ -287,7 +289,11 @@ files:
287
289
  homepage: https://github.com/benbalter/jekyll-remote-theme
288
290
  licenses:
289
291
  - MIT
290
- metadata: {}
292
+ metadata:
293
+ homepage_uri: https://github.com/benbalter/jekyll-remote-theme
294
+ source_code_uri: https://github.com/benbalter/jekyll-remote-theme
295
+ bug_tracker_uri: https://github.com/benbalter/jekyll-remote-theme/issues
296
+ changelog_uri: https://github.com/benbalter/jekyll-remote-theme/releases
291
297
  rdoc_options: []
292
298
  require_paths:
293
299
  - lib