Skip to content

Instantly share code, notes, and snippets.

@th1agoalmeida
Created March 21, 2018 17:28
Show Gist options
  • Save th1agoalmeida/2a862ca3700d4d704d22a8ebd35b6b9b to your computer and use it in GitHub Desktop.
Save th1agoalmeida/2a862ca3700d4d704d22a8ebd35b6b9b to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
class Symbol
def with(*args, &block)
->(caller, *rest) { caller.send(self, *rest, *args, &block) }
end
end
require 'active_support/core_ext/string'
require 'colorize'
lines = `git status`.split("\n")
files = lines.select(&:starts_with?.with("\tmodified:"))
.select(&:ends_with?.with('.rb'))
.select(&:exclude?.with('db/'))
.map { |line| line.gsub("\tmodified:", '').strip }
s= "rubocop -a #{files.join(' ')}"
puts s.yellow
system s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment