bridgetown-core 0.13.0 → 0.15.0.beta3
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 +4 -4
- data/Rakefile +3 -1
- data/bin/bridgetown +9 -48
- data/bridgetown-core.gemspec +6 -2
- data/lib/bridgetown-core.rb +13 -3
- data/lib/bridgetown-core/cleaner.rb +1 -0
- data/lib/bridgetown-core/commands/apply.rb +73 -0
- data/lib/bridgetown-core/commands/base.rb +45 -0
- data/lib/bridgetown-core/commands/build.rb +91 -86
- data/lib/bridgetown-core/commands/clean.rb +30 -29
- data/lib/bridgetown-core/commands/concerns/actions.rb +123 -0
- data/lib/bridgetown-core/commands/concerns/build_options.rb +76 -0
- data/lib/bridgetown-core/commands/concerns/configuration_overridable.rb +18 -0
- data/lib/bridgetown-core/commands/concerns/summarizable.rb +13 -0
- data/lib/bridgetown-core/commands/console.rb +46 -39
- data/lib/bridgetown-core/commands/doctor.rb +126 -127
- data/lib/bridgetown-core/commands/new.rb +120 -158
- data/lib/bridgetown-core/commands/plugins.rb +206 -0
- data/lib/bridgetown-core/commands/registrations.rb +16 -0
- data/lib/bridgetown-core/commands/serve.rb +214 -215
- data/lib/bridgetown-core/{convertible.rb → concerns/convertible.rb} +3 -6
- data/lib/bridgetown-core/concerns/site/configurable.rb +153 -0
- data/lib/bridgetown-core/concerns/site/content.rb +111 -0
- data/lib/bridgetown-core/concerns/site/extensible.rb +56 -0
- data/lib/bridgetown-core/concerns/site/processable.rb +74 -0
- data/lib/bridgetown-core/concerns/site/renderable.rb +49 -0
- data/lib/bridgetown-core/concerns/site/writable.rb +31 -0
- data/lib/bridgetown-core/configuration.rb +2 -9
- data/lib/bridgetown-core/converters/markdown/kramdown_parser.rb +0 -3
- data/lib/bridgetown-core/document.rb +1 -1
- data/lib/bridgetown-core/drops/page_drop.rb +1 -1
- data/lib/bridgetown-core/drops/site_drop.rb +1 -1
- data/lib/bridgetown-core/excerpt.rb +4 -1
- data/lib/bridgetown-core/external.rb +17 -21
- data/lib/bridgetown-core/filters.rb +10 -0
- data/lib/bridgetown-core/generators/prototype_generator.rb +3 -1
- data/lib/bridgetown-core/hooks.rb +62 -62
- data/lib/bridgetown-core/layout.rb +10 -4
- data/lib/bridgetown-core/liquid_renderer.rb +1 -0
- data/lib/bridgetown-core/liquid_renderer/file.rb +1 -4
- data/lib/bridgetown-core/liquid_renderer/file_system.rb +3 -1
- data/lib/bridgetown-core/page.rb +11 -19
- data/lib/bridgetown-core/plugin.rb +2 -0
- data/lib/bridgetown-core/plugin_manager.rb +88 -21
- data/lib/bridgetown-core/reader.rb +5 -0
- data/lib/bridgetown-core/readers/data_reader.rb +5 -2
- data/lib/bridgetown-core/readers/layout_reader.rb +9 -2
- data/lib/bridgetown-core/readers/plugin_content_reader.rb +48 -0
- data/lib/bridgetown-core/renderer.rb +38 -28
- data/lib/bridgetown-core/site.rb +20 -463
- data/lib/bridgetown-core/tags/include.rb +12 -0
- data/lib/bridgetown-core/tags/render_content.rb +29 -16
- data/lib/bridgetown-core/tags/with.rb +15 -0
- data/lib/bridgetown-core/utils.rb +45 -27
- data/lib/bridgetown-core/utils/ruby_exec.rb +1 -4
- data/lib/bridgetown-core/version.rb +2 -2
- data/lib/bridgetown-core/watcher.rb +21 -10
- data/lib/site_template/Gemfile.erb +19 -0
- data/lib/site_template/package.json +1 -0
- data/lib/site_template/plugins/{.keep → builders/.keep} +0 -0
- data/lib/site_template/plugins/site_builder.rb +4 -0
- data/lib/site_template/src/_components/footer.html +3 -0
- data/lib/site_template/src/_components/head.html +9 -0
- data/lib/site_template/src/{_includes → _components}/navbar.html +1 -0
- data/lib/site_template/src/_layouts/default.html +3 -3
- data/lib/site_template/src/posts.md +15 -0
- data/lib/site_template/start.js +1 -1
- data/lib/site_template/webpack.config.js +3 -3
- metadata +90 -18
- data/lib/bridgetown-core/command.rb +0 -106
- data/lib/bridgetown-core/commands/help.rb +0 -34
- data/lib/site_template/src/_components/.keep +0 -0
- data/lib/site_template/src/_includes/footer.html +0 -3
- data/lib/site_template/src/_includes/head.html +0 -9
@@ -1,106 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Bridgetown
|
4
|
-
class Command
|
5
|
-
class << self
|
6
|
-
# A list of subclasses of Bridgetown::Command
|
7
|
-
def subclasses
|
8
|
-
@subclasses ||= []
|
9
|
-
end
|
10
|
-
|
11
|
-
# Keep a list of subclasses of Bridgetown::Command every time it's inherited
|
12
|
-
# Called automatically.
|
13
|
-
#
|
14
|
-
# base - the subclass
|
15
|
-
#
|
16
|
-
# Returns nothing
|
17
|
-
def inherited(base)
|
18
|
-
subclasses << base
|
19
|
-
super(base)
|
20
|
-
end
|
21
|
-
|
22
|
-
# Run Site#process and catch errors
|
23
|
-
#
|
24
|
-
# site - the Bridgetown::Site object
|
25
|
-
#
|
26
|
-
# Returns nothing
|
27
|
-
def process_site(site)
|
28
|
-
site.process
|
29
|
-
rescue Bridgetown::Errors::FatalException => e
|
30
|
-
Bridgetown.logger.error "ERROR:", "YOUR SITE COULD NOT BE BUILT:"
|
31
|
-
Bridgetown.logger.error "", "------------------------------------"
|
32
|
-
Bridgetown.logger.error "", e.message
|
33
|
-
exit(1)
|
34
|
-
end
|
35
|
-
|
36
|
-
# Create a full Bridgetown configuration with the options passed in as overrides
|
37
|
-
#
|
38
|
-
# options - the configuration overrides
|
39
|
-
#
|
40
|
-
# Returns a full Bridgetown configuration
|
41
|
-
def configuration_from_options(options)
|
42
|
-
return options if options.is_a?(Bridgetown::Configuration)
|
43
|
-
|
44
|
-
Bridgetown.configuration(options)
|
45
|
-
end
|
46
|
-
|
47
|
-
# Add common options to a command for building configuration
|
48
|
-
#
|
49
|
-
# cmd - the Bridgetown::Command to add these options to
|
50
|
-
#
|
51
|
-
# Returns nothing
|
52
|
-
# rubocop:disable Metrics/MethodLength
|
53
|
-
def add_build_options(cmd)
|
54
|
-
cmd.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]",
|
55
|
-
Array, "Custom configuration file"
|
56
|
-
cmd.option "destination", "-d", "--destination DESTINATION",
|
57
|
-
"The current folder will be generated into DESTINATION"
|
58
|
-
cmd.option "root_dir", "-r", "--root_dir ROOT_DIR", "The top-level root folder" \
|
59
|
-
" where config files are located"
|
60
|
-
cmd.option "source", "-s", "--source SOURCE", "Custom source directory"
|
61
|
-
cmd.option "future", "--future", "Publishes posts with a future date"
|
62
|
-
cmd.option "limit_posts", "--limit_posts MAX_POSTS", Integer,
|
63
|
-
"Limits the number of posts to parse and publish"
|
64
|
-
cmd.option "watch", "-w", "--[no-]watch", "Watch for changes and rebuild"
|
65
|
-
cmd.option "baseurl", "-b", "--baseurl URL",
|
66
|
-
"Serve the website from the given base URL"
|
67
|
-
cmd.option "force_polling", "--force_polling", "Force watch to use polling"
|
68
|
-
cmd.option "lsi", "--lsi", "Use LSI for improved related posts"
|
69
|
-
cmd.option "unpublished", "-U", "--unpublished",
|
70
|
-
"Render posts that were marked as unpublished"
|
71
|
-
cmd.option "disable_disk_cache", "--disable-disk-cache",
|
72
|
-
"Disable caching to disk"
|
73
|
-
cmd.option "quiet", "-q", "--quiet", "Silence output."
|
74
|
-
cmd.option "verbose", "-V", "--verbose", "Print verbose output."
|
75
|
-
cmd.option "incremental", "-I", "--incremental", "Enable incremental rebuild."
|
76
|
-
cmd.option "strict_front_matter", "--strict_front_matter",
|
77
|
-
"Fail if errors are present in front matter"
|
78
|
-
end
|
79
|
-
# rubocop:enable Metrics/MethodLength
|
80
|
-
|
81
|
-
# Run ::process method in a given set of Bridgetown::Command subclasses and suggest
|
82
|
-
# re-running the associated command with --trace switch to obtain any additional
|
83
|
-
# information or backtrace regarding the encountered Exception.
|
84
|
-
#
|
85
|
-
# cmd - the Bridgetown::Command to be handled
|
86
|
-
# options - configuration overrides
|
87
|
-
# klass - an array of Bridgetown::Command subclasses associated with the command
|
88
|
-
#
|
89
|
-
# Note that all exceptions are rescued..
|
90
|
-
# rubocop: disable Lint/RescueException
|
91
|
-
def process_with_graceful_fail(cmd, options, *klass)
|
92
|
-
klass.each { |k| k.process(options) if k.respond_to?(:process) }
|
93
|
-
rescue Exception => e
|
94
|
-
raise e if cmd.trace
|
95
|
-
|
96
|
-
msg = " Please append `--trace` to the `#{cmd.name}` command "
|
97
|
-
dashes = "-" * msg.length
|
98
|
-
Bridgetown.logger.error "", dashes
|
99
|
-
Bridgetown.logger.error "Bridgetown #{Bridgetown::VERSION} ", msg
|
100
|
-
Bridgetown.logger.error "", " for any additional information or backtrace. "
|
101
|
-
Bridgetown.logger.abort_with "", dashes
|
102
|
-
end
|
103
|
-
# rubocop: enable Lint/RescueException
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Bridgetown
|
4
|
-
module Commands
|
5
|
-
class Help < Command
|
6
|
-
class << self
|
7
|
-
def init_with_program(prog)
|
8
|
-
prog.command(:help) do |c|
|
9
|
-
c.syntax "help [subcommand]"
|
10
|
-
c.description "Show the help message, optionally for a given subcommand."
|
11
|
-
|
12
|
-
c.action do |args, _|
|
13
|
-
cmd = (args.first || "").to_sym
|
14
|
-
if args.empty?
|
15
|
-
Bridgetown.logger.info prog.to_s
|
16
|
-
elsif prog.has_command? cmd
|
17
|
-
Bridgetown.logger.info prog.commands[cmd].to_s
|
18
|
-
else
|
19
|
-
invalid_command(prog, cmd)
|
20
|
-
abort
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def invalid_command(prog, cmd)
|
27
|
-
Bridgetown.logger.error "Error:",
|
28
|
-
"Hmm... we don't know what the '#{cmd}' command is."
|
29
|
-
Bridgetown.logger.info "Valid commands:", prog.commands.keys.join(", ")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
File without changes
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<meta charset="utf-8" />
|
2
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
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>
|
5
|
-
|
6
|
-
<meta name="description" content="{{ site.metadata.description }}" />
|
7
|
-
|
8
|
-
<link rel="stylesheet" href="{% webpack_path css %}" />
|
9
|
-
<script src="{% webpack_path js %}" defer></script>
|