Sha256: 3e14a7fc337eb75a8e0d32df8b0150279e28f9a9f67d562dd6fe20c4c6962d34
Contents?: true
Size: 897 Bytes
Versions: 1
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`)' # pretent 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pre-commit-0.1.6 | lib/pre-commit/checks/jslint_check.rb |