Class: SourceFinder::SourceFileGlobber
- Inherits:
-
Object
- Object
- SourceFinder::SourceFileGlobber
- Defined in:
- lib/source_finder/source_file_globber.rb
Overview
Give configuration, finds source file locations by using an inclusion and exclusion glob
Instance Attribute Summary collapse
-
#exclude_files_arr ⇒ Object
See README.md for documentation on these configuration parameters.
-
#extra_ruby_files_arr ⇒ Object
See README.md for documentation on these configuration parameters.
-
#extra_source_files_arr ⇒ Object
See README.md for documentation on these configuration parameters.
-
#ruby_dirs_arr ⇒ Object
See README.md for documentation on these configuration parameters.
-
#ruby_file_extensions_arr ⇒ Object
See README.md for documentation on these configuration parameters.
-
#source_dirs_arr ⇒ Object
See README.md for documentation on these configuration parameters.
-
#source_file_extensions_arr ⇒ Object
See README.md for documentation on these configuration parameters.
-
#source_file_extensions_glob ⇒ Object
See README.md for documentation on these configuration parameters.
-
#source_files_exclude_glob ⇒ Object
See README.md for documentation on these configuration parameters.
-
#source_files_glob ⇒ Object
See README.md for documentation on these configuration parameters.
Instance Method Summary collapse
- #doc_file_extensions_arr ⇒ Object
-
#initialize(globber: Dir) ⇒ SourceFileGlobber
constructor
A new instance of SourceFileGlobber.
- #make_source_files_glob(extra_source_files_arr, dirs_arr, extensions_glob) ⇒ Object
- #ruby_file_extensions_glob ⇒ Object
- #ruby_files_arr ⇒ Object
- #ruby_files_glob ⇒ Object
- #source_and_doc_file_extensions_arr ⇒ Object
- #source_and_doc_file_extensions_glob ⇒ Object
- #source_and_doc_files_glob ⇒ Object
- #source_files_arr ⇒ Object
Constructor Details
#initialize(globber: Dir) ⇒ SourceFileGlobber
Returns a new instance of SourceFileGlobber.
13 14 15 |
# File 'lib/source_finder/source_file_globber.rb', line 13 def initialize(globber: Dir) @globber = globber end |
Instance Attribute Details
#exclude_files_arr ⇒ Object
See README.md for documentation on these configuration parameters.
7 8 9 |
# File 'lib/source_finder/source_file_globber.rb', line 7 def exclude_files_arr @exclude_files_arr end |
#extra_ruby_files_arr ⇒ Object
See README.md for documentation on these configuration parameters.
7 8 9 |
# File 'lib/source_finder/source_file_globber.rb', line 7 def extra_ruby_files_arr @extra_ruby_files_arr end |
#extra_source_files_arr ⇒ Object
See README.md for documentation on these configuration parameters.
7 8 9 |
# File 'lib/source_finder/source_file_globber.rb', line 7 def extra_source_files_arr @extra_source_files_arr end |
#ruby_dirs_arr ⇒ Object
See README.md for documentation on these configuration parameters.
7 8 9 |
# File 'lib/source_finder/source_file_globber.rb', line 7 def ruby_dirs_arr @ruby_dirs_arr end |
#ruby_file_extensions_arr ⇒ Object
See README.md for documentation on these configuration parameters.
7 8 9 |
# File 'lib/source_finder/source_file_globber.rb', line 7 def ruby_file_extensions_arr @ruby_file_extensions_arr end |
#source_dirs_arr ⇒ Object
See README.md for documentation on these configuration parameters.
7 8 9 |
# File 'lib/source_finder/source_file_globber.rb', line 7 def source_dirs_arr @source_dirs_arr end |
#source_file_extensions_arr ⇒ Object
See README.md for documentation on these configuration parameters.
7 8 9 |
# File 'lib/source_finder/source_file_globber.rb', line 7 def source_file_extensions_arr @source_file_extensions_arr end |
#source_file_extensions_glob ⇒ Object
See README.md for documentation on these configuration parameters.
7 8 9 |
# File 'lib/source_finder/source_file_globber.rb', line 7 def source_file_extensions_glob @source_file_extensions_glob end |
#source_files_exclude_glob ⇒ Object
See README.md for documentation on these configuration parameters.
7 8 9 |
# File 'lib/source_finder/source_file_globber.rb', line 7 def source_files_exclude_glob @source_files_exclude_glob end |
#source_files_glob ⇒ Object
See README.md for documentation on these configuration parameters.
7 8 9 |
# File 'lib/source_finder/source_file_globber.rb', line 7 def source_files_glob @source_files_glob end |
Instance Method Details
#doc_file_extensions_arr ⇒ Object
48 49 50 |
# File 'lib/source_finder/source_file_globber.rb', line 48 def doc_file_extensions_arr @doc_file_extensions_arr ||= %w(md) end |
#make_source_files_glob(extra_source_files_arr, dirs_arr, extensions_glob) ⇒ Object
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/source_finder/source_file_globber.rb', line 77 def make_source_files_glob(extra_source_files_arr, dirs_arr, extensions_glob) "{#{extra_source_files_arr.join(',')}," \ "{*,.*}.{#{extensions_glob}}," + File.join("{#{dirs_arr.join(',')}}", '**', "{*,.*}.{#{extensions_glob}}") + '}' end |
#ruby_file_extensions_glob ⇒ Object
96 97 98 |
# File 'lib/source_finder/source_file_globber.rb', line 96 def ruby_file_extensions_glob @ruby_file_extensions_glob ||= ruby_file_extensions_arr.join(',') end |
#ruby_files_arr ⇒ Object
106 107 108 |
# File 'lib/source_finder/source_file_globber.rb', line 106 def ruby_files_arr @globber.glob(ruby_files_glob) - exclude_files_arr end |
#ruby_files_glob ⇒ Object
100 101 102 103 104 |
# File 'lib/source_finder/source_file_globber.rb', line 100 def ruby_files_glob make_source_files_glob(extra_ruby_files_arr, ruby_dirs_arr, ruby_file_extensions_glob) end |
#source_and_doc_file_extensions_arr ⇒ Object
56 57 58 |
# File 'lib/source_finder/source_file_globber.rb', line 56 def source_and_doc_file_extensions_arr doc_file_extensions_arr + source_file_extensions_arr end |
#source_and_doc_file_extensions_glob ⇒ Object
60 61 62 63 |
# File 'lib/source_finder/source_file_globber.rb', line 60 def source_and_doc_file_extensions_glob @source_and_doc_file_extensions_glob ||= source_and_doc_file_extensions_arr.join(',') end |
#source_and_doc_files_glob ⇒ Object
71 72 73 74 75 |
# File 'lib/source_finder/source_file_globber.rb', line 71 def source_and_doc_files_glob make_source_files_glob(extra_source_files_arr, source_dirs_arr, source_and_doc_file_extensions_glob) end |
#source_files_arr ⇒ Object
110 111 112 |
# File 'lib/source_finder/source_file_globber.rb', line 110 def source_files_arr @globber.glob(source_files_glob) - exclude_files_arr end |