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

Commit

Permalink
Added 'rake check' to Rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
dobooth committed Jun 13, 2019
1 parent 4027720 commit 62b2a1e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
13 changes: 2 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,5 @@ end
desc 'Pull docs from external repositories'
task init: %w[multirepo:init]

desc 'Optimize images in modified files, or by path (rake image_optim path=path/to/dir/or/file).'
task :image_optim do
path = ENV['path']
unless path
staged_files = `git ls-files --modified --others --exclude-standard`.split("\n")
# staged_md_files = staged_files.select { |file| File.extname(file) == '.md' }
abort 'Didn\'t find any modified files.'.blue if staged_files.empty?
path = staged_files.join(' ')
end
system "bin/image_optim --no-pngout --no-svgo --recursive #{path}"
end
desc 'Run checks (image optimization).'
task check: %w[check:image_optim]
14 changes: 14 additions & 0 deletions rakelib/check.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace :check do
desc 'Optimize images in modified files, or by path (rake image_optim path=path/to/dir/or/file).'
task :image_optim do
puts 'Running image optimizer...'.magenta
path = ENV['path']
unless path
staged_files = `git ls-files --modified --others --exclude-standard`.split("\n")
# staged_md_files = staged_files.select { |file| File.extname(file) == '.md' }
abort 'Didn\'t find any modified files.'.blue if staged_files.empty?
path = staged_files.join(' ')
end
system "bin/image_optim --no-pngout --no-svgo --recursive #{path}"
end
end

0 comments on commit 62b2a1e

Please sign in to comment.