bridgetown-core 0.15.0.beta3 → 0.15.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0731d836363a7cc613e8a42a833fb1d45e50f293558cd78238d9b214b73e2d99
4
- data.tar.gz: 2597ac785d145bcd26083d08e803d4f0937165d8150bfb05eea5b9ba90ad6e4f
3
+ metadata.gz: 71735e11ccbfa90136e92df69397f7c27555e846a509064e5ec44640e34a807f
4
+ data.tar.gz: 81f2e343ca9b675dbbc15877129d3c3a1d1e410f020d006fbbcf7ba3032a56a0
5
5
  SHA512:
6
- metadata.gz: 7bead893392ffe25b85bcef0419201fa5a8752793f9b8812ac26e512ab35e2638d888ec02c64c672e7930c509afbe0fffa2c98b40316351028951469e63c9310
7
- data.tar.gz: e8083bd29fb64deef6f0fe17b028cb1aa373944cfcb15fe0ce686b03f6db6e12bcdbcb25842e4a508b2979facb9655cfe358fac685f7c2af4c44e2a6edb65c1c
6
+ metadata.gz: 96f9dd7c20e611506bacc39b87bc74bef99281f98e08fb16f05a14b2f7d3e08da8929fe9036146cce3ebdc98cf5aad3466ab6c45f34853a5af7c8c0411827155
7
+ data.tar.gz: be4dbaa9575a318e31555f9a1d591090fa7c12d4a3a6e53d59d1b3f92783ed910bf62db97c36c6bb1dc3f4acdbf3a2b45991b37fea5be0fd395ae72b86ea62af
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
 
34
34
  s.add_runtime_dependency("activesupport", "~> 6.0")
35
35
  s.add_runtime_dependency("addressable", "~> 2.4")
36
+ s.add_runtime_dependency("awesome_print", "~> 1.8")
36
37
  s.add_runtime_dependency("colorator", "~> 1.0")
37
38
  s.add_runtime_dependency("faraday", "~> 1.0")
38
39
  s.add_runtime_dependency("faraday_middleware", "~> 1.0")
@@ -8,6 +8,10 @@ require "active_support/core_ext/string/indent"
8
8
  module Bridgetown
9
9
  module Commands
10
10
  module Actions
11
+ GITHUB_REGEX = %r!https://github\.com!.freeze
12
+ GITHUB_TREE_REGEX = %r!#{GITHUB_REGEX}/.*/.*/tree/.*/?!.freeze
13
+ GITHUB_BLOB_REGEX = %r!#{GITHUB_REGEX}/.*/.*/blob/!.freeze
14
+
11
15
  def create_builder(filename, data = nil)
12
16
  say_status :create_builder, filename
13
17
  data ||= yield if block_given?
@@ -89,35 +93,36 @@ module Bridgetown
89
93
  end
90
94
 
91
95
  # TODO: option to download and confirm remote automation?
96
+ # rubocop:disable Metrics/MethodLength
92
97
  def transform_automation_url(arg)
93
98
  return arg unless arg.start_with?("http")
94
99
 
95
100
  remote_file = determine_remote_filename(arg)
101
+ github_match = GITHUB_REGEX.match(arg)
102
+
103
+ arg = if arg.start_with?("https://gist.github.com")
104
+ arg.sub(
105
+ "https://gist.github.com", "https://gist.githubusercontent.com"
106
+ ) + "/raw"
107
+ elsif github_match
108
+ new_url = arg.sub(GITHUB_REGEX, "https://raw.githubusercontent.com")
109
+ github_tree_match = GITHUB_TREE_REGEX.match(arg)
110
+ github_blob_match = GITHUB_BLOB_REGEX.match(arg)
111
+
112
+ if github_tree_match
113
+ new_url.sub("/tree/", "/")
114
+ elsif github_blob_match
115
+ new_url.sub("/blob/", "/")
116
+ else
117
+ "#{new_url}/master"
118
+ end
119
+ else
120
+ arg
121
+ end
96
122
 
97
- github_regex = %r!https://github\.com!
98
- github_tree_regex = %r!#{github_regex}/.*/.*/tree/.*/?!
99
-
100
- github_match = github_regex.match(arg)
101
- github_tree_match = github_tree_regex.match(arg)
102
-
103
- if arg.start_with?("https://gist.github.com")
104
- return arg.sub(
105
- "https://gist.github.com", "https://gist.githubusercontent.com"
106
- ) + "/raw/#{remote_file}"
107
- elsif github_match
108
- new_url = arg.sub(github_regex, "https://raw.githubusercontent.com")
109
-
110
- if github_tree_match
111
- new_url = new_url.sub("/tree/", "/")
112
- else
113
- new_url += "/master"
114
- end
115
-
116
- return "#{new_url}/#{remote_file}"
117
- end
118
-
119
- arg + "/#{remote_file}"
123
+ "#{arg}/#{remote_file}"
120
124
  end
125
+ # rubocop:enable Metrics/MethodLength
121
126
  end
122
127
  end
123
128
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "irb"
4
-
5
3
  module Bridgetown
6
4
  module Commands
7
5
  class Console < Thor::Group
@@ -21,11 +19,17 @@ module Bridgetown
21
19
  type: :array,
22
20
  banner: "FILE1 FILE2",
23
21
  desc: "Custom configuration file(s)"
22
+ class_option :"bypass-ap",
23
+ type: :boolean,
24
+ desc: "Don't load AwesomePrint when IRB opens"
24
25
  class_option :blank,
25
26
  type: :boolean,
26
27
  desc: "Skip reading content and running generators before opening console"
27
28
 
28
29
  def console
30
+ require "irb"
31
+ require "awesome_print" unless options[:"bypass-ap"]
32
+
29
33
  Bridgetown.logger.info "Starting:", "Bridgetown v#{Bridgetown::VERSION.magenta}" \
30
34
  " (codename \"#{Bridgetown::CODE_NAME.yellow}\")" \
31
35
  " console…"
@@ -56,6 +60,12 @@ module Bridgetown
56
60
 
57
61
  begin
58
62
  catch(:IRB_EXIT) do
63
+ unless options[:"bypass-ap"]
64
+ AwesomePrint.defaults = {
65
+ indent: 2,
66
+ }
67
+ AwesomePrint.irb!
68
+ end
59
69
  irb.eval_input
60
70
  end
61
71
  end
@@ -29,6 +29,11 @@ module Bridgetown
29
29
  class_option :skip_initial_build,
30
30
  type: :boolean,
31
31
  desc: "Skips the initial site build which occurs before the server is started."
32
+ class_option :watch,
33
+ type: :boolean,
34
+ aliases: "-w",
35
+ default: true,
36
+ desc: "Watch for changes and rebuild"
32
37
 
33
38
  def self.banner
34
39
  "bridgetown serve [options]"
@@ -12,7 +12,15 @@ module Bridgetown
12
12
  mutable false
13
13
 
14
14
  def_delegator :@obj, :relative_path, :path
15
- def_delegators :@obj, :id, :output, :content, :to_s, :relative_path, :url, :date
15
+ def_delegators :@obj,
16
+ :id,
17
+ :output,
18
+ :content,
19
+ :to_s,
20
+ :relative_path,
21
+ :url,
22
+ :date,
23
+ :related_posts
16
24
 
17
25
  private def_delegator :@obj, :data, :fallback_data
18
26
 
@@ -165,7 +165,7 @@ module Bridgetown
165
165
 
166
166
  # The path to the page source file, relative to the site source
167
167
  def relative_path
168
- @relative_path ||= File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).sub(%r!\A\/!, "")
168
+ @relative_path ||= File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).delete_prefix("/")
169
169
  end
170
170
 
171
171
  # Obtain destination path.
@@ -3,6 +3,7 @@
3
3
  module Bridgetown
4
4
  class PluginManager
5
5
  PLUGINS_GROUP = :bridgetown_plugins
6
+ YARN_DEPENDENCY_REGEXP = %r!(.+)@([^@]*)$!.freeze
6
7
 
7
8
  attr_reader :site
8
9
 
@@ -83,10 +84,10 @@ module Bridgetown
83
84
  end
84
85
 
85
86
  def self.find_yarn_dependency(loaded_gem)
86
- yarn_dependency = loaded_gem.to_spec&.metadata&.dig("yarn-add")&.split("@")
87
- return nil if yarn_dependency&.length != 2
87
+ yarn_dependency = loaded_gem.to_spec&.metadata&.dig("yarn-add")&.match(YARN_DEPENDENCY_REGEXP)
88
+ return nil if yarn_dependency&.length != 3 || yarn_dependency[2] == ""
88
89
 
89
- yarn_dependency
90
+ yarn_dependency[1..2]
90
91
  end
91
92
 
92
93
  def self.add_yarn_dependency?(yarn_dependency, package_json)
@@ -212,7 +212,9 @@ module Bridgetown
212
212
  else
213
213
  File.join(site.config["collections_dir"], page_payload["path"])
214
214
  end
215
+ # rubocop:disable Performance/DeleteSuffix
215
216
  resource_path.sub!(%r!/#excerpt\z!, "")
217
+ # rubocop:enable Performance/DeleteSuffix
216
218
  site.in_source_dir File.dirname(resource_path)
217
219
  end
218
220
  end
@@ -3,6 +3,7 @@
3
3
  module Bridgetown
4
4
  module Tags
5
5
  class BlockRenderTag < Liquid::Block
6
+ # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
6
7
  def render(context)
7
8
  context.stack({}) do
8
9
  # unindent the incoming text
@@ -19,7 +20,15 @@ module Bridgetown
19
20
  unless regions.empty?
20
21
  regions.each do |region_name, region_content|
21
22
  region_name = region_name.sub("content_with_region_", "")
22
- context[region_name] = converter.convert(region_content.strip_heredoc)
23
+
24
+ if region_name.end_with? ":markdown"
25
+ region_name.sub!(%r!:markdown$!, "")
26
+ context[region_name] = converter.convert(
27
+ Bridgetown::Utils.reindent_for_markdown(region_content)
28
+ )
29
+ else
30
+ context[region_name] = region_content
31
+ end
23
32
  render_params.push "#{region_name}: #{region_name}"
24
33
  end
25
34
  end
@@ -28,6 +37,7 @@ module Bridgetown
28
37
  .render_tag(context, +"")
29
38
  end
30
39
  end
40
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
31
41
 
32
42
  private
33
43
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bridgetown
4
- VERSION = "0.15.0.beta3"
4
+ VERSION = "0.15.0.beta4"
5
5
  CODE_NAME = "Overlook"
6
6
  end
@@ -10,12 +10,14 @@
10
10
  # For reloadable site metadata like title, SEO description, social media
11
11
  # handles, etc., take a look at src/_data/site_metadata.yml
12
12
  #
13
- # If you need help with YAML syntax, here are some quick references for you:
13
+ # If you need help with YAML syntax, here are some quick references for you:
14
14
  # https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
15
15
  # https://learnxinyminutes.com/docs/yaml/
16
16
  #
17
17
 
18
18
  baseurl: "" # OPTIONAL: the subpath of your site, e.g. /blog
19
- url: "" # the base hostname & protocol for your site, e.g. http://example.com
19
+ url: "" # the base hostname & protocol for your site, e.g. https://example.com
20
20
 
21
- # Additional build settings go here
21
+ permalink: pretty
22
+
23
+ # timezone: America/Los_Angeles
@@ -4,7 +4,7 @@
4
4
  {% render "head", metadata: site.metadata, title: page.title %}
5
5
  </head>
6
6
  <body class="{{ page.layout }} {{ page.page_class }}">
7
- {% render "navbar" %}
7
+ {% render "navbar", metadata: site.metadata, page: page %}
8
8
 
9
9
  <main>
10
10
  {{ content }}
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: 0.15.0.beta3
4
+ version: 0.15.0.beta4
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-06-05 00:00:00.000000000 Z
11
+ date: 2020-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: awesome_print
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.8'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.8'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: colorator
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -370,9 +384,9 @@ files:
370
384
  - lib/site_template/plugins/builders/.keep
371
385
  - lib/site_template/plugins/site_builder.rb
372
386
  - lib/site_template/src/404.html
373
- - lib/site_template/src/_components/footer.html
374
- - lib/site_template/src/_components/head.html
375
- - lib/site_template/src/_components/navbar.html
387
+ - lib/site_template/src/_components/footer.liquid
388
+ - lib/site_template/src/_components/head.liquid
389
+ - lib/site_template/src/_components/navbar.liquid
376
390
  - lib/site_template/src/_data/site_metadata.yml
377
391
  - lib/site_template/src/_layouts/default.html
378
392
  - lib/site_template/src/_layouts/home.html