Skip to content

Instantly share code, notes, and snippets.

@andreionut
Created February 1, 2014 17:16
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 andreionut/8755398 to your computer and use it in GitHub Desktop.
Save andreionut/8755398 to your computer and use it in GitHub Desktop.
#!/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