Module: Codeguard

Defined in:
lib/codeguard.rb,
lib/codeguard/cli.rb,
lib/codeguard/diff.rb,
lib/codeguard/install.rb,
lib/codeguard/js_hint.rb,
lib/codeguard/rubocop.rb,
lib/codeguard/version.rb,
lib/codeguard/scss_lint.rb,
lib/codeguard/coffeelint.rb,
lib/codeguard/git_message.rb

Defined Under Namespace

Modules: CLI, Coffeelint, GitMessage, JSHint, Rubocop, SCSSLint Classes: Diff, Install

Constant Summary collapse

LINTERS =
[Coffeelint, GitMessage, JSHint, Rubocop, SCSSLint]
VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.config_pathObject



47
48
49
# File 'lib/codeguard.rb', line 47

def config_path
  gem_root.join('config')
end

.diffObject



21
22
23
24
25
26
27
28
29
# File 'lib/codeguard.rb', line 21

def diff
  lints = LINTERS.map do |lint|
    diff = Diff.perform(lint)
    [diff.diff, diff.message]
  end
  transposed = lints.transpose
  puts transposed.first.compact
  puts transposed.last.compact
end

.gem_rootObject



51
52
53
# File 'lib/codeguard.rb', line 51

def gem_root
  Pathname.new($LOAD_PATH.first).join('../')
end

.helpObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/codeguard.rb', line 31

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
  )
end

.installObject



15
16
17
18
19
# File 'lib/codeguard.rb', line 15

def install
  LINTERS.each do |lint|
    Install.perform(lint)
  end
end