jekyll-local-theme 0.2.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d080caecf9a43d8bf69b4e1117620f3b790ee3e714d37616237bcfb403588c89
4
- data.tar.gz: 542dc8ded09c21e065fe0ac0154a9818597d19a7ddf6b5e938f60cb89f452d8d
3
+ metadata.gz: 00fef92712fd20dc68176d7ed08c8c96946d042395b266518d2ff6f5404447a6
4
+ data.tar.gz: 68c8bc9195f6a3036acaa70bfa44385ce9717f791a3ea3065d33226bf67e7b13
5
5
  SHA512:
6
- metadata.gz: 93ed8a85669b9f13302c39e9254b7823f3f8e9c0de9ce8fb49b5fe2953f2e1cc449f08b85512f41c1afe768b07ed66a7a1ee74fa4f28896f2e1518a0004a97bf
7
- data.tar.gz: 7c35b092ebd1650a1bdf61bfc770ab107fadd9bd5c24bd75d44cd5941cc2d597ea72e39163742697da797a05557e6a52bc634b20abc35192afaa47929fdb5462
6
+ metadata.gz: 612620c55a760df07041cfb4fea45418f6ac042aada3cb9f1e9084b5824410f6006b35340c56cfea247d8d5290c3c02464384f896616f61d0e83e2d0051f2974
7
+ data.tar.gz: aa755030aa4b8b5a9bc0cd0ebfdae6e436b31ad49a66f775043ef52e5550b4aba3968e1381ea5671261aa37ed865bdba193fa88646fe24d896c99bf74c8edb4d
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 なつき
3
+ Copyright (c) 2024 なつき
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -6,19 +6,19 @@ module Jekyll
6
6
  module LocalTheme
7
7
  # The local {Theme} on file system.
8
8
  class Theme < Jekyll::Theme
9
- JEKYLL_THEME_PREFIX = 'jekyll-theme-'
9
+ def initialize(root)
10
+ gemspec = Gem::Util.glob_files_in_dir(Bundler::Source::Path::DEFAULT_GLOB, root)
11
+ .min_by { |p| -p.split(File::SEPARATOR).size }
10
12
 
11
- private_constant :JEKYLL_THEME_PREFIX
13
+ if gemspec
14
+ @gemspec = Bundler.load_gemspec_uncached(gemspec)
15
+ @gemspec.full_gem_path = File.dirname(gemspec)
16
+ else
17
+ @gemspec = Gem::Specification.new(File.basename(root))
18
+ @gemspec.full_gem_path = root
19
+ end
12
20
 
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)
21
+ super(@gemspec.name)
22
22
  end
23
23
  end
24
24
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module LocalTheme
5
- VERSION = '0.2.2'
5
+ VERSION = '1.0.0'
6
6
  end
7
7
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'local_theme/mock_gem_specification'
4
3
  require_relative 'local_theme/theme'
5
4
  require_relative 'local_theme/version'
6
5
 
@@ -10,13 +9,14 @@ module Jekyll
10
9
  module_function
11
10
 
12
11
  def init(site)
13
- name = site.config['local_theme']
14
- return unless name
12
+ path = site.config['local_theme']
13
+ return unless path
15
14
 
16
- site.config['theme'] = name
17
- site.theme = Theme.new(name, Jekyll.sanitized_path(Jekyll.sanitized_path(site.source, '_themes'), name))
15
+ theme = Theme.new(Jekyll.sanitized_path(Jekyll.sanitized_path(site.source, '_themes'), path))
16
+ site.theme = theme
17
+ site.config['theme'] = theme.name
18
18
 
19
- Jekyll.logger.info 'Local theme:', site.theme.root
19
+ Jekyll.logger.info 'Local theme:', theme.root
20
20
 
21
21
  site.send(:configure_include_paths)
22
22
  site.plugin_manager.require_theme_deps
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-local-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-22 00:00:00.000000000 Z
11
+ date: 2024-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.0
19
+ version: 2.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: 1.2.0
26
+ version: 2.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jekyll
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -49,7 +49,6 @@ files:
49
49
  - README.md
50
50
  - lib/jekyll-local-theme.rb
51
51
  - lib/jekyll/local_theme.rb
52
- - lib/jekyll/local_theme/mock_gem_specification.rb
53
52
  - lib/jekyll/local_theme/theme.rb
54
53
  - lib/jekyll/local_theme/version.rb
55
54
  homepage: https://github.com/ntkme/jekyll-local-theme
@@ -57,8 +56,8 @@ licenses:
57
56
  - MIT
58
57
  metadata:
59
58
  bug_tracker_uri: https://github.com/ntkme/jekyll-local-theme/issues
60
- documentation_uri: https://rubydoc.info/gems/jekyll-local-theme/0.2.2
61
- source_code_uri: https://github.com/ntkme/jekyll-local-theme/tree/v0.2.2
59
+ documentation_uri: https://rubydoc.info/gems/jekyll-local-theme/1.0.0
60
+ source_code_uri: https://github.com/ntkme/jekyll-local-theme/tree/v1.0.0
62
61
  funding_uri: https://github.com/sponsors/ntkme
63
62
  rubygems_mfa_required: 'true'
64
63
  post_install_message:
@@ -74,9 +73,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
73
  requirements:
75
74
  - - ">="
76
75
  - !ruby/object:Gem::Version
77
- version: '0'
76
+ version: 3.2.0
78
77
  requirements: []
79
- rubygems_version: 3.5.6
78
+ rubygems_version: 3.5.9
80
79
  signing_key:
81
80
  specification_version: 4
82
81
  summary: Jekyll plugin for building Jekyll sites with any local theme
@@ -1,17 +0,0 @@
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
-
15
- private_constant :MockGemSpecification
16
- end
17
- end