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

Commit

Permalink
Update the rake task
Browse files Browse the repository at this point in the history
- Move the task to the "check" namespace
- Rename to "mdl" by name of the tool
- Format terminal output to be more clear
- Make the mdl check a prerequisite for the - rake check task
  • Loading branch information
dshevtsov committed Jul 11, 2019
1 parent 4aef5f6 commit ff5c000
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
16 changes: 1 addition & 15 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,10 @@ desc 'Pull docs from external repositories'
task init: %w[multirepo:init]

desc 'Run checks (image optimization).'
task check: %w[check:image_optim]
task check: %w[check:image_optim check:mdl]

desc 'Generate data for the weekly digest.'
task :whatsnew do
print 'Generating data for the weekly digest: $ '.magenta
sh 'whatsup_github'
end

desc 'Check Markdown syntax in modified files or in a particular file or directory by path (e.g. path=mftf)'
task :lint do
path = ENV['path']
unless path
staged_files = `git ls-files -m`.split("\n")
staged_md_files = staged_files.select { |file| File.extname(file) == '.md' }
abort 'Cannot find any modified .md files.' if staged_md_files.empty?
path = staged_md_files.join(' ')
end
report = `bin/mdl #{path}`
puts report.yellow
puts 'The rules are defined in _checks/md_style'
end
15 changes: 15 additions & 0 deletions rakelib/check.rake
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,19 @@ namespace :check do
end
system "bin/image_optim --no-pngout --no-svgo --recursive #{path}"
end

desc 'Check Markdown syntax in modified files or in a particular file or directory by path (e.g. path=mftf)'
task :mdl do
path = ENV['path']
unless path
staged_files = `git ls-files -m`.split("\n")
staged_md_files = staged_files.select { |file| File.extname(file) == '.md' }
abort 'Cannot find any modified .md files.'.magenta if staged_md_files.empty?
path = staged_md_files.join(' ')
end
puts 'Running Markdown linter ...'.magenta
report = `bin/mdl #{path}`
puts report.yellow
puts 'The rules are defined in _checks/md_style'.magenta
end
end

0 comments on commit ff5c000

Please sign in to comment.