coffeelint 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjU4NTEwYjRmMGY0ZjJmNTZhMzA2ZWZlMjE1OWUyODgwZTIyNTFiYQ==
4
+ YjgyMzIyZWJlMmU1MjEwZjBhZWRlZDA5M2MyYmEwZWQ4MzU5ZTc0ZQ==
5
5
  data.tar.gz: !binary |-
6
- OTcwYjBjYmYxMDQ2YmE4YTcxZDk1MDQzOWI0ZDcwNjUzMDRkMjA1Ng==
6
+ ZDFiMmUzMzAwOGIzMzZjMDkyNjkzNTRkMzZkYTc1MzZjZDg4NzJkOA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MzkzNWMwNDg3YzNmYTIyNmQ2MWVmZjIxNTMwYmNlODhmOGZkNzA3NWYyMTQ2
10
- NmFmYjZmMWNhNTQwMjUwZDM0MjVkMzJlZTI0NWNhYzExZmIwZTBkMWQzYmIx
11
- MTRkZjdmZGU3ZDM0YTA0OTgyMDU1YWEyYmUxNDI1ZDlhNmQwYzg=
9
+ ZDQxODdhZmMzYTYxNGQyMDUwMzNmYmNhMDc2Y2Y2YmY2NzY0NTA4MWI2Mjg2
10
+ ZjZhY2UxMTQxYmJlYjEyMGQyY2Q5NTBlYTE4NGM5MzA4NjMyMWM0OTFkNWVi
11
+ NTJlOGYwM2Y3MmJjYTBhMWZiY2FmMWVkYmRhNTRkMGZlYTNlMjE=
12
12
  data.tar.gz: !binary |-
13
- ZTUzMzI4NDBlYzFmNzg2NDFhNmE2OTE5NTMxOTZmM2QwMDY5ZTc0MjdhNmMx
14
- NzA1YTQxNWE3NmQzNTQwNjQ3ZjIzZDcxODJjYmU3OGQ2ZjIyMzk5ZWU2ZTBi
15
- ZjA5OTZiZjk0MDk3ZWQ1NmUyMzliZTAzN2U0Y2RhYjhkMjdlM2E=
13
+ YThmMTNhMjUzZThhNDZkODk2YzA3NzRlZTg0YmI2OGUzODkzY2JiYWQ2NjA0
14
+ ZGRkNjYzOWUyZmU1YThjYmEyNDE2OGY1ODMzZmY0NzJiODNhOTBmN2I4MDE2
15
+ Y2I2ZjY2ZTRmM2NlYjZlNzFhYTg1ZDI2YmVkNmMxMWMzYjA0ZDU=
data/README.md CHANGED
@@ -31,14 +31,22 @@ lint_reports = Coffeelint.lint_dir(directory)
31
31
  Coffeelint.lint_dir(directory) do |filename, lint_report|
32
32
  puts filename
33
33
  puts lint_report
34
+ Coffeelint.display_test_results(filename, lint_report)
34
35
  end
36
+ Coffeelint.run_test(filename of coffeescript source) # Run tests and print pretty results (return true/false)
37
+ Coffeelint.run_test_suite(directory) # Runs a pretty report recursively for a directory (return true/false)
35
38
  ```
36
39
 
37
40
  Additionally, if you are using rails you also get the rake task:
38
41
 
39
42
  rake coffeelint
40
43
 
41
- Which will run the test on any *.coffee file in your project
44
+ Which will run the test on any *.coffee file in your `app` or `spec` directories
45
+
46
+ Finally, there is a command line utility that allows you to run standalone tests:
47
+
48
+ coffeelint <filename>
49
+ coffeelint -r <directory>
42
50
 
43
51
  ## Contributing
44
52
 
data/Rakefile CHANGED
@@ -1,5 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ RSpec::Core::RakeTask.new('spec')
4
+
5
+ task :default => :spec
2
6
 
3
7
  task :console do
4
8
  sh "irb -rubygems -I lib -r coffeelint.rb"
5
9
  end
10
+
@@ -402,7 +402,7 @@ class LexicalLinter
402
402
  lintToken : (token) ->
403
403
  [type, value, lineNumber] = token
404
404
 
405
- lineNumber = lineNumber["first_line"] if lineNumber["first_line"]?
405
+ lineNumber = lineNumber.first_line if lineNumber?.first_line?
406
406
  @tokensByLine[lineNumber] ?= []
407
407
  @tokensByLine[lineNumber].push(token)
408
408
  # CoffeeScript loses line numbers of interpolations and multi-line
data/coffeelint.gemspec CHANGED
@@ -20,4 +20,7 @@ Gem::Specification.new do |gem|
20
20
  gem.require_paths = ["lib"]
21
21
 
22
22
  gem.add_dependency "coffee-script"
23
+
24
+ gem.add_development_dependency 'rspec'
25
+ gem.add_development_dependency 'rake'
23
26
  end
@@ -1,3 +1,3 @@
1
1
  module Coffeelint
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/coffeelint.rb CHANGED
@@ -24,7 +24,7 @@ module Coffeelint
24
24
  retval = {}
25
25
  Dir.glob("#{directory}/**/*.coffee") do |name|
26
26
  retval[name] = Coffeelint.lint_file(name)
27
- yield name, retval[name]
27
+ yield name, retval[name] if block_given?
28
28
  end
29
29
  retval
30
30
  end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coffeelint do
4
+ it 'should error with semicolon' do
5
+ results = Coffeelint.lint('apple;')
6
+ results.length.should == 1
7
+ result = results[0]
8
+ result['message'].should include 'trailing semicolon'
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'rspec'
2
+ require 'coffeelint'
3
+
4
+ RSpec.configure do |config|
5
+ config.color_enabled = true
6
+ config.formatter = 'documentation'
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coffeelint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Bush
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-06 00:00:00.000000000 Z
11
+ date: 2013-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-script
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  description: Ruby bindings for coffeelint
28
56
  email:
29
57
  - zach@zmbush.com
@@ -44,6 +72,8 @@ files:
44
72
  - lib/coffeelint/railtie.rb
45
73
  - lib/coffeelint/version.rb
46
74
  - lib/tasks/coffeelint.rake
75
+ - spec/coffeelint_spec.rb
76
+ - spec/spec_helper.rb
47
77
  - coffeelint/src/coffeelint.coffee
48
78
  homepage: https://github.com/zipcodeman/coffeelint-ruby
49
79
  licenses:
@@ -69,4 +99,6 @@ rubygems_version: 2.0.3
69
99
  signing_key:
70
100
  specification_version: 4
71
101
  summary: Ruby bindings for coffeelint along with railtie to add rake task to rails
72
- test_files: []
102
+ test_files:
103
+ - spec/coffeelint_spec.rb
104
+ - spec/spec_helper.rb