bridgetown-core 0.14.1 → 0.15.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -1
  3. data/bin/bridgetown +9 -23
  4. data/bridgetown-core.gemspec +2 -1
  5. data/lib/bridgetown-core.rb +9 -2
  6. data/lib/bridgetown-core/commands/apply.rb +73 -0
  7. data/lib/bridgetown-core/commands/base.rb +45 -0
  8. data/lib/bridgetown-core/commands/build.rb +91 -86
  9. data/lib/bridgetown-core/commands/clean.rb +30 -29
  10. data/lib/bridgetown-core/commands/concerns/actions.rb +95 -0
  11. data/lib/bridgetown-core/commands/concerns/build_options.rb +76 -0
  12. data/lib/bridgetown-core/commands/concerns/configuration_overridable.rb +18 -0
  13. data/lib/bridgetown-core/commands/concerns/summarizable.rb +13 -0
  14. data/lib/bridgetown-core/commands/console.rb +46 -38
  15. data/lib/bridgetown-core/commands/doctor.rb +126 -126
  16. data/lib/bridgetown-core/commands/new.rb +120 -155
  17. data/lib/bridgetown-core/commands/plugins.rb +167 -130
  18. data/lib/bridgetown-core/commands/registrations.rb +16 -0
  19. data/lib/bridgetown-core/commands/serve.rb +214 -215
  20. data/lib/bridgetown-core/generators/prototype_generator.rb +2 -0
  21. data/lib/bridgetown-core/liquid_renderer.rb +1 -0
  22. data/lib/bridgetown-core/liquid_renderer/file_system.rb +3 -1
  23. data/lib/bridgetown-core/plugin_manager.rb +4 -4
  24. data/lib/bridgetown-core/renderer.rb +28 -15
  25. data/lib/bridgetown-core/tags/include.rb +12 -0
  26. data/lib/bridgetown-core/tags/render_content.rb +27 -16
  27. data/lib/bridgetown-core/tags/with.rb +15 -0
  28. data/lib/bridgetown-core/version.rb +2 -2
  29. data/lib/bridgetown-core/watcher.rb +17 -10
  30. data/lib/site_template/Gemfile.erb +19 -0
  31. data/lib/site_template/src/_components/footer.html +3 -0
  32. data/lib/site_template/src/_components/head.html +9 -0
  33. data/lib/site_template/src/{_includes → _components}/navbar.html +0 -0
  34. data/lib/site_template/src/_layouts/default.html +3 -3
  35. data/lib/site_template/start.js +1 -1
  36. metadata +39 -19
  37. data/lib/bridgetown-core/command.rb +0 -112
  38. data/lib/bridgetown-core/commands/help.rb +0 -34
  39. data/lib/site_template/src/_components/.keep +0 -0
  40. data/lib/site_template/src/_includes/footer.html +0 -3
  41. data/lib/site_template/src/_includes/head.html +0 -9
@@ -1,112 +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 "source", "-s", "--source [DIR]",
57
- "Source directory (defaults to src)"
58
- cmd.option "destination", "-d", "--destination [DIR]",
59
- "Destination directory (defaults to output)"
60
- cmd.option "root_dir", "-r", "--root_dir [DIR]", "The top-level root folder" \
61
- " where config files are located"
62
- cmd.option "plugins_dir", "-p", "--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]", Array,
63
- "Plugins directory (defaults to plugins)"
64
- cmd.option "layouts_dir", "--layouts [DIR]", String,
65
- "Layouts directory (defaults to src/_layouts)"
66
- cmd.option "future", "--future", "Publishes posts with a future date"
67
- cmd.option "limit_posts", "--limit_posts MAX_POSTS", Integer,
68
- "Limits the number of posts to parse and publish"
69
- cmd.option "watch", "-w", "--[no-]watch", "Watch for changes and rebuild"
70
- cmd.option "baseurl", "-b", "--baseurl URL",
71
- "Serve the website from the given base URL"
72
- cmd.option "force_polling", "--force_polling", "Force watch to use polling"
73
- cmd.option "lsi", "--lsi", "Use LSI for improved related posts"
74
- cmd.option "unpublished", "-U", "--unpublished",
75
- "Render posts that were marked as unpublished"
76
- cmd.option "disable_disk_cache", "--disable-disk-cache",
77
- "Disable caching to disk"
78
- cmd.option "profile", "--profile", "Generate a Liquid rendering profile"
79
- cmd.option "quiet", "-q", "--quiet", "Silence output."
80
- cmd.option "verbose", "-V", "--verbose", "Print verbose output."
81
- cmd.option "incremental", "-I", "--incremental", "Enable incremental rebuild."
82
- cmd.option "strict_front_matter", "--strict_front_matter",
83
- "Fail if errors are present in front matter"
84
- end
85
- # rubocop:enable Metrics/MethodLength
86
-
87
- # Run ::process method in a given set of Bridgetown::Command subclasses and suggest
88
- # re-running the associated command with --trace switch to obtain any additional
89
- # information or backtrace regarding the encountered Exception.
90
- #
91
- # cmd - the Bridgetown::Command to be handled
92
- # options - configuration overrides
93
- # klass - an array of Bridgetown::Command subclasses associated with the command
94
- #
95
- # Note that all exceptions are rescued..
96
- # rubocop: disable Lint/RescueException
97
- def process_with_graceful_fail(cmd, options, *klass)
98
- klass.each { |k| k.process(options) if k.respond_to?(:process) }
99
- rescue Exception => e
100
- raise e if cmd.trace
101
-
102
- msg = " Please append `--trace` to the `#{cmd.name}` command "
103
- dashes = "-" * msg.length
104
- Bridgetown.logger.error "", dashes
105
- Bridgetown.logger.error "Bridgetown #{Bridgetown::VERSION} ", msg
106
- Bridgetown.logger.error "", " for any additional information or backtrace. "
107
- Bridgetown.logger.abort_with "", dashes
108
- end
109
- # rubocop: enable Lint/RescueException
110
- end
111
- end
112
- 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,3 +0,0 @@
1
- <footer>
2
- Contact me at {{ site.metadata.email }}
3
- </footer>
@@ -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>