comfortable_media_surfer 3.1.2 → 3.1.4
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/CHANGELOG.md +13 -1
- data/Gemfile +2 -2
- data/README.md +2 -0
- data/app/views/comfy/admin/cms/files/destroy.js.erb +1 -1
- data/db/cms_seeds/sample-site/pages/index/child_b/child_a/content.html +6 -0
- data/lib/comfortable_media_surfer/content/renderer.rb +4 -4
- data/lib/comfortable_media_surfer/seeds/file/importer.rb +18 -22
- data/lib/comfortable_media_surfer/seeds/page/importer.rb +1 -1
- data/lib/comfortable_media_surfer/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cf323e095236d5bf70617e2f6fdc7274844f10f3ae63312ddbd569becb71907
|
4
|
+
data.tar.gz: 69ef4521653d87de1dbc5cc5cf7f40c90eb0329bda6b8224038b6822c0973996
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74e32612a8d303dd5e21cefe7996ec9123308878ffc88c33d1bf7a64ec3151a3fb4a83d1f530159305e3c9ed9ecb2b7da95e72ad871c2ccaeae40cd9c33b4c45
|
7
|
+
data.tar.gz: 9d64b2d2537f236502af7964f3cc623ed6d395856688b5cfd64f66653b9d84fb6455b0938250515ab7b201a54c4c2a3b63ec277ff907062be339974836c67c53
|
data/CHANGELOG.md
CHANGED
@@ -12,6 +12,16 @@ For all changes prior to the inception of this project, see the [Release History
|
|
12
12
|
|
13
13
|
## [Unreleased]
|
14
14
|
|
15
|
+
## [v3.1.3] - 2025-05-29
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
- Fixed file descriptor leak during seeds import
|
20
|
+
- Fixed ‘Deep nesting of tags’ error for pages containing more than MAX_DEPTH tags
|
21
|
+
- Fixed importing pages with the same slug but different parents
|
22
|
+
|
23
|
+
## [v3.1.2] - 2025-05-26
|
24
|
+
|
15
25
|
### Fixed
|
16
26
|
|
17
27
|
- Fixed Expand/Collapse error in Admin/Pages.
|
@@ -80,7 +90,9 @@ First release of `comfortable_media_surfer`. This new gem is a revival of [Comfo
|
|
80
90
|
|
81
91
|
- Rebranded **ComfortableMexicanSofa** as **ComfortableMediaSurfer** in order to publish new gem (database table names and schema have not changed).
|
82
92
|
|
83
|
-
[Unreleased]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.
|
93
|
+
[Unreleased]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.3...master
|
94
|
+
[v3.1.3]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.2...v3.1.3
|
95
|
+
[v3.1.2]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.1...v3.1.2
|
84
96
|
[v3.1.1]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.1.0...v3.1.1
|
85
97
|
[v3.1.0]: https://github.com/shakacode/comfortable-media-surfer/compare/v3.0.0...v3.1.0
|
86
98
|
[v3.0.0]: https://github.com/shakacode/comfortable-media-surfer/compare/v2.0.19...v3.0.0
|
data/Gemfile
CHANGED
@@ -26,7 +26,7 @@ end
|
|
26
26
|
group :test do
|
27
27
|
gem 'brakeman', '~> 7.0.2'
|
28
28
|
gem 'bundler-audit', '~> 0.9.1'
|
29
|
-
gem 'coveralls_reborn', '~> 0.
|
29
|
+
gem 'coveralls_reborn', '~> 0.29.0', require: false
|
30
30
|
gem 'cuprite', '>= 0.15'
|
31
31
|
gem 'equivalent-xml', '~> 0.6.0'
|
32
32
|
gem 'minitest', '>= 5.23.0'
|
@@ -35,7 +35,7 @@ group :test do
|
|
35
35
|
gem 'ostruct'
|
36
36
|
gem 'puma'
|
37
37
|
gem 'rails-controller-testing', '~> 1.0.5'
|
38
|
-
gem 'rubocop', '~> 1.
|
38
|
+
gem 'rubocop', '~> 1.77.0', require: false
|
39
39
|
gem 'rubocop-minitest'
|
40
40
|
gem 'rubocop-rails'
|
41
41
|
gem 'simplecov', '~> 0.22.0', require: false
|
data/README.md
CHANGED
@@ -79,6 +79,8 @@ ALTER TABLE occams_cms_revisions RENAME TO comfy_cms_revisions;
|
|
79
79
|
ALTER TABLE occams_cms_sites RENAME TO comfy_cms_sites;
|
80
80
|
ALTER TABLE occams_cms_snippets RENAME TO comfy_cms_snippets;
|
81
81
|
ALTER TABLE occams_cms_translations RENAME TO comfy_cms_translations;
|
82
|
+
UPDATE comfy_cms_categories SET categorized_type = 'Comfy::Cms::Page' WHERE categorized_type = 'Occams::Cms::Page';
|
83
|
+
UPDATE comfy_cms_categorizations SET categorized_type = 'Comfy::Cms::Page' WHERE categorized_type = 'Occams::Cms::Page';
|
82
84
|
UPDATE comfy_cms_fragments SET record_type = 'Comfy::Cms::Page' WHERE record_type = 'Occams::Cms::Page';
|
83
85
|
UPDATE comfy_cms_fragments SET record_type = 'Comfy::Cms::Layout' WHERE record_type = 'Occams::Cms::Layout';
|
84
86
|
UPDATE comfy_cms_fragments SET record_type = 'Comfy::Cms::Snippet' WHERE record_type = 'Occams::Cms::Snippet';
|
@@ -39,15 +39,15 @@ class ComfortableMediaSurfer::Content::Renderer
|
|
39
39
|
# @param [Comfy::Cms::WithFragments, nil] context
|
40
40
|
def initialize(context)
|
41
41
|
@context = context
|
42
|
-
@depth = 0
|
43
42
|
end
|
44
43
|
|
45
44
|
# This is how we render content out. Takes context (cms page) and content
|
46
45
|
# nodes
|
47
46
|
# @param [Array<String, ComfortableMediaSurfer::Content::Tag>]
|
48
47
|
# @param [Boolean] allow_erb
|
49
|
-
|
50
|
-
|
48
|
+
# @param [Integer] depth current tag nesting position
|
49
|
+
def render(nodes, allow_erb = ComfortableMediaSurfer.config.allow_erb, depth = 0)
|
50
|
+
if depth >= MAX_DEPTH
|
51
51
|
raise Error, 'Deep tag nesting or recursive nesting detected'
|
52
52
|
end
|
53
53
|
|
@@ -58,7 +58,7 @@ class ComfortableMediaSurfer::Content::Renderer
|
|
58
58
|
else
|
59
59
|
tokens = tokenize(node.render)
|
60
60
|
nodes = nodes(tokens)
|
61
|
-
render(nodes, allow_erb || node.allow_erb
|
61
|
+
render(nodes, allow_erb || node.allow_erb?, depth.next)
|
62
62
|
end
|
63
63
|
end.flatten.join
|
64
64
|
end
|
@@ -15,37 +15,23 @@ module ComfortableMediaSurfer::Seeds::File
|
|
15
15
|
.where('active_storage_blobs.filename' => filename).references(:blob).first ||
|
16
16
|
site.files.new
|
17
17
|
|
18
|
-
# We need to track actual file and its attributes
|
19
|
-
fresh_file = false
|
20
|
-
|
21
18
|
if File.exist?(attrs_path = File.join(path, "_#{filename}.yml")) && fresh_seed?(file, attrs_path)
|
22
|
-
fresh_file = true
|
23
|
-
|
24
19
|
attrs = YAML.safe_load_file(attrs_path)
|
25
20
|
category_ids = category_names_to_ids(file, attrs.delete('categories'))
|
26
21
|
file.attributes = attrs.merge(
|
27
22
|
category_ids: category_ids
|
28
23
|
)
|
24
|
+
save(file, file_path)
|
29
25
|
end
|
30
26
|
|
31
27
|
if fresh_seed?(file, file_path)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
if fresh_file
|
43
|
-
if file.save
|
44
|
-
message = "[CMS SEEDS] Imported File \t #{file_path}"
|
45
|
-
ComfortableMediaSurfer.logger.info(message)
|
46
|
-
else
|
47
|
-
message = "[CMS SEEDS] Failed to import File \n#{file.errors.inspect}"
|
48
|
-
ComfortableMediaSurfer.logger.warn(message)
|
28
|
+
File.open(file_path) do |file_handler|
|
29
|
+
file.file = {
|
30
|
+
io: file_handler,
|
31
|
+
filename: filename,
|
32
|
+
content_type: MimeMagic.by_magic(file_handler)
|
33
|
+
}
|
34
|
+
save(file, file_path)
|
49
35
|
end
|
50
36
|
end
|
51
37
|
|
@@ -55,5 +41,15 @@ module ComfortableMediaSurfer::Seeds::File
|
|
55
41
|
# cleaning up
|
56
42
|
site.files.where('id NOT IN (?)', seed_ids).destroy_all
|
57
43
|
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def save(file, path)
|
48
|
+
if file.save
|
49
|
+
ComfortableMediaSurfer.logger.info("[CMS SEEDS] Imported File \t #{path}")
|
50
|
+
else
|
51
|
+
ComfortableMediaSurfer.logger.warn("[CMS SEEDS] Failed to import File \n#{file.errors.inspect}")
|
52
|
+
end
|
53
|
+
end
|
58
54
|
end
|
59
55
|
end
|
@@ -29,7 +29,7 @@ module ComfortableMediaSurfer::Seeds::Page
|
|
29
29
|
# setting page record
|
30
30
|
page =
|
31
31
|
if parent.present?
|
32
|
-
child = site.pages.where(slug: slug).first_or_initialize
|
32
|
+
child = site.pages.where(slug: slug, parent_id: parent.id).first_or_initialize
|
33
33
|
child.parent = parent
|
34
34
|
child
|
35
35
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_media_surfer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Khabarov
|
@@ -556,6 +556,7 @@ files:
|
|
556
556
|
- db/cms_seeds/sample-site/layouts/default/content.html
|
557
557
|
- db/cms_seeds/sample-site/layouts/default/nested/content.html
|
558
558
|
- db/cms_seeds/sample-site/pages/index/child_a/content.html
|
559
|
+
- db/cms_seeds/sample-site/pages/index/child_b/child_a/content.html
|
559
560
|
- db/cms_seeds/sample-site/pages/index/child_b/content.html
|
560
561
|
- db/cms_seeds/sample-site/pages/index/cms logo.png
|
561
562
|
- db/cms_seeds/sample-site/pages/index/content.es.html
|