module FileHelper
Direct including types
Defined in:
models/file_helper.crInstance Method Summary
-
#all_files : Array(String)
Get all files from CodeLocator
-
#get_files_by_extension(extension : String) : Array(String)
Get files filtered by extension (uses cached index for O(1) lookup)
-
#get_files_by_prefix(prefix : String) : Array(String)
Get files filtered by path prefix
-
#get_files_by_prefix_and_extension(prefix : String, extension : String) : Array(String)
Get files filtered by both prefix and extension
-
#get_public_dir_files(base_path : String, folder : String) : Array(String)
Helper to get public directories content from anywhere in the project
-
#get_public_files(base_path : String, anchors : Array(String) = ["shard.yml", "Gemfile"]) : Array(String)
Get public files (files that should be served as static content)
-
#populate_channel_with_files(channel : Channel(String))
Helper to populate a channel from file list instead of using Dir.glob
-
#populate_channel_with_filtered_files(channel : Channel(String), extension : String)
Helper to populate a channel with only files matching the given extension
-
#populate_channel_with_filtered_files(channel : Channel(String), extensions : Array(String))
Helper to populate a channel with files matching any of the given extensions
Instance Method Detail
Get files filtered by extension (uses cached index for O(1) lookup)
Get files filtered by path prefix
Get files filtered by both prefix and extension
Helper to get public directories content from anywhere in the project
Get public files (files that should be served as static content)
Returns files that are inside a public/ directory that is the
sibling of a manifest file (shard.yml for Crystal, Gemfile
for Ruby/Rails). The previous shape matched any */public/*
substring under base_path, which had a real false-positive
surface: a repo that hosts a Crystal framework fixture alongside
an unrelated static site (e.g. a built docs directory at
docs/public/) would have every file in the docs site surface
as a framework endpoint. The previous fix scoped to shard.yml
only, which broke Rails monorepos like App/Gemfile +
App/public/secret.html — App/public/* no longer surfaced
because there was no sibling shard.yml.
Helper to populate a channel from file list instead of using Dir.glob
Helper to populate a channel with only files matching the given extension
Helper to populate a channel with files matching any of the given extensions