bridgetown-core 2.0.5 → 2.1.0.beta1
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/.rubocop.yml +4 -2
- data/bin/bridgetown +19 -7
- data/bridgetown-core.gemspec +8 -6
- data/lib/bridgetown-core/collection.rb +4 -3
- data/lib/bridgetown-core/command.rb +97 -0
- data/lib/bridgetown-core/commands/application.rb +208 -0
- data/lib/bridgetown-core/commands/apply.rb +17 -29
- data/lib/bridgetown-core/commands/build.rb +9 -16
- data/lib/bridgetown-core/commands/clean.rb +7 -10
- data/lib/bridgetown-core/commands/concerns/{actions.rb → automations.rb} +103 -17
- data/lib/bridgetown-core/commands/concerns/build_options.rb +24 -60
- data/lib/bridgetown-core/commands/concerns/configuration_overridable.rb +2 -4
- data/lib/bridgetown-core/commands/configure.rb +24 -24
- data/lib/bridgetown-core/commands/console.rb +38 -34
- data/lib/bridgetown-core/commands/esbuild.rb +14 -24
- data/lib/bridgetown-core/commands/help.rb +24 -0
- data/lib/bridgetown-core/commands/new.rb +38 -60
- data/lib/bridgetown-core/commands/plugins.rb +237 -211
- data/lib/bridgetown-core/commands/registrations.rb +10 -1
- data/lib/bridgetown-core/commands/start.rb +23 -31
- data/lib/bridgetown-core/commands/thor_shim.rb +94 -0
- data/lib/bridgetown-core/component.rb +3 -3
- data/lib/bridgetown-core/concerns/publishable.rb +1 -3
- data/lib/bridgetown-core/concerns/site/localizable.rb +2 -0
- data/lib/bridgetown-core/configuration/configuration_dsl.rb +2 -2
- data/lib/bridgetown-core/configuration.rb +27 -7
- data/lib/bridgetown-core/converters/erb_templates.rb +31 -21
- data/lib/bridgetown-core/converters/ruby_templates.rb +14 -13
- data/lib/bridgetown-core/converters/serbea_templates.rb +5 -2
- data/lib/bridgetown-core/entry_filter.rb +1 -4
- data/lib/bridgetown-core/front_matter/defaults.rb +1 -1
- data/lib/bridgetown-core/front_matter/importer.rb +7 -1
- data/lib/bridgetown-core/front_matter/loaders.rb +1 -1
- data/lib/bridgetown-core/front_matter/ruby.rb +3 -9
- data/lib/bridgetown-core/generated_page.rb +2 -2
- data/lib/bridgetown-core/generators/prototype_generator.rb +1 -1
- data/lib/bridgetown-core/helpers.rb +10 -11
- data/lib/bridgetown-core/hooks.rb +2 -3
- data/lib/bridgetown-core/locale/en.yml +30 -0
- data/lib/bridgetown-core/model/base.rb +5 -5
- data/lib/bridgetown-core/model/builder_origin.rb +1 -1
- data/lib/bridgetown-core/model/origin.rb +5 -1
- data/lib/bridgetown-core/model/plugin_origin.rb +3 -1
- data/lib/bridgetown-core/model/repo_origin.rb +3 -1
- data/lib/bridgetown-core/rack/routes.rb +1 -1
- data/lib/bridgetown-core/reader.rb +2 -2
- data/lib/bridgetown-core/readers/plugin_content_reader.rb +31 -7
- data/lib/bridgetown-core/resource/base.rb +16 -7
- data/lib/bridgetown-core/resource/destination.rb +1 -1
- data/lib/bridgetown-core/resource/permalink_processor.rb +4 -4
- data/lib/bridgetown-core/static_file.rb +1 -1
- data/lib/bridgetown-core/tags/class_map.rb +0 -2
- data/lib/bridgetown-core/tasks/bridgetown_tasks.rake +8 -11
- data/lib/bridgetown-core/{ruby_template_view.rb → template_view.rb} +108 -4
- data/lib/bridgetown-core/utils/initializers.rb +28 -1
- data/lib/bridgetown-core/utils/loaders_manager.rb +2 -1
- data/lib/bridgetown-core/utils.rb +19 -1
- data/lib/bridgetown-core/watcher.rb +16 -8
- data/lib/bridgetown-core.rb +5 -10
- data/lib/roda/plugins/bridgetown_server.rb +1 -1
- data/lib/site_template/README.md +10 -8
- metadata +84 -70
- data/lib/bridgetown-core/commands/base.rb +0 -123
- data/lib/bridgetown-core/commands/concerns/summarizable.rb +0 -13
- data/lib/bridgetown-core/configurations/.keep +0 -0
- data/lib/bridgetown-core/configurations/stimulus.rb +0 -59
- data/lib/bridgetown-core/configurations/turbo/turbo_transitions.js +0 -48
- data/lib/bridgetown-core/configurations/turbo.rb +0 -35
- data/lib/bridgetown-core/configurations/vercel/vercel.json +0 -45
- data/lib/bridgetown-core/configurations/vercel/vercel_url.rb +0 -12
- data/lib/bridgetown-core/configurations/vercel.rb +0 -4
- data/lib/bridgetown-core/inflector.rb +0 -40
|
@@ -2,53 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
module Bridgetown
|
|
4
4
|
module Commands
|
|
5
|
-
class New <
|
|
6
|
-
include
|
|
5
|
+
class New < Bridgetown::Command
|
|
6
|
+
include Automations
|
|
7
7
|
include GitHelpers
|
|
8
|
-
extend Summarizable
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
using Bridgetown::Refinements
|
|
10
|
+
|
|
11
|
+
self.description = "Creates a new Bridgetown site scaffold in PATH"
|
|
12
|
+
|
|
13
|
+
one :path, "where new Bridgetown site will be created", required: true
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
"
|
|
15
|
+
options do
|
|
16
|
+
option "-a/--apply <PATH|URL>", "Apply an automation after creating the site scaffold"
|
|
17
|
+
option "-c/--configure <CONFIGURATION(S)>",
|
|
18
|
+
"Comma separated list of bundled configurations to perform"
|
|
19
|
+
option "-h/--help", "Print help for the new command"
|
|
20
|
+
option "-t/--templates <erb|serbea|liquid>", "Preferred template engine (defaults to ERB)"
|
|
21
|
+
option "--force", "Force creation even if PATH already exists"
|
|
22
|
+
option "--skip-bundle", "Skip 'bundle install'"
|
|
23
|
+
option "--skip-npm", "Skip 'npm install'"
|
|
24
|
+
option "--use-sass", "Set up a Sass configuration for your stylesheet"
|
|
16
25
|
end
|
|
17
|
-
summary "Creates a new Bridgetown site scaffold in PATH"
|
|
18
|
-
|
|
19
|
-
argument :path,
|
|
20
|
-
type: :string,
|
|
21
|
-
required: false, # we're changing for path in new_site method
|
|
22
|
-
desc: "PATH where new Bridgetown site will be created"
|
|
23
|
-
|
|
24
|
-
class_option :apply,
|
|
25
|
-
aliases: "-a",
|
|
26
|
-
banner: "PATH|URL",
|
|
27
|
-
desc: "Apply an automation after creating the site scaffold"
|
|
28
|
-
class_option :configure,
|
|
29
|
-
aliases: "-c",
|
|
30
|
-
banner: "CONFIGURATION(S)",
|
|
31
|
-
desc: "Comma separated list of bundled configurations to perform"
|
|
32
|
-
class_option :templates,
|
|
33
|
-
aliases: "-t",
|
|
34
|
-
banner: "erb|serbea|liquid",
|
|
35
|
-
desc: "Preferred template engine (defaults to ERB)"
|
|
36
|
-
class_option :"frontend-bundling",
|
|
37
|
-
aliases: "-e",
|
|
38
|
-
banner: "esbuild",
|
|
39
|
-
desc: "Choose frontend bundling stack (defaults to esbuild)"
|
|
40
|
-
class_option :force,
|
|
41
|
-
type: :boolean,
|
|
42
|
-
desc: "Force creation even if PATH already exists"
|
|
43
|
-
class_option :"skip-bundle",
|
|
44
|
-
type: :boolean,
|
|
45
|
-
desc: "Skip 'bundle install'"
|
|
46
|
-
class_option :"skip-npm",
|
|
47
|
-
type: :boolean,
|
|
48
|
-
desc: "Skip 'npm install'"
|
|
49
|
-
class_option :"use-sass",
|
|
50
|
-
type: :boolean,
|
|
51
|
-
desc: "Set up a Sass configuration for your stylesheet"
|
|
52
26
|
|
|
53
27
|
DOCSURL = "https://bridgetownrb.com/docs"
|
|
54
28
|
|
|
@@ -64,8 +38,14 @@ module Bridgetown
|
|
|
64
38
|
attr_accessor :created_site_dir
|
|
65
39
|
end
|
|
66
40
|
|
|
67
|
-
def
|
|
68
|
-
|
|
41
|
+
def call # rubocop:disable Metrics
|
|
42
|
+
case path
|
|
43
|
+
when "--help", "-help", "-h"
|
|
44
|
+
print_usage
|
|
45
|
+
return
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
self.source_paths = [self.class.source_root]
|
|
69
49
|
|
|
70
50
|
new_site_path = File.expand_path(path, Dir.pwd)
|
|
71
51
|
@site_name = new_site_path.split(File::SEPARATOR).last
|
|
@@ -92,7 +72,7 @@ module Bridgetown
|
|
|
92
72
|
protected
|
|
93
73
|
|
|
94
74
|
def preserve_source_location?(path, options)
|
|
95
|
-
!options[
|
|
75
|
+
!options[:force] && Dir.exist?(path)
|
|
96
76
|
end
|
|
97
77
|
|
|
98
78
|
def frontend_bundling_option
|
|
@@ -100,7 +80,7 @@ module Bridgetown
|
|
|
100
80
|
end
|
|
101
81
|
|
|
102
82
|
def postcss_option # rubocop:disable Naming/PredicateMethod
|
|
103
|
-
!options[
|
|
83
|
+
!options[:use_sass]
|
|
104
84
|
end
|
|
105
85
|
|
|
106
86
|
def disable_postcss?
|
|
@@ -108,9 +88,9 @@ module Bridgetown
|
|
|
108
88
|
false
|
|
109
89
|
end
|
|
110
90
|
|
|
111
|
-
def create_site(
|
|
91
|
+
def create_site(new_site_dir) # rubocop:disable Metrics
|
|
112
92
|
directory ".", ".", exclude_pattern: %r!\.erb|TEMPLATES|DS_Store$|\.(s[ac]|c)ss$!
|
|
113
|
-
FileUtils.chmod_R "u+w",
|
|
93
|
+
FileUtils.chmod_R "u+w", new_site_dir
|
|
114
94
|
|
|
115
95
|
template(
|
|
116
96
|
"src/_posts/0000-00-00-welcome-to-bridgetown.md.erb",
|
|
@@ -125,7 +105,7 @@ module Bridgetown
|
|
|
125
105
|
template("src/posts.md.erb", "src/posts.md")
|
|
126
106
|
copy_file("frontend/styles/syntax-highlighting.css")
|
|
127
107
|
|
|
128
|
-
case options[
|
|
108
|
+
case options[:templates]
|
|
129
109
|
when "serbea"
|
|
130
110
|
setup_serbea_templates
|
|
131
111
|
when "liquid"
|
|
@@ -138,7 +118,7 @@ module Bridgetown
|
|
|
138
118
|
|
|
139
119
|
return unless frontend_bundling_option == "esbuild"
|
|
140
120
|
|
|
141
|
-
|
|
121
|
+
Esbuild["setup"].(new_site_dir:)
|
|
142
122
|
end
|
|
143
123
|
|
|
144
124
|
def setup_erb_templates
|
|
@@ -177,19 +157,17 @@ module Bridgetown
|
|
|
177
157
|
# After a new site has been created, print a success notification and
|
|
178
158
|
# then automatically execute bundle install from within the new site dir
|
|
179
159
|
# unless the user opts to skip 'bundle install'.
|
|
180
|
-
# rubocop:
|
|
181
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
|
182
|
-
def after_install(path, cli_path, options)
|
|
160
|
+
def after_install(path, cli_path, options) # rubocop:disable Metrics
|
|
183
161
|
git_init path
|
|
184
162
|
|
|
185
163
|
@skipped_bundle = true # is set to false if bundle install worked
|
|
186
|
-
bundle_install path unless options[
|
|
164
|
+
bundle_install path unless options[:skip_bundle]
|
|
187
165
|
|
|
188
166
|
@skipped_npm = true
|
|
189
|
-
npm_install path unless options[
|
|
167
|
+
npm_install path unless options[:skip_npm]
|
|
190
168
|
|
|
191
|
-
|
|
192
|
-
|
|
169
|
+
Apply[options[:apply]].(new_site_dir: path) if options[:apply]
|
|
170
|
+
Configure[*options[:configure].split(",")].(new_site_dir: path) if options[:configure]
|
|
193
171
|
|
|
194
172
|
logger = Bridgetown.logger
|
|
195
173
|
bt_start = "bin/bridgetown start"
|
|
@@ -214,8 +192,6 @@ module Bridgetown
|
|
|
214
192
|
|
|
215
193
|
logger.info "NPM install skipped.".yellow if @skipped_npm
|
|
216
194
|
end
|
|
217
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
218
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
|
219
195
|
|
|
220
196
|
def bundle_install(path)
|
|
221
197
|
unless Bridgetown.environment.test?
|
|
@@ -256,5 +232,7 @@ module Bridgetown
|
|
|
256
232
|
say_status :alert, "Could not load npm. NPM install skipped.", :red
|
|
257
233
|
end
|
|
258
234
|
end
|
|
235
|
+
|
|
236
|
+
register_command :new, New
|
|
259
237
|
end
|
|
260
238
|
end
|