Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

slim module #10

Merged
merged 3 commits into from

2 participants

@panva

Hey,
just a quickly added slim module do as you please with it.

@pewniak747
Owner

hey @panva - could you just add checking for executable, in a way similar to
https://github.com/netguru/checker/blob/master/lib/checker/modules/haml.rb#L10

Filip Skokan added some commits
@pewniak747 pewniak747 merged commit 173a80b into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 8, 2012
  1. quickly added slim

    Filip Skokan authored
Commits on Aug 9, 2012
  1. executable check

    Filip Skokan authored
  2. readme updated once more

    Filip Skokan authored
This page is out of date. Refresh to see the latest.
View
4 README.md
@@ -68,7 +68,7 @@ To check only specific filetypes on commit, use `git config` :
git config checker.check 'ruby, haml, coffeescript'
```
-Available options are: ruby, haml, pry, coffeescript, sass
+Available options are: ruby, haml, pry, coffeescript, sass, slim
### Dependencies
@@ -76,4 +76,4 @@ For various modules to work you may need to install additional dependencies:
* coffeescript - `npm install -g coffee-script` - see https://github.com/jashkenas/coffee-script/
* javascript - install jsl binary - see http://www.javascriptlint.com/download.htm
-* haml & sass - `gem install haml` `gem install sass`
+* haml & sass & slim - `gem install haml sass slim`
View
1  lib/checker.rb
@@ -6,6 +6,7 @@
require "checker/modules/base"
require "checker/modules/ruby"
require "checker/modules/haml"
+require "checker/modules/slim"
require "checker/modules/pry"
require "checker/modules/coffeescript"
require "checker/modules/javascript"
View
21 lib/checker/modules/slim.rb
@@ -0,0 +1,21 @@
+module Checker
+ module Modules
+ class Slim < Base
+ extensions 'slim'
+ private
+ def check_one(file)
+ plain_command("slimrb --compile #{file} >> /dev/null")
+ end
+
+ def check_for_executable
+ command("slimrb -v", :use_bundler => true, :show_output => false, :append => ">> /dev/null 2>&1")
+ end
+
+ def dependency_message
+ str = "Executable not found\n"
+ str << "Install slim from rubygems: 'gem install slim'\n"
+ str
+ end
+ end
+ end
+end
View
18 spec/checker/modules/slim_spec.rb
@@ -0,0 +1,18 @@
+require 'spec_helper'
+
+describe Checker::Modules::Slim do
+ it 'should only check .slim files' do
+ files = ['a.rb', 'b.js.erb', 'c.r', 'd.yml', 'e.yaml', 'f.coffee', 'g.slim']
+ mod = Checker::Modules::Slim.new(files)
+ mod.stub(:check_for_executable).and_return(true)
+ mod.stub(:check_one_file).and_return(true)
+ mod.should_receive(:check_one_file).with('g.slim')
+ mod.should_not_receive(:check_one_file).with('f.coffee')
+ mod.should_not_receive(:check_one_file).with('e.yaml')
+ mod.should_not_receive(:check_one_file).with('d.yml')
+ mod.should_not_receive(:check_one_file).with('a.rb')
+ mod.should_not_receive(:check_one_file).with('b.js.erb')
+ mod.should_not_receive(:check_one_file).with('c.r')
+ mod.check
+ end
+end
Something went wrong with that request. Please try again.