jekyll-local-theme 0.1.0 → 0.2.0

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: a87c8e0df7d8dd5e10e6d3caf9d774677514da8d8c300ee02a0bbe089fbfcb1f
4
- data.tar.gz: 398f765fbe2da7d01541b876954ce24e4622f727d7d8e4a11c1cfa856cf4a56f
3
+ metadata.gz: c6ae95a7a32340a8e057684b4540ca039f9c331ee3d17bec8b606159c9694e0c
4
+ data.tar.gz: eabd3458b8a716a1841bad3398c2e03d6b8b6f0555b9a968c71c2a9db54fb416
5
5
  SHA512:
6
- metadata.gz: e2765a6ce2839713ce9a40666af1e436daa0f6d5558aeefb20d5ddf05ae253b8e7ccde1ef9e3680008f2e4c7e39ddd8edc0678ba4ec8eb62a309098d2dd2c896
7
- data.tar.gz: b394ed7a1e822f9ea9e18c8f7a82925d17ba3370a94841a98cf4370c49f7568832cd9d55f6eb0b1f81433e92dfa8190c442dd2201c0dc403418c3e45692266d1
6
+ metadata.gz: 5d5e4ec5aa9156f9d814234fe0d4a61e54afd1567a79d6b60ed3f6de3896cf4942fc25942b7c70d1d304a95a7d9a59b9898a631ba014d1d6b918fab8aa40b6b4
7
+ data.tar.gz: d8cca0ae66a568ad26e62d6fd3e6b3ebc45389d4e343109b8cf0410c1824cb145f443fe1006bf73438cf93a848a29e9beebe84348347777cf7975f501cddd51b
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 なつき
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # Jekyll Local Theme
2
+
3
+ Jekyll plugin for building Jekyll sites with any local theme
4
+
5
+ ## Usage
6
+
7
+ 1. Add the following to your Gemfile
8
+
9
+ ``` ruby
10
+ gem "jekyll-local-theme"
11
+ ```
12
+
13
+ and run `bundle install` to install the plugin
14
+
15
+ 2. Add the following to your site's `_config.yml` to activate the plugin
16
+
17
+ ``` yml
18
+ plugins:
19
+ - jekyll-local-theme
20
+ ```
21
+
22
+ 3. Add themes to your site's `_themes` directory
23
+
24
+ ``` sh
25
+ git submodule add https://github.com/jekyll/minima.git _themes/minima
26
+ ```
27
+
28
+ Note: You can just copy files without using `git submodule`
29
+
30
+ 4. Add the following to your site's `_config.yml` to choose your theme
31
+
32
+ ``` yml
33
+ local_theme: minima
34
+ ```
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module LocalTheme
5
+ # The mock for {Gem::Specification}.
6
+ class MockGemSpecification
7
+ attr_reader :full_gem_path, :runtime_dependencies
8
+
9
+ def initialize(full_gem_path, runtime_dependencies)
10
+ @full_gem_path = full_gem_path
11
+ @runtime_dependencies = runtime_dependencies
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler'
4
+
5
+ module Jekyll
6
+ module LocalTheme
7
+ # The local {Theme} on file system.
8
+ class Theme < Jekyll::Theme
9
+ JEKYLL_THEME_PREFIX = 'jekyll-theme-'
10
+
11
+ private_constant :JEKYLL_THEME_PREFIX
12
+
13
+ def initialize(name, root)
14
+ name = name.delete_prefix(JEKYLL_THEME_PREFIX)
15
+ gemspec = [
16
+ File.expand_path("#{name}.gemspec", root),
17
+ File.expand_path("#{JEKYLL_THEME_PREFIX}#{name}.gemspec", root)
18
+ ].find { |file| File.exist?(file) }
19
+ @gemspec = MockGemSpecification.new(root,
20
+ gemspec ? Bundler.load_gemspec_uncached(gemspec).runtime_dependencies : [])
21
+ super(name)
22
+ end
23
+ end
24
+
25
+ private_constant :Theme
26
+ end
27
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module LocalTheme
5
- VERSION = "0.1.0"
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'local_theme/mock_gem_specification'
4
+ require_relative 'local_theme/theme'
5
+ require_relative 'local_theme/version'
6
+
7
+ module Jekyll
8
+ # The {LocalTheme} plugin for {Jekyll}.
9
+ module LocalTheme
10
+ module_function
11
+
12
+ def init(site)
13
+ name = site.config['local_theme']
14
+ return unless name
15
+
16
+ site.config['theme'] = name
17
+ site.theme = Theme.new(name, Jekyll.sanitized_path(Jekyll.sanitized_path(site.source, '_themes'), name))
18
+
19
+ Jekyll.logger.info 'Local Theme:', site.theme.root
20
+
21
+ site.send(:configure_include_paths)
22
+ site.plugin_manager.require_theme_deps
23
+ end
24
+ end
25
+ end
26
+
27
+ Jekyll::Hooks.register :site, :after_init do |site|
28
+ Jekyll::LocalTheme.init(site)
29
+ end
@@ -1,26 +1,4 @@
1
+ #!/usr/bin/env ruby
1
2
  # frozen_string_literal: true
2
3
 
3
- require "jekyll"
4
- require "jekyll-remote-theme"
5
-
6
- $LOAD_PATH.unshift(File.dirname(__FILE__))
7
-
8
- module Jekyll
9
- module LocalTheme
10
- autoload :MockGemspec, "jekyll-local-theme/mock_gemspec"
11
- autoload :Munger, "jekyll-local-theme/munger"
12
- autoload :Theme, "jekyll-local-theme/theme"
13
- autoload :VERSION, "jekyll-local-theme/version"
14
-
15
- CONFIG_KEY = "local_theme"
16
- LOG_KEY = "Local Theme:"
17
-
18
- def self.init(site)
19
- Munger.new(site).munge!
20
- end
21
- end
22
- end
23
-
24
- Jekyll::Hooks.register :site, :after_reset do |site|
25
- Jekyll::LocalTheme.init(site)
26
- end
4
+ require_relative 'jekyll/local_theme'
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-local-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-06 00:00:00.000000000 Z
11
+ date: 2024-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: jekyll-remote-theme
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 1.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: jekyll
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 4.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 4.0.0
27
41
  description:
28
42
  email:
29
43
  - i@ntk.me
@@ -31,15 +45,22 @@ executables: []
31
45
  extensions: []
32
46
  extra_rdoc_files: []
33
47
  files:
48
+ - LICENSE
49
+ - README.md
34
50
  - lib/jekyll-local-theme.rb
35
- - lib/jekyll-local-theme/mock_gemspec.rb
36
- - lib/jekyll-local-theme/munger.rb
37
- - lib/jekyll-local-theme/theme.rb
38
- - lib/jekyll-local-theme/version.rb
51
+ - lib/jekyll/local_theme.rb
52
+ - lib/jekyll/local_theme/mock_gem_specification.rb
53
+ - lib/jekyll/local_theme/theme.rb
54
+ - lib/jekyll/local_theme/version.rb
39
55
  homepage: https://github.com/ntkme/jekyll-local-theme
40
56
  licenses:
41
57
  - MIT
42
- metadata: {}
58
+ metadata:
59
+ bug_tracker_uri: https://github.com/ntkme/jekyll-local-theme/issues
60
+ documentation_uri: https://rubydoc.info/gems/jekyll-local-theme/0.2.0
61
+ source_code_uri: https://github.com/ntkme/jekyll-local-theme/tree/v0.2.0
62
+ funding_uri: https://github.com/sponsors/ntkme
63
+ rubygems_mfa_required: 'true'
43
64
  post_install_message:
44
65
  rdoc_options: []
45
66
  require_paths:
@@ -48,14 +69,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
48
69
  requirements:
49
70
  - - ">="
50
71
  - !ruby/object:Gem::Version
51
- version: 2.3.0
72
+ version: 2.4.0
52
73
  required_rubygems_version: !ruby/object:Gem::Requirement
53
74
  requirements:
54
75
  - - ">="
55
76
  - !ruby/object:Gem::Version
56
77
  version: '0'
57
78
  requirements: []
58
- rubygems_version: 3.1.2
79
+ rubygems_version: 3.5.6
59
80
  signing_key:
60
81
  specification_version: 4
61
82
  summary: Jekyll plugin for building Jekyll sites with any local theme
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- module LocalTheme
5
- class MockGemspec < Jekyll::RemoteTheme::MockGemspec
6
- end
7
- end
8
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- module LocalTheme
5
- class Munger < Jekyll::RemoteTheme::Munger
6
- def munge!
7
- return unless raw_theme
8
-
9
- Jekyll.logger.info LOG_KEY, "Using theme #{theme.root}"
10
- unless munged?
11
- configure_theme
12
- end
13
-
14
- theme
15
- end
16
-
17
- private
18
-
19
- def munged?
20
- site.theme&.is_a?(Jekyll::LocalTheme::Theme)
21
- end
22
-
23
- def theme
24
- @theme ||= Theme.new(raw_theme, Jekyll.sanitized_path(Jekyll.sanitized_path(site.source, "_themes"), raw_theme))
25
- end
26
-
27
- def raw_theme
28
- config[CONFIG_KEY]
29
- end
30
- end
31
- end
32
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- module LocalTheme
5
- class Theme < Jekyll::Theme
6
- def initialize(name, root)
7
- @root = root
8
- super(name)
9
- end
10
-
11
- def gemspec
12
- @gemspec ||= MockGemspec.new(self)
13
- end
14
- end
15
- end
16
- end