bridgetown-core 0.10.1 → 0.10.2

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: 31902453cc98a9dd7477a25c07f005b5f4faecbd69bf45e166d13c7ff9406c79
4
- data.tar.gz: 5d9d919d9f2d13c0a6f572d166057c437e1e996ea7f5658972fc31f5e7cb539c
3
+ metadata.gz: 1e97f803a7a5d0bbe98ccb9a14cc2dc4054b4fec9f0803f5dd030e5d5812ce72
4
+ data.tar.gz: 7cec8b571520772cd25e87a75555d3f988e9d81b33181545ce93fbd294a0d99c
5
5
  SHA512:
6
- metadata.gz: 54a5ad80eccbc1702bd5743afa6eb78cb3e5c5615495acbe7fe178c55447ef3ae45bdd7be8aae6e89278258f8c2cbc86ec6a826f79a15a41b38b7c2ad498d815
7
- data.tar.gz: b6504df792cb0804cfb0a0feba76c90da44e63a38d325d40f5b543cb616ba06b5ce26ea957b883404d65bfbbefeb539e1170654d00cc4ff9144e25e260acd931
6
+ metadata.gz: 9e75fb63ae6d579080f70d8664a8a1accb035e6da4953982079873d152f0baf0dcfc7de193c1eff1cc5ac135388e39712557e6b38338d950e2f8e0d5067c204e
7
+ data.tar.gz: 743fb5560819f0849c4d8c137568f7500389e46b1918e9c86f4d18a08c34a13f793c7b39402991f616f1a6ff0271df3e7b41596d47a3e37a5d766c254b1fb59c
@@ -26,6 +26,7 @@ module Bridgetown
26
26
 
27
27
  Bundler.setup
28
28
  required_gems = Bundler.require(:bridgetown_plugins)
29
+ install_yarn_dependencies(required_gems)
29
30
  message = "Required #{required_gems.map(&:name).join(", ")}"
30
31
  Bridgetown.logger.debug("PluginManager:", message)
31
32
  ENV["BRIDGETOWN_NO_BUNDLER_REQUIRE"] = "true"
@@ -36,6 +37,31 @@ module Bridgetown
36
37
  end
37
38
  end
38
39
 
40
+ # Iterates through loaded plugins and finds yard-add gemspec metadata.
41
+ # If that exact package hasn't been installed, execute yarn add
42
+ #
43
+ # Returns nothing.
44
+ def self.install_yarn_dependencies(required_gems)
45
+ return unless File.exist?("package.json")
46
+
47
+ package_json = JSON.parse(File.read("package.json"))
48
+
49
+ required_gems.each do |loaded_gem|
50
+ next unless loaded_gem.to_spec&.metadata&.dig("yarn-add")
51
+
52
+ yarn_add_dependency = loaded_gem.to_spec.metadata["yarn-add"].split("@")
53
+ next unless yarn_add_dependency.length == 2
54
+
55
+ # check matching version number is see if it's already installed
56
+ current_package = package_json["dependencies"].dig(yarn_add_dependency.first)
57
+ next unless current_package.nil? || current_package != yarn_add_dependency.last
58
+
59
+ # all right, time to install the package
60
+ cmd = "yarn add #{yarn_add_dependency.join("@")}"
61
+ system cmd
62
+ end
63
+ end
64
+
39
65
  # Require all .rb files
40
66
  #
41
67
  # Returns nothing.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bridgetown
4
- VERSION = "0.10.1"
4
+ VERSION = "0.10.2"
5
5
  end
@@ -1,7 +1,7 @@
1
1
  <meta charset="utf-8" />
2
2
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
3
3
  {% capture page_title %}{{ page.title | strip_html | strip_newlines }}{% endcapture %}
4
- <title>{% if page_title != "" %}{{ page_title | escape }} | {{ site.metadata.title | escape }}{% else %}{{ site..metadata title | escape }}: {{ site.metadata.tagline | escape }}{% endif %}</title>
4
+ <title>{% if page_title != "" %}{{ page_title | escape }} | {{ site.metadata.title | escape }}{% else %}{{ site.metadata.title | escape }}: {{ site.metadata.tagline | escape }}{% endif %}</title>
5
5
 
6
6
  <meta name="description" content="{{ site.metadata.description }}" />
7
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-19 00:00:00.000000000 Z
11
+ date: 2020-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable