Skip to content

Instantly share code, notes, and snippets.

@mattm
Last active December 1, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattm/ffa3bb917e377caf4cfd to your computer and use it in GitHub Desktop.
Save mattm/ffa3bb917e377caf4cfd to your computer and use it in GitHub Desktop.
namespace :lint do
task run: :environment do
js_dir = "#{Rails.root}/app/assets/javascripts"
Dir.chdir(js_dir)
# No directories and no application.js
files = Dir.glob('*').delete_if{ |f| File.directory?(f) || f == 'application.js' }
files.each do |file|
puts file
# There is a likely way to do this with Rake::Task's `invoke` and `reenable` methods
# but I couldn't figure out how to get it to check more than the first file.
puts `rake eslint:run[#{js_dir}/#{file}]`
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment