Created
February 1, 2014 17:16
-
-
Save andreionut/8755398 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# poor man's flycheck for Erlang | |
# It looks at the modified files via `git status`, compiles them, | |
# and displays the errors, if any. | |
# For simplicity it outputs the beam's in /tmp | |
@repo_root = `git rev-parse --show-toplevel`.strip | |
changed_files = `git status --porcelain`.split("\n") | |
@accepted_extensions = ["erl", "yrl", "rel"] | |
def can_check(file_name) | |
@accepted_extensions.include?(file_name.split(".").last) | |
end | |
changed_files.each do |file_section| | |
file_name = file_section.split(" ").last | |
# p File.join(@repo_root, file_name) | |
exec("erlc -v -o /tmp/ #{File.join(@repo_root, file_name)}") if can_check(file_name) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment