Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 2c6bd00

Browse files
committed
Linting
1 parent c7d8023 commit 2c6bd00

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

_plugins/generators/migrated_log.rb

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class MigratedLog < Generator
1919
def generate(site)
2020
@site = site
2121
pages = @site.pages
22-
migrated_pages = pages.select { |page| page.data['layout'] and page.data['layout'].include? 'migrated' }
22+
migrated_pages = pages.select { |page| page.data['layout']&.include? 'migrated' }
2323
v2_3_pages = pages.select { |page| page.data['guide_version'] == '2.3' }
2424
remained_pages = pages - v2_3_pages
2525
deprecated_pages = remained_pages.select { |page| page.data['group'].nil? || page.data['redirect_to'] }
@@ -32,8 +32,12 @@ def generate(site)
3232
migrated_page = {
3333
path: page.path,
3434
title: page.data['title'] || abort("Error in '#{page.path}'.\n Check 'title' in the file's frontmatter.".red),
35-
guide: page.data['layout'].include?('video') ? 'Video Tutorials' : @site.data.dig('toc', page.data['group'],
36-
'label') || abort("Error in '#{page.path}'.\n Check 'group' in the file's frontmatter or 'label' in the corresponding TOC.".red),
35+
guide: if page.data['layout'].include?('video')
36+
'Video Tutorials'
37+
else
38+
@site.data.dig('toc', page.data['group'],
39+
'label') || abort("Error in '#{page.path}'.\n Check 'group' in the file's frontmatter or 'label' in the corresponding TOC.".red)
40+
end,
3741
migrated_from: site.baseurl + page.url,
3842
migrated_to: page.data['migrated_to'] || abort("Error in '#{page.path}'.\n Check 'migrated_to' in the file's frontmatter.".red),
3943
migrated_to_source: if page.data['migrated_to'].start_with?('https://experienceleague.adobe.com')
@@ -61,9 +65,9 @@ def generate(site)
6165

6266
content += "\n***\n\n\n"
6367
content += "\n## Pages to be migrated\n\n\n"
64-
68+
6569
if remained_migrating_pages.empty?
66-
content += "All 2.4 and versionless pages were migrated"
70+
content += 'All 2.4 and versionless pages were migrated'
6771
else
6872
remained_migrating_pages.sort_by(&:path)
6973
.each do |page|
@@ -93,12 +97,12 @@ def generate(site)
9397
pages << topic
9498

9599
site.data['migration'] =
96-
{
97-
'migrated_pages' => migrated_pages.map(&:path),
98-
'deprecated_pages' => deprecated_pages.map(&:path),
99-
'all_migrating_pages' => all_migrating_pages.map(&:path),
100-
'remained_migrating_pages' => remained_migrating_pages.map(&:path)
101-
}
100+
{
101+
'migrated_pages' => migrated_pages.map(&:path),
102+
'deprecated_pages' => deprecated_pages.map(&:path),
103+
'all_migrating_pages' => all_migrating_pages.map(&:path),
104+
'remained_migrating_pages' => remained_migrating_pages.map(&:path)
105+
}
102106

103107
migrated_pages_data
104108
end

0 commit comments

Comments
 (0)