bridgetown-core 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/bin/bridgetown +0 -25
  3. data/bridgetown-core.gemspec +4 -1
  4. data/lib/bridgetown-core.rb +4 -1
  5. data/lib/bridgetown-core/cleaner.rb +1 -0
  6. data/lib/bridgetown-core/command.rb +10 -4
  7. data/lib/bridgetown-core/commands/console.rb +1 -2
  8. data/lib/bridgetown-core/commands/doctor.rb +1 -2
  9. data/lib/bridgetown-core/commands/new.rb +0 -3
  10. data/lib/bridgetown-core/commands/plugins.rb +169 -0
  11. data/lib/bridgetown-core/{convertible.rb → concerns/convertible.rb} +2 -2
  12. data/lib/bridgetown-core/concerns/site/configurable.rb +153 -0
  13. data/lib/bridgetown-core/concerns/site/content.rb +111 -0
  14. data/lib/bridgetown-core/concerns/site/extensible.rb +56 -0
  15. data/lib/bridgetown-core/concerns/site/processable.rb +74 -0
  16. data/lib/bridgetown-core/concerns/site/renderable.rb +50 -0
  17. data/lib/bridgetown-core/concerns/site/writable.rb +31 -0
  18. data/lib/bridgetown-core/configuration.rb +2 -9
  19. data/lib/bridgetown-core/converters/markdown/kramdown_parser.rb +0 -3
  20. data/lib/bridgetown-core/document.rb +1 -1
  21. data/lib/bridgetown-core/drops/site_drop.rb +1 -1
  22. data/lib/bridgetown-core/external.rb +17 -21
  23. data/lib/bridgetown-core/filters.rb +10 -0
  24. data/lib/bridgetown-core/generators/prototype_generator.rb +1 -1
  25. data/lib/bridgetown-core/hooks.rb +62 -62
  26. data/lib/bridgetown-core/layout.rb +10 -4
  27. data/lib/bridgetown-core/page.rb +9 -2
  28. data/lib/bridgetown-core/plugin.rb +2 -0
  29. data/lib/bridgetown-core/plugin_manager.rb +62 -12
  30. data/lib/bridgetown-core/reader.rb +5 -0
  31. data/lib/bridgetown-core/readers/data_reader.rb +5 -2
  32. data/lib/bridgetown-core/readers/layout_reader.rb +9 -2
  33. data/lib/bridgetown-core/readers/plugin_content_reader.rb +48 -0
  34. data/lib/bridgetown-core/renderer.rb +7 -10
  35. data/lib/bridgetown-core/site.rb +20 -463
  36. data/lib/bridgetown-core/utils.rb +1 -27
  37. data/lib/bridgetown-core/utils/ruby_exec.rb +1 -4
  38. data/lib/bridgetown-core/version.rb +2 -2
  39. data/lib/bridgetown-core/watcher.rb +5 -1
  40. data/lib/site_template/plugins/{.keep → builders/.keep} +0 -0
  41. data/lib/site_template/plugins/site_builder.rb +4 -0
  42. data/lib/site_template/src/_includes/navbar.html +1 -0
  43. data/lib/site_template/src/posts.md +15 -0
  44. data/lib/site_template/start.js +1 -1
  45. metadata +58 -6
@@ -20,7 +20,7 @@ module Bridgetown
20
20
 
21
21
  # Takes a slug and turns it into a simple title.
22
22
  def titleize_slug(slug)
23
- slug.split("-").map!(&:capitalize).join(" ")
23
+ slug.gsub(%r![_ ]!, "-").split("-").map!(&:capitalize).join(" ")
24
24
  end
25
25
 
26
26
  # Non-destructive version of deep_merge_hashes! See that method.
@@ -95,32 +95,6 @@ module Bridgetown
95
95
  end
96
96
  end
97
97
 
98
- def transform_keys(hash)
99
- result = {}
100
- hash.each_key do |key|
101
- result[yield(key)] = hash[key]
102
- end
103
- result
104
- end
105
-
106
- # Apply #to_sym to all keys in the hash
107
- #
108
- # hash - the hash to which to apply this transformation
109
- #
110
- # Returns a new hash with symbolized keys
111
- def symbolize_hash_keys(hash)
112
- transform_keys(hash) { |key| key.to_sym rescue key }
113
- end
114
-
115
- # Apply #to_s to all keys in the Hash
116
- #
117
- # hash - the hash to which to apply this transformation
118
- #
119
- # Returns a new hash with stringified keys
120
- def stringify_hash_keys(hash)
121
- transform_keys(hash) { |key| key.to_s rescue key }
122
- end
123
-
124
98
  # Parse a date/time and throw an error if invalid
125
99
  #
126
100
  # input - the date/time to parse
@@ -59,10 +59,7 @@ module Bridgetown
59
59
 
60
60
  # This is where the magic happens! DON'T BE EVIL!!! ;-)
61
61
  output = obj.instance_eval(ruby_code)
62
-
63
- output = Bridgetown::Utils.stringify_hash_keys(output) if output.is_a?(Hash)
64
-
65
- output
62
+ output.is_a?(Hash) ? output.with_indifferent_access : output
66
63
  end
67
64
  end
68
65
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bridgetown
4
- VERSION = "0.13.0"
5
- CODE_NAME = "Klickitat"
4
+ VERSION = "0.14.0"
5
+ CODE_NAME = "Hazelwood"
6
6
  end
@@ -41,7 +41,8 @@ module Bridgetown
41
41
  FileUtils.mkdir(webpack_path) unless Dir.exist?(webpack_path)
42
42
  Listen.to(
43
43
  options["source"],
44
- site.in_root_dir(".bridgetown-webpack"),
44
+ webpack_path,
45
+ *site.plugin_manager.plugins_path,
45
46
  ignore: listen_ignore_paths(options),
46
47
  force_polling: options["force_polling"],
47
48
  &listen_handler(site)
@@ -124,6 +125,9 @@ module Bridgetown
124
125
 
125
126
  def process(site, time)
126
127
  begin
128
+ Bridgetown::Hooks.trigger :site, :pre_reload, site
129
+ Bridgetown::Hooks.clear_reloadable_hooks
130
+ site.plugin_manager.reload_plugin_files
127
131
  site.process
128
132
  Bridgetown.logger.info "Done! 🎉", "#{"Completed".green} in less than" \
129
133
  " #{(Time.now - time).ceil(2)} seconds."
@@ -0,0 +1,4 @@
1
+ class SiteBuilder < Bridgetown::Builder
2
+ # write builders which subclass SiteBuilder in plugins/builder
3
+ end
4
+
@@ -1,4 +1,5 @@
1
1
  <nav>
2
2
  <a href="/">Home</a>
3
3
  <a href="/about">About</a>
4
+ <a href="/posts">Posts</a>
4
5
  </nav>
@@ -0,0 +1,15 @@
1
+ ---
2
+ layout: page
3
+ title: Posts
4
+ permalink: /posts/
5
+ ---
6
+
7
+ <ul>
8
+ {% for post in site.posts %}
9
+ <li>
10
+ <a href="{{ post.url }}">{{ post.title }}</a>
11
+ </li>
12
+ {% endfor %}
13
+ </ul>
14
+
15
+ If you have a lot of posts, you may want to consider adding [pagination](https://www.bridgetownrb.com/docs/content/pagination)!
@@ -14,4 +14,4 @@ concurrently([
14
14
  ], {
15
15
  restartTries: 3,
16
16
  killOthers: ['failure', 'success'],
17
- }).then(() => {}, () => {});
17
+ }).then(() => { console.log("Done.") }, () => {});
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
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-05-06 00:00:00.000000000 Z
11
+ date: 2020-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '6.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6.0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: addressable
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
68
  version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: faraday_middleware
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: i18n
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +136,20 @@ dependencies:
108
136
  - - "~>"
109
137
  - !ruby/object:Gem::Version
110
138
  version: '4.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: liquid-render-tag
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.2'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.2'
111
153
  - !ruby/object:Gem::Dependency
112
154
  name: listen
113
155
  requirement: !ruby/object:Gem::Requirement
@@ -214,15 +256,22 @@ files:
214
256
  - lib/bridgetown-core/commands/doctor.rb
215
257
  - lib/bridgetown-core/commands/help.rb
216
258
  - lib/bridgetown-core/commands/new.rb
259
+ - lib/bridgetown-core/commands/plugins.rb
217
260
  - lib/bridgetown-core/commands/serve.rb
218
261
  - lib/bridgetown-core/commands/serve/servlet.rb
262
+ - lib/bridgetown-core/concerns/convertible.rb
263
+ - lib/bridgetown-core/concerns/site/configurable.rb
264
+ - lib/bridgetown-core/concerns/site/content.rb
265
+ - lib/bridgetown-core/concerns/site/extensible.rb
266
+ - lib/bridgetown-core/concerns/site/processable.rb
267
+ - lib/bridgetown-core/concerns/site/renderable.rb
268
+ - lib/bridgetown-core/concerns/site/writable.rb
219
269
  - lib/bridgetown-core/configuration.rb
220
270
  - lib/bridgetown-core/converter.rb
221
271
  - lib/bridgetown-core/converters/identity.rb
222
272
  - lib/bridgetown-core/converters/markdown.rb
223
273
  - lib/bridgetown-core/converters/markdown/kramdown_parser.rb
224
274
  - lib/bridgetown-core/converters/smartypants.rb
225
- - lib/bridgetown-core/convertible.rb
226
275
  - lib/bridgetown-core/deprecator.rb
227
276
  - lib/bridgetown-core/document.rb
228
277
  - lib/bridgetown-core/drops/bridgetown_drop.rb
@@ -267,6 +316,7 @@ files:
267
316
  - lib/bridgetown-core/readers/data_reader.rb
268
317
  - lib/bridgetown-core/readers/layout_reader.rb
269
318
  - lib/bridgetown-core/readers/page_reader.rb
319
+ - lib/bridgetown-core/readers/plugin_content_reader.rb
270
320
  - lib/bridgetown-core/readers/post_reader.rb
271
321
  - lib/bridgetown-core/readers/static_file_reader.rb
272
322
  - lib/bridgetown-core/regenerator.rb
@@ -296,7 +346,8 @@ files:
296
346
  - lib/site_template/frontend/javascript/index.js
297
347
  - lib/site_template/frontend/styles/index.scss
298
348
  - lib/site_template/package.json
299
- - lib/site_template/plugins/.keep
349
+ - lib/site_template/plugins/builders/.keep
350
+ - lib/site_template/plugins/site_builder.rb
300
351
  - lib/site_template/src/404.html
301
352
  - lib/site_template/src/_components/.keep
302
353
  - lib/site_template/src/_data/site_metadata.yml
@@ -311,17 +362,18 @@ files:
311
362
  - lib/site_template/src/about.md
312
363
  - lib/site_template/src/favicon.ico
313
364
  - lib/site_template/src/index.md
365
+ - lib/site_template/src/posts.md
314
366
  - lib/site_template/start.js
315
367
  - lib/site_template/sync.js
316
368
  - lib/site_template/webpack.config.js
317
- homepage: https://bridgetownrb.com
369
+ homepage: https://www.bridgetownrb.com
318
370
  licenses:
319
371
  - MIT
320
372
  metadata:
321
373
  source_code_uri: https://github.com/bridgetownrb/bridgetown
322
374
  bug_tracker_uri: https://github.com/bridgetownrb/bridgetown/issues
323
375
  changelog_uri: https://github.com/bridgetownrb/bridgetown/releases
324
- homepage_uri: https://bridgetownrb.com
376
+ homepage_uri: https://www.bridgetownrb.com
325
377
  post_install_message:
326
378
  rdoc_options:
327
379
  - "--charset=UTF-8"