bridgetown-core 1.2.0.beta4 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bridgetown-core.gemspec +0 -1
- data/lib/bridgetown-core/collection.rb +1 -1
- data/lib/bridgetown-core/commands/concerns/actions.rb +5 -4
- data/lib/bridgetown-core/commands/plugins.rb +19 -13
- data/lib/bridgetown-core/commands/start.rb +1 -0
- data/lib/bridgetown-core/concerns/front_matter_importer.rb +2 -2
- data/lib/bridgetown-core/concerns/localizable.rb +5 -1
- data/lib/bridgetown-core/configuration/configuration_dsl.rb +6 -2
- data/lib/bridgetown-core/configuration.rb +7 -4
- data/lib/bridgetown-core/drops/static_file_drop.rb +1 -1
- data/lib/bridgetown-core/helpers.rb +1 -1
- data/lib/bridgetown-core/liquid_renderer/table.rb +3 -1
- data/lib/bridgetown-core/model/repo_origin.rb +2 -2
- data/lib/bridgetown-core/plugin_manager.rb +2 -1
- data/lib/bridgetown-core/rack/static_indexes.rb +4 -4
- data/lib/bridgetown-core/resource/base.rb +1 -1
- data/lib/bridgetown-core/static_file.rb +6 -4
- data/lib/bridgetown-core/utils/ruby_front_matter.rb +2 -2
- data/lib/bridgetown-core/version.rb +1 -1
- data/lib/bridgetown-core.rb +43 -0
- data/lib/site_template/config/puma.rb +4 -0
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 599f0ff57d4bac2146e5cacb12ccb8f2e7e02026815447c2db9cbf914ed9d3a2
|
4
|
+
data.tar.gz: be29cede2daa248b4db41bb6a7eaeebb7d3533b54a5cf891922b0762a6ca47e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 739ed852e60fabf0b6b2d352c8ce8993d4751a1f6cfec67c0bb7ed4cc5f0af41bb82fb8dc3eb34f5806a421bcec38e9050cd0fbcb50249a0482f5804e19a1d27
|
7
|
+
data.tar.gz: 97eea9cb28095624a8d47821f754df39790d8db46e62d79774371113c875fd914a796f3e445ad982e6f8de8e94d5babf7b8be1736c4bc93f3a9fe0a0f6862433
|
data/bridgetown-core.gemspec
CHANGED
@@ -49,7 +49,6 @@ Gem::Specification.new do |s|
|
|
49
49
|
s.add_runtime_dependency("roda", "~> 3.46")
|
50
50
|
s.add_runtime_dependency("rouge", "~> 3.0")
|
51
51
|
s.add_runtime_dependency("serbea", "~> 1.0")
|
52
|
-
s.add_runtime_dependency("terminal-table", "~> 1.8")
|
53
52
|
s.add_runtime_dependency("thor", "~> 1.1")
|
54
53
|
s.add_runtime_dependency("tilt", "~> 2.0")
|
55
54
|
s.add_runtime_dependency("webrick", "~> 1.7")
|
@@ -27,7 +27,7 @@ module Bridgetown
|
|
27
27
|
|
28
28
|
def javascript_import(data = nil, filename: "index.js") # rubocop:todo Metrics/PerceivedComplexity
|
29
29
|
data ||= yield if block_given?
|
30
|
-
data += "\n" unless data
|
30
|
+
data += "\n" unless data[-1] == "\n"
|
31
31
|
|
32
32
|
say_status :javascript_import, filename
|
33
33
|
|
@@ -56,8 +56,9 @@ module Bridgetown
|
|
56
56
|
options = +""
|
57
57
|
options += " -v \"#{version}\"" if version
|
58
58
|
options += " -g #{group}" if group
|
59
|
+
# in_bundle? returns the path to the gemfile
|
59
60
|
run "bundle add #{gemname}#{options}",
|
60
|
-
env: { "BUNDLE_GEMFILE" =>
|
61
|
+
env: { "BUNDLE_GEMFILE" => Bundler::SharedHelpers.in_bundle? }
|
61
62
|
rescue SystemExit
|
62
63
|
say_status :run, "Gem not added due to bundler error", :red
|
63
64
|
end
|
@@ -68,7 +69,7 @@ module Bridgetown
|
|
68
69
|
data = yield if block_given?
|
69
70
|
data = data.indent(2).lstrip
|
70
71
|
data = " #{data}" unless data.start_with?(",")
|
71
|
-
data += "\n" unless data
|
72
|
+
data += "\n" unless data[-1] == "\n"
|
72
73
|
|
73
74
|
init_file = File.join("config", "initializers.rb")
|
74
75
|
unless File.exist?(init_file)
|
@@ -85,7 +86,7 @@ module Bridgetown
|
|
85
86
|
say_status :configure, name
|
86
87
|
data = yield if block_given?
|
87
88
|
data = data.indent(2)
|
88
|
-
data += "\n" unless data
|
89
|
+
data += "\n" unless data[-1] == "\n"
|
89
90
|
|
90
91
|
init_file = File.join("config", "initializers.rb")
|
91
92
|
unless File.exist?(init_file)
|
@@ -126,7 +126,7 @@ module Bridgetown
|
|
126
126
|
Layouts, you'd run:\n
|
127
127
|
bridgetown plugins cd SamplePlugin/Layouts
|
128
128
|
DOC
|
129
|
-
desc "cd <origin/dir>", "Open
|
129
|
+
desc "cd <origin/dir>", "Open content folder within the plugin origin"
|
130
130
|
|
131
131
|
# This is super useful if you want to copy files out of plugins to override.
|
132
132
|
#
|
@@ -177,38 +177,43 @@ module Bridgetown
|
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
180
|
-
desc "new NAME", "Create a new plugin NAME
|
180
|
+
desc "new NAME", "Create a new plugin NAME (snake_case_name_preferred)"
|
181
181
|
def new(name)
|
182
182
|
folder_name = name.underscore
|
183
183
|
module_name = folder_name.camelize
|
184
184
|
|
185
|
-
run "git clone
|
186
|
-
new_gemspec = "#{
|
185
|
+
run "git clone https://github.com/bridgetownrb/bridgetown-sample-plugin #{name}"
|
186
|
+
new_gemspec = "#{folder_name}.gemspec"
|
187
187
|
|
188
188
|
inside name do # rubocop:todo Metrics/BlockLength
|
189
189
|
destroy_existing_repo
|
190
190
|
initialize_new_repo
|
191
191
|
|
192
|
-
FileUtils.mv "
|
192
|
+
FileUtils.mv "sample_plugin.gemspec", new_gemspec
|
193
193
|
gsub_file new_gemspec, "https://github.com/bridgetownrb/bridgetown-sample-plugin", "https://github.com/username/#{name}"
|
194
194
|
gsub_file new_gemspec, "bridgetown-sample-plugin", name
|
195
|
-
gsub_file new_gemspec, "
|
195
|
+
gsub_file new_gemspec, "sample_plugin", folder_name
|
196
196
|
gsub_file new_gemspec, "SamplePlugin", module_name
|
197
197
|
|
198
198
|
gsub_file "package.json", "https://github.com/bridgetownrb/bridgetown-sample-plugin", "https://github.com/username/#{name}"
|
199
199
|
gsub_file "package.json", "bridgetown-sample-plugin", name
|
200
|
+
gsub_file "package.json", "sample_plugin", folder_name
|
200
201
|
|
201
202
|
FileUtils.mv "lib/sample_plugin.rb", "lib/#{folder_name}.rb"
|
202
|
-
gsub_file "lib/#{
|
203
|
-
gsub_file "lib/#{
|
203
|
+
gsub_file "lib/#{folder_name}.rb", "sample_plugin", folder_name
|
204
|
+
gsub_file "lib/#{folder_name}.rb", "SamplePlugin", module_name
|
204
205
|
|
205
206
|
FileUtils.mv "lib/sample_plugin", "lib/#{folder_name}"
|
206
|
-
gsub_file "lib/#{
|
207
|
-
gsub_file "lib/#{
|
207
|
+
gsub_file "lib/#{folder_name}/builder.rb", "SamplePlugin", module_name
|
208
|
+
gsub_file "lib/#{folder_name}/builder.rb", "sample_plugin", folder_name
|
209
|
+
gsub_file "lib/#{folder_name}/version.rb", "SamplePlugin", module_name
|
208
210
|
|
209
211
|
FileUtils.mv "test/test_sample_plugin.rb", "test/test_#{folder_name}.rb"
|
210
212
|
gsub_file "test/test_#{folder_name}.rb", "SamplePlugin", module_name
|
211
|
-
gsub_file "test/
|
213
|
+
gsub_file "test/test_#{folder_name}.rb", "sample plugin", module_name
|
214
|
+
gsub_file "test/helper.rb", "sample_plugin", folder_name
|
215
|
+
gsub_file "test/fixtures/src/index.html", "sample_plugin", folder_name
|
216
|
+
gsub_file "test/fixtures/config/initializers.rb", "sample_plugin", folder_name
|
212
217
|
|
213
218
|
FileUtils.mv "components/sample_plugin", "components/#{folder_name}"
|
214
219
|
FileUtils.mv "content/sample_plugin", "content/#{folder_name}"
|
@@ -220,14 +225,15 @@ module Bridgetown
|
|
220
225
|
|
221
226
|
gsub_file "components/#{folder_name}/plugin_component.rb", "SamplePlugin", module_name
|
222
227
|
|
223
|
-
gsub_file "frontend/javascript/index.js", "
|
228
|
+
gsub_file "frontend/javascript/index.js", "sample_plugin", folder_name
|
224
229
|
gsub_file "frontend/javascript/index.js", "SamplePlugin", module_name
|
230
|
+
gsub_file "frontend/styles/index.css", "sample_plugin", folder_name
|
225
231
|
end
|
226
232
|
say ""
|
227
233
|
say_status "Done!", "Have fun writing your new #{name} plugin :)"
|
228
234
|
say_status "Remember:", "Don't forget to rename the SamplePlugin" \
|
229
235
|
" code identifiers and paths to your own" \
|
230
|
-
"
|
236
|
+
" identifier, as well as update your README" \
|
231
237
|
" and CHANGELOG files as necessary."
|
232
238
|
end
|
233
239
|
|
@@ -42,6 +42,7 @@ module Bridgetown
|
|
42
42
|
# Load Bridgetown configuration into thread memory
|
43
43
|
bt_options = configuration_with_overrides(options)
|
44
44
|
|
45
|
+
# Set a local site URL in the config if one is not available
|
45
46
|
if Bridgetown.env.development? && !options["url"]
|
46
47
|
scheme = bt_options.bind&.split("://")&.first == "ssl" ? "https" : "http"
|
47
48
|
port = bt_options.bind&.split(":")&.last || ENV["BRIDGETOWN_PORT"] || 4000
|
@@ -9,9 +9,9 @@ module Bridgetown
|
|
9
9
|
|
10
10
|
YAML_HEADER = %r!\A---\s*\n!.freeze
|
11
11
|
YAML_BLOCK = %r!\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)!m.freeze
|
12
|
-
RUBY_HEADER = %r!\A[
|
12
|
+
RUBY_HEADER = %r!\A[~`#-]{3,}(?:ruby|<%|{%)\s*\n!.freeze
|
13
13
|
RUBY_BLOCK =
|
14
|
-
%r!#{RUBY_HEADER.source}(.*?\n?)^((?:%>|%})?[
|
14
|
+
%r!#{RUBY_HEADER.source}(.*?\n?)^((?:%>|%})?[~`#-]{3,}\s*$\n?)!m.freeze
|
15
15
|
|
16
16
|
def read_front_matter(file_path) # rubocop:todo Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
|
17
17
|
file_contents = File.read(
|
@@ -12,7 +12,11 @@ module Bridgetown
|
|
12
12
|
[]
|
13
13
|
end
|
14
14
|
|
15
|
-
result_set.select
|
15
|
+
matching_resources = result_set.select do |item|
|
16
|
+
item.relative_path.parent == relative_path.parent && item.data.slug == data.slug
|
17
|
+
end
|
18
|
+
|
19
|
+
matching_resources.sort_by do |item|
|
16
20
|
site.config.available_locales.index item.data.locale
|
17
21
|
end
|
18
22
|
end
|
@@ -72,8 +72,12 @@ module Bridgetown
|
|
72
72
|
@scope.roda_initializers << block
|
73
73
|
end
|
74
74
|
|
75
|
+
def timezone(tz) # rubocop:disable Naming/MethodParameterName
|
76
|
+
Bridgetown.set_timezone(tz)
|
77
|
+
end
|
78
|
+
|
75
79
|
def method_missing(key, *value, &block) # rubocop:disable Style/MissingRespondToMissing
|
76
|
-
return get(key) if value.
|
80
|
+
return get(key) if value.empty? && block.nil?
|
77
81
|
|
78
82
|
set(key, value[0], &block)
|
79
83
|
end
|
@@ -132,7 +136,7 @@ module Bridgetown
|
|
132
136
|
|
133
137
|
if require_initializer
|
134
138
|
init_file_name = File.join(@scope.root_dir, "config", "#{name}.rb")
|
135
|
-
|
139
|
+
load(init_file_name) if File.exist?(init_file_name)
|
136
140
|
end
|
137
141
|
|
138
142
|
@scope.initializers[name.to_sym]
|
@@ -130,11 +130,11 @@ module Bridgetown
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
-
def run_initializers!(context:)
|
133
|
+
def run_initializers!(context:) # rubocop:todo Metrics/AbcSize, Metrics/CyclomaticComplexity
|
134
134
|
initializers_file = File.join(root_dir, "config", "initializers.rb")
|
135
135
|
return unless File.file?(initializers_file)
|
136
136
|
|
137
|
-
|
137
|
+
load initializers_file
|
138
138
|
|
139
139
|
return unless initializers # no initializers have been set up
|
140
140
|
|
@@ -144,9 +144,11 @@ module Bridgetown
|
|
144
144
|
Bridgetown.logger.debug "Initializing:", "Running initializers with `#{context}' context in:"
|
145
145
|
Bridgetown.logger.debug "", initializers_file
|
146
146
|
self.init_params = {}
|
147
|
+
cached_url = url&.include?("//localhost") ? url : nil
|
147
148
|
dsl = ConfigurationDSL.new(scope: self, data: self)
|
148
149
|
dsl.instance_variable_set(:@context, context)
|
149
150
|
dsl.instance_exec(dsl, &init_init.block)
|
151
|
+
self.url = cached_url if cached_url # restore local development URL if need be
|
150
152
|
|
151
153
|
setup_load_paths! appending: true
|
152
154
|
|
@@ -308,7 +310,8 @@ module Bridgetown
|
|
308
310
|
next_config
|
309
311
|
rescue SystemCallError
|
310
312
|
if @default_config_file ||= nil
|
311
|
-
|
313
|
+
initializers_file = File.join(root_dir, "config", "initializers.rb")
|
314
|
+
Bridgetown.logger.warn "Configuration file:", "none" unless File.file?(initializers_file)
|
312
315
|
{}
|
313
316
|
else
|
314
317
|
Bridgetown.logger.error "Fatal:", "The configuration file '#{file}' could not be found."
|
@@ -400,7 +403,7 @@ module Bridgetown
|
|
400
403
|
|
401
404
|
DEFAULT_EXCLUDES = %w(
|
402
405
|
.sass-cache .bridgetown-cache
|
403
|
-
gemfiles Gemfile Gemfile.lock
|
406
|
+
gemfiles Gemfile Gemfile.lock gems.rb gems.locked
|
404
407
|
node_modules
|
405
408
|
vendor/bundle/ vendor/cache/ vendor/gems/ vendor/ruby/
|
406
409
|
).freeze
|
@@ -4,7 +4,7 @@ module Bridgetown
|
|
4
4
|
module Drops
|
5
5
|
class StaticFileDrop < Drop
|
6
6
|
extend Forwardable
|
7
|
-
def_delegators :@obj, :name, :extname, :modified_time, :basename
|
7
|
+
def_delegators :@obj, :name, :extname, :date, :modified_time, :basename
|
8
8
|
def_delegator :@obj, :relative_path, :path
|
9
9
|
def_delegator :@obj, :type, :collection
|
10
10
|
|
@@ -59,7 +59,7 @@ module Bridgetown
|
|
59
59
|
# `url` or `relative_url`
|
60
60
|
# @return [String] the permalink URL for the file
|
61
61
|
def url_for(relative_path)
|
62
|
-
if relative_path.respond_to?(:relative_url)
|
62
|
+
if relative_path.respond_to?(:relative_url)
|
63
63
|
return safe(relative_path.relative_url) # new resource engine
|
64
64
|
elsif relative_path.respond_to?(:url)
|
65
65
|
return safe(relative_url(relative_path.url)) # old legacy engine
|
@@ -7,9 +7,9 @@ module Bridgetown
|
|
7
7
|
include Bridgetown::Utils::RubyFrontMatterDSL
|
8
8
|
|
9
9
|
YAML_FRONT_MATTER_REGEXP = %r!\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)!m.freeze
|
10
|
-
RUBY_FRONT_MATTER_HEADER = %r!\A[
|
10
|
+
RUBY_FRONT_MATTER_HEADER = %r!\A[~`#-]{3,}(?:ruby|<%|{%)\s*\n!.freeze
|
11
11
|
RUBY_FRONT_MATTER_REGEXP =
|
12
|
-
%r!#{RUBY_FRONT_MATTER_HEADER.source}(.*?\n?)^((?:%>|%})?[
|
12
|
+
%r!#{RUBY_FRONT_MATTER_HEADER.source}(.*?\n?)^((?:%>|%})?[~`#-]{3,}\s*$\n?)!m.freeze
|
13
13
|
|
14
14
|
# @return [String]
|
15
15
|
attr_accessor :content
|
@@ -61,7 +61,8 @@ module Bridgetown
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def self.setup_bundler(skip_yarn: false)
|
64
|
-
if !ENV["BRIDGETOWN_NO_BUNDLER_REQUIRE"] &&
|
64
|
+
if !ENV["BRIDGETOWN_NO_BUNDLER_REQUIRE"] &&
|
65
|
+
(Bundler::SharedHelpers.in_bundle? || Bridgetown.env.test?)
|
65
66
|
require "bundler"
|
66
67
|
|
67
68
|
require_relative "utils/initializers"
|
@@ -14,10 +14,10 @@ Roda::RodaPlugins::Public::RequestMethods.module_eval do
|
|
14
14
|
seg == ".." ? segments.pop : segments << seg
|
15
15
|
end
|
16
16
|
|
17
|
-
path =
|
18
|
-
unless
|
19
|
-
path =
|
20
|
-
if
|
17
|
+
path = File.join(roda_class.opts[:public_root], *segments)
|
18
|
+
unless File.file?(path)
|
19
|
+
path = File.join(path, "index.html")
|
20
|
+
if File.file?(path)
|
21
21
|
segments << "index.html"
|
22
22
|
else
|
23
23
|
segments[segments.size - 1] = "#{segments.last}.html"
|
@@ -373,7 +373,7 @@ module Bridgetown
|
|
373
373
|
found_locale = data.language || data.lang || basename_without_ext.split(".")[1..].last
|
374
374
|
return unless found_locale && site.config.available_locales.include?(found_locale.to_sym)
|
375
375
|
|
376
|
-
found_locale
|
376
|
+
found_locale.to_sym
|
377
377
|
end
|
378
378
|
|
379
379
|
def format_url(url)
|
@@ -73,6 +73,8 @@ module Bridgetown
|
|
73
73
|
@modified_time ||= File.stat(path).mtime
|
74
74
|
end
|
75
75
|
|
76
|
+
alias_method :date, :modified_time
|
77
|
+
|
76
78
|
# Returns last modification time for this file.
|
77
79
|
def mtime
|
78
80
|
modified_time.to_i
|
@@ -119,12 +121,12 @@ module Bridgetown
|
|
119
121
|
@to_liquid ||= Drops::StaticFileDrop.new(self)
|
120
122
|
end
|
121
123
|
|
122
|
-
# Generate "basename without extension" and strip away any trailing periods.
|
123
|
-
# NOTE: `String#gsub` removes all trailing periods (in comparison to `String#chomp`)
|
124
124
|
def basename
|
125
|
-
@basename ||= File.basename(name,
|
125
|
+
@basename ||= File.basename(name, ".*")
|
126
126
|
end
|
127
127
|
|
128
|
+
alias_method :basename_without_ext, :basename
|
129
|
+
|
128
130
|
def relative_path_basename_without_prefix
|
129
131
|
return_path = Pathname.new("")
|
130
132
|
Pathname.new(cleaned_relative_path).each_filename do |filename|
|
@@ -185,7 +187,7 @@ module Bridgetown
|
|
185
187
|
|
186
188
|
# Returns the type of the collection if present, nil otherwise.
|
187
189
|
def type
|
188
|
-
@type ||= @collection
|
190
|
+
@type ||= @collection&.label&.to_sym
|
189
191
|
end
|
190
192
|
|
191
193
|
# Returns the front matter defaults defined for the file's URL and/or type
|
@@ -14,9 +14,9 @@ module Bridgetown
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def method_missing(key, *value, &block) # rubocop:disable Metrics/CyclomaticComplexity, Style/MissingRespondToMissing
|
17
|
-
return super if respond_to?(key) || (value.
|
17
|
+
return super if respond_to?(key) || (value.empty? && block.nil? && !@data.key?(key))
|
18
18
|
|
19
|
-
return get(key) if value.
|
19
|
+
return get(key) if value.empty? && block.nil? && @data.key?(key)
|
20
20
|
|
21
21
|
set(key, value[0], &block)
|
22
22
|
end
|
data/lib/bridgetown-core.rb
CHANGED
@@ -16,6 +16,7 @@ end
|
|
16
16
|
|
17
17
|
# rubygems
|
18
18
|
require "rubygems"
|
19
|
+
require "bundler/shared_helpers"
|
19
20
|
|
20
21
|
# stdlib
|
21
22
|
require "find"
|
@@ -135,6 +136,8 @@ module Bridgetown
|
|
135
136
|
end
|
136
137
|
alias_method :env, :environment
|
137
138
|
|
139
|
+
# Set up the Bridgetown execution environment before attempting to load any
|
140
|
+
# plugins or gems prior to a site build
|
138
141
|
def begin!
|
139
142
|
ENV["RACK_ENV"] ||= environment
|
140
143
|
|
@@ -177,6 +180,38 @@ module Bridgetown
|
|
177
180
|
end
|
178
181
|
end
|
179
182
|
|
183
|
+
# Initialize a preflight configuration object, copying initializers and
|
184
|
+
# source manifests from a previous standard configuration if necessary.
|
185
|
+
# Typically only needed in test suites to reset before a new test.
|
186
|
+
#
|
187
|
+
# @return [Bridgetown::Configuration::Preflight]
|
188
|
+
def reset_configuration! # rubocop:disable Metrics/AbcSize
|
189
|
+
if Bridgetown::Current.preloaded_configuration.nil?
|
190
|
+
return Bridgetown::Current.preloaded_configuration =
|
191
|
+
Bridgetown::Configuration::Preflight.new
|
192
|
+
end
|
193
|
+
|
194
|
+
return unless Bridgetown::Current.preloaded_configuration.is_a?(Bridgetown::Configuration)
|
195
|
+
|
196
|
+
previous_config = Bridgetown::Current.preloaded_configuration
|
197
|
+
new_config = Bridgetown::Configuration::Preflight.new
|
198
|
+
new_config.initializers = previous_config.initializers
|
199
|
+
new_config.source_manifests = previous_config.source_manifests
|
200
|
+
if new_config.initializers
|
201
|
+
new_config.initializers.delete(:init)
|
202
|
+
new_config.initializers.select! do |_k, initializer|
|
203
|
+
next false if initializer.block.source_location[0].start_with?(
|
204
|
+
File.join(previous_config.root_dir, "config")
|
205
|
+
)
|
206
|
+
|
207
|
+
initializer.completed = false
|
208
|
+
true
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
Bridgetown::Current.preloaded_configuration = new_config
|
213
|
+
end
|
214
|
+
|
180
215
|
def initializer(name, prepend: false, replace: false, &block) # rubocop:todo Metrics
|
181
216
|
unless Bridgetown::Current.preloaded_configuration
|
182
217
|
raise "The `#{name}' initializer in #{block.source_location[0]} was called " \
|
@@ -275,6 +310,14 @@ module Bridgetown
|
|
275
310
|
def set_timezone(timezone)
|
276
311
|
ENV["TZ"] = timezone
|
277
312
|
end
|
313
|
+
|
314
|
+
# Get the current TZ environment variable
|
315
|
+
#
|
316
|
+
# @return [String]
|
317
|
+
def timezone
|
318
|
+
ENV["TZ"]
|
319
|
+
end
|
320
|
+
|
278
321
|
# rubocop:enable Naming/AccessorMethodName
|
279
322
|
|
280
323
|
# Fetch the logger instance for this Bridgetown process.
|
@@ -1,6 +1,10 @@
|
|
1
1
|
# Puma is a fast, concurrent web server for Ruby & Rack
|
2
2
|
#
|
3
3
|
# Learn more at: https://puma.io
|
4
|
+
# Bridgetown configuration documentation:
|
5
|
+
# https://edge.bridgetownrb.com/docs/configuration/puma
|
6
|
+
|
7
|
+
# This port number can be overriden by a bind configuration option
|
4
8
|
#
|
5
9
|
port ENV.fetch("BRIDGETOWN_PORT") { 4000 }
|
6
10
|
|
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: 1.2.0
|
4
|
+
version: 1.2.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:
|
11
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -274,20 +274,6 @@ dependencies:
|
|
274
274
|
- - "~>"
|
275
275
|
- !ruby/object:Gem::Version
|
276
276
|
version: '1.0'
|
277
|
-
- !ruby/object:Gem::Dependency
|
278
|
-
name: terminal-table
|
279
|
-
requirement: !ruby/object:Gem::Requirement
|
280
|
-
requirements:
|
281
|
-
- - "~>"
|
282
|
-
- !ruby/object:Gem::Version
|
283
|
-
version: '1.8'
|
284
|
-
type: :runtime
|
285
|
-
prerelease: false
|
286
|
-
version_requirements: !ruby/object:Gem::Requirement
|
287
|
-
requirements:
|
288
|
-
- - "~>"
|
289
|
-
- !ruby/object:Gem::Version
|
290
|
-
version: '1.8'
|
291
277
|
- !ruby/object:Gem::Dependency
|
292
278
|
name: thor
|
293
279
|
requirement: !ruby/object:Gem::Requirement
|
@@ -615,9 +601,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
615
601
|
version: 2.7.0
|
616
602
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
617
603
|
requirements:
|
618
|
-
- - "
|
604
|
+
- - ">="
|
619
605
|
- !ruby/object:Gem::Version
|
620
|
-
version:
|
606
|
+
version: '0'
|
621
607
|
requirements: []
|
622
608
|
rubygems_version: 3.1.4
|
623
609
|
signing_key:
|