Sha256: e0b6dad86019f51d59cebf384b6bb2c87650e36252ec8f61b5c7326a8e64eb6e

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

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, 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
    transposed = lints.transpose
    puts transposed.first.compact
    puts transposed.last.compact
  end

  def help
    puts IO.read(gem_root.join('HELP.md'))
  end

  def config_path
    gem_root.join('config')
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codeguard-0.2.0 lib/codeguard.rb