module Zap::Utils::File

Defined in:

utils/file.cr

Constant Summary

ALWAYS_IGNORED = [".git", "CVS", ".svn", ".hg", ".lock-wscript", ".wafpickle-N", ".*.swp", ".DS_Store", "._*", "npm-debug.log", ".npmrc", "node_modules", "config.gypi", "*.orig", "package-lock.json"] of ::String
ALWAYS_INCLUDED = ["/package.json", "/README.*", "/Readme.*", "/readme.*", "/LICENSE.*", "/License.*", "/license.*", "/LICENCE.*", "/Licence.*", "/licence.*"] of ::String

See: https://docs.npmjs.com/cli/v9/configuring-npm/package-json#files

Class Method Summary

Class Method Detail

def self.can_hardlink?(source : Path | String, dest : Path | String, *, tempfile_name : String | Nil = nil) : Bool #

[View source]
def self.crawl(directory : Path | String, *, always_included : Git::Ignore | Nil = nil, always_excluded : Git::Ignore | Nil = nil, included : Git::Ignore | Nil = nil, excluded : Git::Ignore | Nil = nil, path_prefix = Path.new, &block : Path -> Bool | Nil) #

[View source]
def self.crawl_package_files(directory : Path, &block : Path -> Bool | Nil) #

Crawl a package and yield directories and files that are not ignored by git and included in the package.json files field.


[View source]
def self.delete_file_or_dir?(path : Path) : Bool #

[View source]
def self.find_package_files(path : String | Path) : PackagesData #

[View source]
def self.join(*paths : Path | String) : String #

[View source]
def self.linkeable_ancestor?(path : Path) : String | Nil #

[View source]
def self.recursively(path : Path | String, relative_path : Path = Path.new, &block : Path, Path -> Nil) #

[View source]
def self.tempname(prefix : String | Nil = nil, suffix : String | Nil = nil) : String #

[View source]
def self.with_flock(path : Path | String, *, file : ::File | Nil = nil, shared = false, close_fd = true, unlock_flock = true, &block : ::File -> T) forall T #

[View source]