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

Implement Docfile #4256

Merged
merged 8 commits into from
Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,8 @@

/_site/

/.*
!/.github
!/.github/**

/*.yml
!/_config.yml
!/_config.prod.yml
!/_config.checks.yml
!/_config.stage.yml
_config.local.yml
.jekyll-metadata

*.bat
/tmp/
Expand Down
26 changes: 26 additions & 0 deletions Docfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
content_map:
-
directory: guides/v2.0
repository: magento/devdocs
branch: 2.0
filter: false
-
directory: guides/m1x
repository: magento/devdocs-m1
branch: master
filter: false
-
directory: mbi
repository: magento/devdocs-mbi
branch: master
filter: true
-
directory: mftf
repository: magento/magento2-functional-testing-framework
branch: develop
filter: true
-
directory: page-builder
repository: magento-devdocs/magento2-page-builder
branch: develop
filter: true
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require 'colorator'
require_relative 'rakelib/lib/link-checker.rb'
require_relative 'rakelib/lib/converter.rb'
require_relative 'rakelib/lib/double-slash-check.rb'
require_relative 'rakelib/lib/doc-config.rb'

desc "Same as 'rake', 'rake preview'"
task default: %w[preview]
Expand Down
11 changes: 11 additions & 0 deletions rakelib/lib/doc-config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Read Docfile file and get configuration data for adding subrepositories
class DocConfig
attr_reader :config
def initialize(config_file = 'Docfile.yml')
@config = YAML.load_file(config_file)
end

def content_map
@config['content_map']
end
end
21 changes: 13 additions & 8 deletions rakelib/multirepo.rake
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
namespace :multirepo do
desc 'Add content from external repositories'
desc 'Create a file tree for devdocs website and get all required content'
task :init do
sh './scripts/docs-from-code.sh mbi [email protected]:magento/devdocs-mbi.git master'
sh './scripts/docs-from-code.sh page-builder [email protected]:magento-devdocs/magento2-page-builder.git develop'
sh './scripts/docs-from-code.sh mftf [email protected]:magento/magento2-functional-testing-framework.git develop'
ssh = '[email protected]:'
https = 'https://${token}@github.com/'
protocol =
if ENV['token']
https
else
ssh
end

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

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".'
Expand Down