lib/codeguard.rb in codeguard-0.1.0 vs lib/codeguard.rb in codeguard-0.2.0
- old
+ new
@@ -1,25 +1,35 @@
require 'diffy'
require 'codeguard/install'
+require 'codeguard/setup'
require 'codeguard/coffeelint'
require 'codeguard/js_hint'
require 'codeguard/rubocop'
require 'codeguard/scss_lint'
require 'codeguard/git_message'
require 'codeguard/diff'
+require 'codeguard/pre_commit'
module Codeguard
- LINTERS = [Coffeelint, GitMessage, JSHint, Rubocop, SCSSLint]
+ LINTERS = [Coffeelint, GitMessage, JSHint, PreCommit, Rubocop, SCSSLint]
+ # Lints that require setup in every local environment
+ LOCAL_LINTERS = [GitMessage, PreCommit]
module_function
def install
LINTERS.each do |lint|
Install.perform(lint)
end
end
+ def setup
+ LOCAL_LINTERS.each do |lint|
+ Setup.perform(lint)
+ end
+ end
+
def diff
lints = LINTERS.map do |lint|
diff = Diff.perform(lint)
[diff.diff, diff.message]
end
@@ -27,22 +37,10 @@
puts transposed.first.compact
puts transposed.last.compact
end
def help
- puts %(
- codeguard help - show this message
- codeguard install - install config for current project
- codeguard diff - check if the files were not modified
-
- The project will use configuration for:
- - coffeelint (http://www.coffeelint.org/)
- - js_hint (https://github.com/damian/jshint)
- - rubocop (https://github.com/bbatsov/rubocop)
- - scss_lint (https://github.com/brigade/scss-lint)
-
- .gitmessage file will be added as a template in .git/config
- )
+ puts IO.read(gem_root.join('HELP.md'))
end
def config_path
gem_root.join('config')
end