ruby-lint 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e5bbee286e1be1ba6f024458ccf916d7aaa6f6d
4
- data.tar.gz: 62be929b8a02f3e9fc701d3a9d5cc979d69614d1
3
+ metadata.gz: 26f5ebcb21cde063e50e4f8cc406f06632d686dd
4
+ data.tar.gz: b2496b982aae763c97b28b96570338e71f4b1ddc
5
5
  SHA512:
6
- metadata.gz: 45574e47f9dcb4017f64f80fd89bc8d7b10bffdbb4648ed3cc42b09373e04e3dd413a3ed4e68e84736082a1c377f0d6ce61b6b8729ef848bb26f0f4b4ce5574e
7
- data.tar.gz: ab7b40f9108af2d2d6879ccfddf806cff09f413f9fd6adc4d499d874934a266be36d6884eb9629761c8dbc86d14559171cc8ef3863e6a3faffedc4f94e2a2494
6
+ metadata.gz: 15371f1e7dc8130470e8ef9a5ea60e178cbddd60d10394ba6f77f40de77e2c053be9ab3e4864fe5feba714e0a6765a12d30bcacf88cbd2b81edf5ec27f2e2785
7
+ data.tar.gz: e257a03edb2834d66484d9969c4bcfd31c2ff12bd4e63da105bd217643d9c26182b78a1d17d37314f9ce2435821072af2f0c2a8ee1950a34bf72da1017cc7010
data/MANIFEST CHANGED
@@ -20,6 +20,7 @@ checksum/ruby-lint-0.9.0.gem.sha512
20
20
  checksum/ruby-lint-0.9.1.gem.sha512
21
21
  checksum/ruby-lint-1.0.0.gem.sha512
22
22
  checksum/ruby-lint-1.0.0.pre.preview1.gem.sha512
23
+ checksum/ruby-lint-1.0.1.gem.sha512
23
24
  doc/.gitkeep
24
25
  doc/DCO.md
25
26
  doc/architecture.md
@@ -0,0 +1 @@
1
+ 67b8deac49560700db3388a20cfff941fb852b70b6760a66bb8d5fc67b718623d88668eef9322484eeb88fd8609d91ab7c42fb30259c53c381f33b609a566187
@@ -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:
@@ -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
- default this is set to the current working directory which, for big projects,
120
- can slow things down.
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
 
@@ -237,7 +237,7 @@ module RubyLint
237
237
  # @return [Array]
238
238
  #
239
239
  def default_directories
240
- return [Dir.pwd]
240
+ return FileScanner.default_directories
241
241
  end
242
242
 
243
243
  ##
@@ -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 = [Dir.pwd], ignore = [])
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
@@ -1,3 +1,3 @@
1
1
  module RubyLint
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end # RubyLint
@@ -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.1
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-15 00:00:00.000000000 Z
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