ruby-lint 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/MANIFEST +1 -0
- data/checksum/ruby-lint-1.0.1.gem.sha512 +1 -0
- data/doc/changelog.md +7 -0
- data/doc/configuration.md +3 -3
- data/lib/ruby-lint/configuration.rb +1 -1
- data/lib/ruby-lint/file_scanner.rb +28 -5
- data/lib/ruby-lint/version.rb +1 -1
- data/spec/ruby-lint/file_scanner_spec.rb +13 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26f5ebcb21cde063e50e4f8cc406f06632d686dd
|
4
|
+
data.tar.gz: b2496b982aae763c97b28b96570338e71f4b1ddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15371f1e7dc8130470e8ef9a5ea60e178cbddd60d10394ba6f77f40de77e2c053be9ab3e4864fe5feba714e0a6765a12d30bcacf88cbd2b81edf5ec27f2e2785
|
7
|
+
data.tar.gz: e257a03edb2834d66484d9969c4bcfd31c2ff12bd4e63da105bd217643d9c26182b78a1d17d37314f9ce2435821072af2f0c2a8ee1950a34bf72da1017cc7010
|
data/MANIFEST
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
67b8deac49560700db3388a20cfff941fb852b70b6760a66bb8d5fc67b718623d88668eef9322484eeb88fd8609d91ab7c42fb30259c53c381f33b609a566187
|
data/doc/changelog.md
CHANGED
@@ -5,6 +5,13 @@ This document contains a short summary of the various releases of ruby-lint.
|
|
5
5
|
For a full list of commits included in each release see the corresponding Git
|
6
6
|
tags (named after the versions).
|
7
7
|
|
8
|
+
## 1.0.2 - 2013-12-19
|
9
|
+
|
10
|
+
This release changes the default file scanner directories from `$PWD` to
|
11
|
+
`$PWD/app` and `$PWD/lib` as the former proved to be too much trouble. This
|
12
|
+
release also changes the pre-globbing of the file scanner so that it only
|
13
|
+
starts looking for files when actually needed.
|
14
|
+
|
8
15
|
## 1.0.1 - 2013-12-15
|
9
16
|
|
10
17
|
A small bugfix release that contains the following changes/fixes:
|
data/doc/configuration.md
CHANGED
@@ -115,9 +115,9 @@ Example:
|
|
115
115
|
|
116
116
|
### directories
|
117
117
|
|
118
|
-
A list of directories to search in for externally defined constants. By
|
119
|
-
|
120
|
-
|
118
|
+
A list of directories to search in for externally defined constants. By default
|
119
|
+
this is set to `$PWD/app` and `$PWD/lib` (depending on which directories
|
120
|
+
exist). For most applications you do not need to change this value.
|
121
121
|
|
122
122
|
Example:
|
123
123
|
|
@@ -12,11 +12,34 @@ module RubyLint
|
|
12
12
|
class FileScanner
|
13
13
|
attr_reader :directories, :ignore
|
14
14
|
|
15
|
+
##
|
16
|
+
# Array containing names of directories that (often) contain Ruby source
|
17
|
+
# files.
|
18
|
+
#
|
19
|
+
# @return [Array]
|
20
|
+
#
|
21
|
+
RUBY_DIRECTORIES = %w{app lib}
|
22
|
+
|
23
|
+
##
|
24
|
+
# @return [Array]
|
25
|
+
#
|
26
|
+
def self.default_directories
|
27
|
+
directories = []
|
28
|
+
|
29
|
+
RUBY_DIRECTORIES.each do |dir|
|
30
|
+
path = File.join(Dir.pwd, dir)
|
31
|
+
|
32
|
+
directories << path if File.directory?(path)
|
33
|
+
end
|
34
|
+
|
35
|
+
return directories
|
36
|
+
end
|
37
|
+
|
15
38
|
##
|
16
39
|
# @param [Array] directories A collection of base directories to search in.
|
17
40
|
# @param [Array] ignore A list of paths to ignore.
|
18
41
|
#
|
19
|
-
def initialize(directories =
|
42
|
+
def initialize(directories = self.class.default_directories, ignore = [])
|
20
43
|
unless directories.respond_to?(:each)
|
21
44
|
raise TypeError, 'Directories must be specified as an Enumerable'
|
22
45
|
end
|
@@ -26,10 +49,6 @@ module RubyLint
|
|
26
49
|
|
27
50
|
# Hash that will contain the matching file paths for a given constant.
|
28
51
|
@constant_paths_cache = {}
|
29
|
-
|
30
|
-
# Globbing all files at once and then comparing those results is faster
|
31
|
-
# than running a Dir.glob for every call to #scan.
|
32
|
-
@glob_cache = Dir.glob("#{directories.join(',')}/**/*.rb")
|
33
52
|
end
|
34
53
|
|
35
54
|
##
|
@@ -41,6 +60,10 @@ module RubyLint
|
|
41
60
|
# @return [Array]
|
42
61
|
#
|
43
62
|
def scan(constant)
|
63
|
+
# Globbing all files at once and then comparing those results is faster
|
64
|
+
# than running a Dir.glob for every call to #scan.
|
65
|
+
@glob_cache ||= Dir.glob("#{directories.join(',')}/**/*.rb")
|
66
|
+
|
44
67
|
unless constant_paths_cached?(constant)
|
45
68
|
build_constant_paths_cache(constant)
|
46
69
|
end
|
data/lib/ruby-lint/version.rb
CHANGED
@@ -10,6 +10,19 @@ describe RubyLint::FileScanner do
|
|
10
10
|
lambda { RubyLint::FileScanner.new(10) }.should raise_error(TypeError)
|
11
11
|
end
|
12
12
|
|
13
|
+
example 'set the default directories' do
|
14
|
+
scanner = RubyLint::FileScanner.new
|
15
|
+
|
16
|
+
scanner.directories.empty?.should == false
|
17
|
+
end
|
18
|
+
|
19
|
+
example 'do not include non existing directories' do
|
20
|
+
app = File.join(Dir.pwd, 'app')
|
21
|
+
scanner = RubyLint::FileScanner.new
|
22
|
+
|
23
|
+
scanner.directories.include?(app).should == false
|
24
|
+
end
|
25
|
+
|
13
26
|
example 'finding a class' do
|
14
27
|
scanner = RubyLint::FileScanner.new([@lib_dir])
|
15
28
|
paths = scanner.scan('Example::User')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yorick Peterse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -213,6 +213,7 @@ files:
|
|
213
213
|
- checksum/ruby-lint-0.9.1.gem.sha512
|
214
214
|
- checksum/ruby-lint-1.0.0.gem.sha512
|
215
215
|
- checksum/ruby-lint-1.0.0.pre.preview1.gem.sha512
|
216
|
+
- checksum/ruby-lint-1.0.1.gem.sha512
|
216
217
|
- doc/.gitkeep
|
217
218
|
- doc/DCO.md
|
218
219
|
- doc/architecture.md
|