raindeer 0.11.0 → 0.11.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e25c94de75f9b61245dd4baa6ef270a9c0bca2243b10715fe200480fd105303
4
- data.tar.gz: ff00fdf0ea4e7137018b75d74bb1e881fb2a9ed7b9268018c5130ef6a9c99352
3
+ metadata.gz: 00e1c8ea25c77f078076f7997931cc4d68ffbc073dbc6e38820f42744be37df3
4
+ data.tar.gz: fc8a23be880837861fac8f81af34b440e819ae35863048a624655a557b9b83fa
5
5
  SHA512:
6
- metadata.gz: 9989d1dddf6f0fe0bad498323c0c19b84bb4ea75d2c5d62aaa9f86909bdbcfb3bc30fc040ff4889021111aad93122209ae17cc9cf4d542977b500019881023a9
7
- data.tar.gz: fb5992cb47913ec2bc4da2772d48fc438e0cf4935f1084793ae0fd95ce5b3d8d314605d221d43a5ff0b91061b1c7d512b29124a0d5fa128ea097b00c4b075fb0
6
+ metadata.gz: aef29d377676a4e661d889ac0a87dd6aceb0310d8b2fffe5537ff120c90259f70e910b29765d2bebb04623c3178710a8c2795c64d0064dd64973b77fa34cecc6
7
+ data.tar.gz: 1221b6cc68e0d6b07abc6f1fb844ac3c84fda5c5f9a58db89400c6c66d6dbc9bdee56ef76f1756aa91998618e8492e3258203fc8c1e30bb1dd91ee6b32300c8e
data/lib/cli/static.rb CHANGED
@@ -6,6 +6,7 @@ require 'ruby-progressbar'
6
6
 
7
7
  require 'antlers' # Adds antlers support to dirload.
8
8
  require 'dirload'
9
+ require 'lowdata' # Data classes can be loaded without a database.
9
10
 
10
11
  require_relative '../pages/pages'
11
12
 
@@ -35,6 +36,7 @@ module Rain
35
36
  folder_path = File.join(build_path, request_result.path)
36
37
 
37
38
  puts "#{folder_path} => #{request_result.status}"
39
+ next unless request_result.html
38
40
 
39
41
  FileUtils.mkdir_p(folder_path)
40
42
  File.write(File.expand_path('index.html', folder_path), request_result.html)
@@ -80,12 +82,22 @@ module Rain
80
82
  paths.map do |path|
81
83
  request = Protocol::HTTP::Request.new('http', nil, 'GET', path)
82
84
  response = Low::Events::RequestEvent.take(request:).response
83
- result = RequestResult.new(path:, status: response.status, html: response.read)
85
+ RequestResult.new(path:, status: response.status, html: response.read)
86
+ rescue Observers::ObserverError => e
87
+ raise unless database_error?(e)
88
+
89
+ # Static sites don't have a database so paths that need one are skipped.
90
+ RequestResult.new(path:, status: 'Skipped', html: nil)
91
+ ensure
84
92
  progress_bar.increment
85
- result
86
93
  end
87
94
  end
88
95
 
96
+ def database_error?(error)
97
+ error = error.cause until error.nil? || error.is_a?(LowData::ConfigError)
98
+ error&.message == LowData::ConfigError::MISSING_DATABASE
99
+ end
100
+
89
101
  def request_paths(metadata:)
90
102
  file_paths = metadata.file_types.values_at('md', 'rd', 'markdown', 'raindown').flat_map { it }.compact
91
103
  paths = file_paths.map { |file_path| Rain::Pages.url_path(file_path:) }.compact
@@ -7,7 +7,7 @@ module Rain
7
7
  def render(output:, next_output:, **)
8
8
  color = next_output ? @config.cell_color : @config.lead_color
9
9
 
10
- return Paint[output, '#006ab0'] if @config.leet_keys.invert.key?(output)
10
+ return Paint[output, '#006ab0'] if @config.leet && @config.leet_keys.invert.key?(output)
11
11
 
12
12
  output ? Paint[output, color] : Paint[' ']
13
13
  end
data/lib/matrix/matrix.rb CHANGED
@@ -18,7 +18,7 @@ module Rain
18
18
  def initialize(event_pool:, config: ConfigLoader.load('matrix.yaml'))
19
19
  @event_pool = event_pool
20
20
  @config = config
21
- @effects = [LeetEffect.new(config:), ColorEffect.new(config:)]
21
+ @effects = [(LeetEffect.new(config:) if config.leet), ColorEffect.new(config:)].compact
22
22
 
23
23
  @screen_size = nil
24
24
 
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Raindeer
4
- VERSION = '0.11.0'
4
+ VERSION = '0.11.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raindeer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - maedi