forked from magento/devdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.rake
66 lines (55 loc) · 1.54 KB
/
update.rake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.
# frozen_string_literal: true
namespace :update do
desc 'Update the devdocs theme'
task :theme do
print 'Updating the devdocs theme gem dependency: $ '.magenta
sh 'bundle update devdocs --conservative'
print "Let's see the changes in Gemfile.lock: $ ".blue
sh 'git diff Gemfile.lock'
end
desc 'Update MBI docs'
task :mbi do
puts 'Updating MBI docs:'.magenta
update_dir 'src/mbi'
end
desc 'Update Page Builder docs'
task :pb do
puts 'Updating Page Builder docs:'.magenta
update_dir 'src/page-builder'
end
desc 'Update MFTF docs'
task :mftf do
puts 'Updating MFTF docs:'.magenta
update_dir 'src/mftf'
end
desc 'Update devdocs master'
task :devdocs do
puts 'Updating devdocs:'.magenta
sh 'git remote -v'
sh 'git checkout master'
sh 'git pull'
sh 'git status -sb'
end
desc 'Update devdocs and subrepositories'
task all: %w[devdocs subrepos]
desc 'Update subrepositories only'
task :subrepos do
@content_map.each do |subrepo|
update_dir subrepo['directory']
end
end
end
def update_dir(dir)
unless Dir.exist? dir
abort "Cannot find the #{dir} directory. You can run 'rake init' to create it and rerun 'rake update:all' again.".red
end
Dir.chdir dir do
puts "Updating #{dir}:".magenta
next warn 'No branch to update' if `git status -sb`.include? 'no branch'
sh 'git remote -v'
sh 'git pull --no-recurse-submodules'
sh 'git status -sb'
end
end