Sha256: e786660560caf4b671a1cee94cbd6b2bebea0e93c6ac3446a049dea85af2bcd0

Contents?: true

Size: 953 Bytes

Versions: 5

Compression:

Stored size: 953 Bytes

Contents

#!/usr/bin/env ruby

##
# First you should npm install -g coffeelint
#
# Use:
#
# => cfl
# => cfl all
# => cfl last
# => cfl last 3
#

ARGV.push "all"

class LintRunner
  attr_reader :files

  def initialize
    # Find all coffee files, sort by last modified time
    @files = Dir['**/*.coffee'].sort_by { |f| File.mtime(f) }
    @printed = 0
  end

  def lint(index)
    if (@printed > 0)
      puts "----------------------------------------------------------------------------\n\n"
    end

    file = @files[index]
    system "coffeelint #{file}"
    @printed = @printed + 1
  end
end

runner = LintRunner.new

# Lint based on args
if ARGV.length > 0
  if ARGV[0] == 'last'
    if ARGV[1]
      ARGV[1].to_i.times {|i| runner.lint i }
    else 
      runner.lint 0
    end
  elsif ARGV[0] == 'all'
    runner.files.length.times {|i| runner.lint i }
  elsif ARGV[0] == 'list'
    runner.files.each {|f| puts "  #{f}" }
  end
else
  runner.lint 0
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bait-0.5.13 examples/coffeescript/coffeelint.rb
bait-0.5.12 examples/coffeescript/coffeelint.rb
bait-0.5.11 examples/coffeescript/coffeelint.rb
bait-0.5.10 examples/coffeescript/coffeelint.rb
bait-0.5.9 examples/coffeescript/coffeelint.rb