Module: Moult::CLI::Support
- Defined in:
- lib/moult/cli.rb
Overview
Tiny shared helpers for the command layer, so each command doesn't re-implement the same option plumbing. Lives on the always-loaded dispatcher.
Class Method Summary collapse
-
.build_rails(root_dir, files, enabled:) ⇒ Object
Build Rails entrypoint awareness, honouring a command's --[no-]rails option.
-
.discover(path) ⇒ Array(String, Array<String>)
Resolve a PATH argument to its analysis root and the Ruby files under it: a directory analyses its tree, a single file analyses just itself.
Class Method Details
.build_rails(root_dir, files, enabled:) ⇒ Object
Build Rails entrypoint awareness, honouring a command's --[no-]rails option.
40 41 42 43 44 |
# File 'lib/moult/cli.rb', line 40 def build_rails(root_dir, files, enabled:) return RailsConventions.new(rails: false) unless enabled RailsConventions.build(root: root_dir, files: files) end |
.discover(path) ⇒ Array(String, Array<String>)
Resolve a PATH argument to its analysis root and the Ruby files under it: a directory analyses its tree, a single file analyses just itself.
31 32 33 34 35 36 37 |
# File 'lib/moult/cli.rb', line 31 def discover(path) if File.directory?(path) [path, Discovery.ruby_files(path)] else [File.dirname(path), [path]] end end |