svelte-on-rails 22.1.1 → 22.2.0
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/lib/svelte_on_rails/configuration.rb +1 -1
- data/lib/svelte_on_rails/lib/utils.rb +25 -11
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a32126c57f42015b2fae36849a77266d174dfc6234a5958c924b490e4c1efc47
|
|
4
|
+
data.tar.gz: b264887e056b7d3aeb763923d1f20eccdab81000bc1c7dae63b7c909397157c0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ec6ad182cd5a2f06c654017f2ddbc81fe07b07498339262b0ec145d7fbaa815d12abef5a681930080d8edaee57e536f036399e5df011c8e3d3413ecea9b0a5f7
|
|
7
|
+
data.tar.gz: e67beb89b3a4ed77bdb3d7cc39f54596769c1b9cd25d12b7db7341cf860176d0b9a633b6fba4e4703a2a48d42509a1b18a977345b0a91214cefe556c760766b2
|
|
@@ -179,7 +179,7 @@ module SvelteOnRails
|
|
|
179
179
|
|
|
180
180
|
def redis_cache_store_configs
|
|
181
181
|
if defined?(Rails.application) && Rails.application.config.cache_store.is_a?(Array) && Rails.application.config.cache_store.first == :redis_cache_store
|
|
182
|
-
{
|
|
182
|
+
{ redis_cache_store: Rails.application.config.cache_store.second.stringify_keys }
|
|
183
183
|
else
|
|
184
184
|
{}
|
|
185
185
|
end
|
|
@@ -24,24 +24,38 @@ module SvelteOnRails
|
|
|
24
24
|
|
|
25
25
|
# Defining methods to log errors and warnings using Rails logger
|
|
26
26
|
def self.puts_error(text)
|
|
27
|
-
|
|
28
|
-
caller_info = caller[1] =~ /`([^']*)'/ ? $1 : "unknown"
|
|
29
|
-
Rails.logger.error(" => [SOR] #{caller_info} ERROR")
|
|
30
|
-
text.split("\n").each do |line|
|
|
31
|
-
Rails.logger.error(" => #{line}")
|
|
32
|
-
end
|
|
27
|
+
log_with_severity(:error, text, "ERROR", "\e[31m") # red
|
|
33
28
|
end
|
|
34
29
|
|
|
35
30
|
# Defining method to log warnings using Rails logger
|
|
36
31
|
def self.puts_warning(text)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
log_with_severity(:warn, text, "WARNING", "\e[33m")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Internal: emits a tagged, colored block via Rails.logger.
|
|
36
|
+
# ANSI colors are always included; modern terminals + the Rails
|
|
37
|
+
# dev logger render them. In production the logger strips them
|
|
38
|
+
# or they pass through harmlessly to aggregators.
|
|
39
|
+
def self.log_with_severity(level, text, label, color_code)
|
|
40
|
+
|
|
41
|
+
clear = "\e[0m"
|
|
42
|
+
bold = "\e[1m"
|
|
43
|
+
|
|
44
|
+
header = "#{color_code}#{bold}[SOR] #{label}#{clear}"
|
|
45
|
+
Rails.logger.public_send(level, header)
|
|
46
|
+
text.to_s.split("\n").each do |line|
|
|
47
|
+
Rails.logger.public_send(level, "#{color_code} => #{line}#{clear}")
|
|
42
48
|
end
|
|
43
49
|
end
|
|
44
50
|
|
|
51
|
+
def self.color_supported?
|
|
52
|
+
return false if Rails.env.production?
|
|
53
|
+
# Rails dev logger writes to STDOUT; check that it's a TTY.
|
|
54
|
+
$stdout.tty?
|
|
55
|
+
rescue
|
|
56
|
+
false
|
|
57
|
+
end
|
|
58
|
+
|
|
45
59
|
def self.component_paths_uncached(component, current_controller_path)
|
|
46
60
|
|
|
47
61
|
file_basename = File.basename(component, ".svelte")
|