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

Commit 5e2dfc3

Browse files
authored
Merge pull request #4256 from magento/ds_MAGEDOC-3692_docfile
Implement Docfile
2 parents 1159ecc + cc259e4 commit 5e2dfc3

File tree

5 files changed

+53
-17
lines changed

5 files changed

+53
-17
lines changed

.gitignore

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,8 @@
88

99
/_site/
1010

11-
/.*
12-
!/.github
13-
!/.github/**
14-
15-
/*.yml
16-
!/_config.yml
17-
!/_config.prod.yml
18-
!/_config.checks.yml
19-
!/_config.stage.yml
11+
_config.local.yml
12+
.jekyll-metadata
2013

2114
*.bat
2215
/tmp/

Docfile.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
content_map:
2+
-
3+
directory: guides/v2.0
4+
repository: magento/devdocs
5+
branch: 2.0
6+
filter: false
7+
-
8+
directory: guides/m1x
9+
repository: magento/devdocs-m1
10+
branch: master
11+
filter: false
12+
-
13+
directory: mbi
14+
repository: magento/devdocs-mbi
15+
branch: master
16+
filter: true
17+
-
18+
directory: mftf
19+
repository: magento/magento2-functional-testing-framework
20+
branch: develop
21+
filter: true
22+
-
23+
directory: page-builder
24+
repository: magento-devdocs/magento2-page-builder
25+
branch: develop
26+
filter: true

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ require 'colorator'
1515
require_relative 'rakelib/lib/link-checker.rb'
1616
require_relative 'rakelib/lib/converter.rb'
1717
require_relative 'rakelib/lib/double-slash-check.rb'
18+
require_relative 'rakelib/lib/doc-config.rb'
1819

1920
desc "Same as 'rake', 'rake preview'"
2021
task default: %w[preview]

rakelib/lib/doc-config.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Read Docfile file and get configuration data for adding subrepositories
2+
class DocConfig
3+
attr_reader :config
4+
def initialize(config_file = 'Docfile.yml')
5+
@config = YAML.load_file(config_file)
6+
end
7+
8+
def content_map
9+
@config['content_map']
10+
end
11+
end

rakelib/multirepo.rake

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
namespace :multirepo do
2-
desc 'Add content from external repositories'
2+
desc 'Create a file tree for devdocs website and get all required content'
33
task :init do
4-
sh './scripts/docs-from-code.sh mbi [email protected]:magento/devdocs-mbi.git master'
5-
sh './scripts/docs-from-code.sh page-builder [email protected]:magento-devdocs/magento2-page-builder.git develop'
6-
sh './scripts/docs-from-code.sh mftf [email protected]:magento/magento2-functional-testing-framework.git develop'
4+
5+
https = 'https://${token}@github.com/'
6+
protocol =
7+
if ENV['token']
8+
https
9+
else
10+
ssh
11+
end
712

8-
# The last argument 'false' disables content filtering by sparse checkout.
9-
# It covers cases when we need entire repository, not only the '/docs/' directory.
10-
sh './scripts/docs-from-code.sh guides/m1x [email protected]:magento/devdocs-m1.git master false'
11-
sh './scripts/docs-from-code.sh guides/v2.0 [email protected]:magento/devdocs.git 2.0 false'
13+
content_map = DocConfig.new.content_map
14+
content_map.each do |subrepo|
15+
sh "./scripts/docs-from-code.sh #{subrepo['directory']} #{protocol}#{subrepo['repository']}.git #{subrepo['branch']} #{subrepo['filter']}"
16+
end
1217
end
1318

1419
desc 'Add multirepo docs providing shell arguments "dir=<directory where to init a repo>", "repo=<SSH URL>", "branch=<branch to checkout>", "filter=<true/false>" ("true" by default) to 1) filter content if "true" or 2) add content from the entire repository if "false".'

0 commit comments

Comments
 (0)