Class: Tng::Services::FileDiscovery
- Inherits:
-
Object
- Object
- Tng::Services::FileDiscovery
- Defined in:
- lib/tng/services/file_discovery.rb
Constant Summary collapse
- DEFAULT_EXCLUDE_DIRS =
%w[ test spec features tmp log vendor node_modules coverage dist build .git db ].freeze
Class Method Summary collapse
Class Method Details
.list_ruby_files(root = Dir.pwd) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/tng/services/file_discovery.rb', line 14 def self.list_ruby_files(root = Dir.pwd) files = [] root = File.(root) Find.find(root) do |path| if File.directory?(path) name = File.basename(path) if DEFAULT_EXCLUDE_DIRS.include?(name) Find.prune else next end end next unless path.end_with?(".rb") next if Tng::Utils.ignored_path?(path) files << path end files end |
.relative_paths(root = Dir.pwd) ⇒ Object
37 38 39 40 |
# File 'lib/tng/services/file_discovery.rb', line 37 def self.relative_paths(root = Dir.pwd) root = File.(root) list_ruby_files(root).map { |p| p.sub(%r{\A#{Regexp.escape(root)}/?}, "") } end |