forked from magento/merchdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
63 lines (50 loc) · 1.83 KB
/
Rakefile
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
# frozen_string_literal: true
# This file contains tasks with no namespace.
# All namespaced tasks are defined in the 'rakelib' directory.
# Each namespace is defined in a separate file.
# For example, 'preview:all' is defined in the 'rakelib/preview.rake' file.
# To see the list of tasks to use, run 'rake -T'.
# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.
require 'html-proofer'
require 'kramdown'
require 'launchy'
require 'colorator'
# Require helper methods from the 'lib' directory
Dir.glob('lib/**/*.rb') { |file| require_relative(file) }
desc "Same as 'rake', 'rake preview'"
task default: %w[preview]
desc "Same as 'test:report'"
task test: %w[test:md test:report]
desc 'Preview the devdocs locally'
task preview: %w[preview:local]
task :clean do
print 'Cleaning after the last site generation: $ '.magenta
sh 'bundle exec jekyll clean'
puts 'Clean!'.green
end
task :install do
print 'Installing gems listed in the Gemfile: $ '.magenta
sh 'bundle install'
puts 'Installed!'.green
end
task build: %w[build:dev]
desc 'Check modified files. To check all files at the particular path, provide the path (e.g. path=src/images/images)'
task check: %w[check:image_optim check:mdl]
desc 'Generate index for Algolia'
task :index do
puts 'Generating index for Algolia ...'.magenta
sh 'bin/jekyll algolia --config=_config.yml,_config.index.yml'
end
desc 'Generate data for a news digest. Default timeframe is a week since today. For other period, use "since" argument: since="jul 4"'
task :whatsnew do
date = ENV['since']
print 'Generating data for the weekly digest: $ '.magenta
if date.nil? || date.empty?
sh 'bin/whatsup_github'
elsif date.is_a? String
sh 'bin/whatsup_github', 'since', ENV['since'].to_s
else
puts 'The "since" argument must be a string. Example: "jul 4"'
end
end