Permalink
Browse files

fixing pry output, adding coffeescript syntax check

  • Loading branch information...
1 parent 69e489a commit 04321a9408feab6ef5a037bd4cdb2f00306ba5d1 @rindek rindek committed May 7, 2012
Showing with 37 additions and 2 deletions.
  1. +2 −1 lib/checker.rb
  2. +34 −0 lib/checker/modules/coffeescript.rb
  3. +1 −1 lib/checker/modules/pry.rb
View
@@ -4,4 +4,5 @@
require "checker/modules/all"
require "checker/modules/ruby"
require "checker/modules/haml"
-require "checker/modules/pry"
+require "checker/modules/pry"
+require "checker/modules/coffeescript"
@@ -0,0 +1,34 @@
+module Checker
+ module Modules
+ class Coffeescript
+ def self.check
+ puts ">> Coffeescript <<"
+
+ unless Coffeescript.check_for_executable
+ puts "coffee executable NOT FOUND, OMITTING..."
+ return true
+ end
+
+ files = Utils.files_modified
+ files.delete_if {|f| !f.ends_with?(".coffee")}
+
+ files.map! do |f|
+ puts "Checking #{f}..."
+ Coffeescript.check_one(f)
+ end
+
+ files.all_true?
+ end
+
+ def self.check_one(file)
+ system("cat #{file} | egrep -v '^//=' | coffee -sc > /dev/null")
+ end
+
+ def self.check_for_executable
+ cmd = "coffee -v"
+ system(cmd)
+ $?.exitstatus == 0
+ end
+ end
+ end
+end
@@ -7,7 +7,7 @@ def self.check
files = Utils.files_modified
files.map! do |f|
- print "Checking #{f} -> "
+ puts "Checking #{f}... "
[Pry.check_for_binding_pry(f), Pry.check_for_binding_remote_pry(f)].all_true?
end

0 comments on commit 04321a9

Please sign in to comment.