Sha256: 6e55b8c532b1b3a5464dff71b26040366e5cb6cea7ee05484d20a13e44042d06
Contents?: true
Size: 897 Bytes
Versions: 5
Compression:
Stored size: 897 Bytes
Contents
# This (PreCommit) should be a module # ... it should also have a cooler name :P class PreCommit class JslintCheck attr_accessor :therubyracer_installed, :type def initialize(type = :all) @type = type @therubyracer_installed = check_for_therubyracer_install end def should_run? @therubyracer_installed end def call if should_run? run else $stderr.puts 'pre-commit: Skipping JSLint check (to run it: `gem install therubyracer`)' # pretend the check passed and move on true end end def run errors = check_to_run.call end def check_to_run @type == :all ? JSLintAll : JSLintNew end private def check_for_therubyracer_install require 'v8' @therubyracer_installed = true rescue LoadError @therubyracer_installed = false end end end
Version data entries
5 entries across 5 versions & 1 rubygems