source_finder 1.1.1 → 2.0.0

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: 5f0ed7746c3e8cb20286542ec1f8422d36f7587f
4
- data.tar.gz: 1bf701dde0a3f63497bbaddb7afa4a8b1ee80f76
3
+ metadata.gz: 851c2a4ec6bd2ead4c9e7a5ad526155bdb555585
4
+ data.tar.gz: a6f8aa0f029cd970c586382def9c3b7f7c97bfae
5
5
  SHA512:
6
- metadata.gz: fd449e925a4c7c2d09192708c8153db47d2c937e6c1f771d8c03593c1a0e9d1d26ec72b63d7dada63c556d34d1a4486ff19eb1b370ef0caf27446f498e5d907e
7
- data.tar.gz: c432353f11b645ee080e32bd85ca7774af74e9f091eb0a3f6837e303a11d4bc5a60b7b0c36ac6b1c3b355bd847fb48bca53023fdaeeb8ce50867f731797a8a5a
6
+ metadata.gz: 824b0ff4e7e1665578954d55f8de7d8b92d1f7f4ba2b1787226d07c044d640cc0afbef8481ba4b1aaf5b31bdd968d486b85ee5f07a90696d0ca7a2870c8cc3cb
7
+ data.tar.gz: 7a223cb12ad06a993c3e930a434541957814634c467f77fe429b30de3bb0eb2d65ba249e08d0aa54d0c1b69928da7a7fc96778743f2c1db7e0ddeef1acd16486
data/.rubocop.yml CHANGED
@@ -18,7 +18,7 @@ TrivialAccessors:
18
18
  ExactNameMatch: true
19
19
 
20
20
  #
21
- # Add 'XXX' to the standard list
21
+ # Add 'XX X' to the standard list
22
22
  #
23
23
  Style/CommentAnnotation:
24
24
  Keywords:
@@ -1 +1,5 @@
1
- {"result":{"covered_percent": 0.00}}
1
+ {
2
+ "result": {
3
+ "covered_percent": 97.78
4
+ }
5
+ }
@@ -4,75 +4,110 @@ module SourceFinder
4
4
  class SourceFileGlobber
5
5
  # See README.md for documentation on these configuration parameters.
6
6
 
7
- attr_accessor :ruby_dirs, :source_dirs, :extra_files, :extra_ruby_files,
8
- :ruby_file_extensions, :source_file_extensions,
9
- :exclude_files, :source_files_glob, :source_files_exclude_glob
7
+ attr_accessor :ruby_dirs_arr, :source_dirs_arr, :extra_source_files_arr,
8
+ :extra_ruby_files_arr, :ruby_file_extensions_arr,
9
+ :source_file_extensions_arr, :exclude_files_arr,
10
+ :source_files_glob, :source_files_exclude_glob
10
11
 
11
- def ruby_dirs
12
- @ruby_dirs ||= %w(src app lib test spec feature)
12
+ def initialize(globber: Dir)
13
+ @globber = globber
13
14
  end
14
15
 
15
- def source_dirs
16
- @source_dirs ||= ruby_dirs.clone
16
+ def ruby_dirs_arr
17
+ @ruby_dirs_arr ||= %w(src app lib test spec feature)
17
18
  end
18
19
 
19
- def extra_files
20
- @extra_files ||= extra_ruby_files.clone.concat(%w(Dockerfile))
20
+ def source_dirs_arr
21
+ @source_dirs_arr ||= ruby_dirs_arr.clone
21
22
  end
22
23
 
23
- def extra_ruby_files
24
- @extra_ruby_files ||= %w(Rakefile)
24
+ def extra_source_files_arr
25
+ @extra_source_files_arr ||=
26
+ extra_ruby_files_arr.clone.concat(%w(Dockerfile))
25
27
  end
26
28
 
27
- def exclude_files
29
+ def extra_ruby_files_arr
30
+ @extra_ruby_files_arr ||= %w(Rakefile)
31
+ end
32
+
33
+ def exclude_files_arr
28
34
  if @source_files_exclude_glob
29
35
  @globber.glob(@source_files_exclude_glob)
30
36
  else
31
- (@exclude_files || [])
37
+ (@exclude_files_arr || [])
32
38
  end
33
39
  end
34
40
 
35
- def source_file_extensions
36
- @source_file_extensions ||=
37
- "#{ruby_file_extensions},swift,cpp,c,java,py,clj,cljs,scala,js," \
38
- 'yml,sh,json'
41
+ def source_file_extensions_arr
42
+ @source_file_extensions_arr ||= ruby_file_extensions_arr +
43
+ %w(swift cpp c java py clj cljs scala js
44
+ yml sh json)
45
+ end
46
+
47
+ def doc_file_extensions_arr
48
+ @doc_file_extensions_arr ||= %w(md)
49
+ end
50
+
51
+ def source_file_extensions_glob
52
+ @source_file_extensions_glob ||= source_file_extensions_arr.join(',')
53
+ end
54
+
55
+ def source_and_doc_file_extensions_arr
56
+ doc_file_extensions_arr + source_file_extensions_arr
39
57
  end
40
58
 
41
- def source_files_glob(extra_source_files = extra_files,
42
- dirs = source_dirs,
43
- extensions = source_file_extensions)
44
- @source_files_glob ||
45
- "{#{extra_source_files.join(',')}," \
46
- "{*,.*}.{#{extensions}}," +
47
- File.join("{#{dirs.join(',')}}",
48
- '**',
49
- "{*,.*}.{#{extensions}}") +
50
- '}'
59
+ def source_and_doc_file_extensions_glob
60
+ @source_and_doc_file_extensions_glob ||=
61
+ source_and_doc_file_extensions_arr.join(',')
62
+ end
63
+
64
+ def source_files_glob
65
+ @source_files_glob || make_source_files_glob(extra_source_files_arr,
66
+ source_dirs_arr,
67
+ source_file_extensions_glob)
68
+ end
69
+
70
+ def source_and_doc_files_glob
71
+ make_source_files_glob(extra_source_files_arr,
72
+ source_dirs_arr,
73
+ source_and_doc_file_extensions_glob)
74
+ end
75
+
76
+ def make_source_files_glob(extra_source_files_arr,
77
+ dirs_arr,
78
+ extensions_glob)
79
+ "{#{extra_source_files_arr.join(',')}," \
80
+ "{*,.*}.{#{extensions_glob}}," +
81
+ File.join("{#{dirs_arr.join(',')}}",
82
+ '**',
83
+ "{*,.*}.{#{extensions_glob}}") +
84
+ '}'
51
85
  end
52
86
 
53
87
  def source_files_exclude_glob
54
- @source_files_exclude_glob ||
55
- "{#{exclude_files.join(', ')}}"
88
+ @source_files_exclude_glob || "{#{exclude_files_arr.join(', ')}}"
56
89
  end
57
90
 
58
- def ruby_file_extensions
59
- @ruby_file_extensions ||= 'rb,rake,gemspec'
91
+ def ruby_file_extensions_arr
92
+ @ruby_file_extensions_arr || %w(rb rake gemspec)
60
93
  end
61
94
 
62
- def ruby_files_glob
63
- source_files_glob(extra_ruby_files, ruby_dirs, ruby_file_extensions)
95
+ def ruby_file_extensions_glob
96
+ @ruby_file_extensions_glob ||= ruby_file_extensions_arr.join(',')
64
97
  end
65
98
 
66
- def ruby_files
67
- @globber.glob(ruby_files_glob) - exclude_files
99
+ def ruby_files_glob
100
+ make_source_files_glob(extra_ruby_files_arr,
101
+ ruby_dirs_arr,
102
+ ruby_file_extensions_glob)
68
103
  end
69
104
 
70
- def source_files
71
- @globber.glob(source_files_glob) - exclude_files
105
+ def ruby_files_arr
106
+ @globber.glob(ruby_files_glob) - exclude_files_arr
72
107
  end
73
108
 
74
- def initialize(globber: Dir)
75
- @globber = globber
109
+ def source_files_arr
110
+ @globber.glob(source_files_glob) - exclude_files_arr
76
111
  end
77
112
  end
78
113
  end
@@ -1,4 +1,4 @@
1
1
  # SourceFinder finds source and documentation files within a project.
2
2
  module SourceFinder
3
- VERSION = '1.1.1'
3
+ VERSION = '2.0.0'
4
4
  end
data/lib/source_finder.rb CHANGED
@@ -1,5 +1,6 @@
1
- require "source_finder/version"
1
+ require 'source_finder/version'
2
2
 
3
+ # SourceFinder finds source and documentation files within a project.
3
4
  module SourceFinder
4
5
  # Your code goes here...
5
6
  end
@@ -1 +1 @@
1
- 300
1
+ 278
@@ -1 +1 @@
1
- 1
1
+ 0
@@ -1 +1 @@
1
- 2
1
+ 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: source_finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-12 00:00:00.000000000 Z
11
+ date: 2015-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler