Class: Caligari::Application
- Inherits:
-
Object
- Object
- Caligari::Application
- Defined in:
- lib/caligari/application.rb
Overview
This class is instantiated and used to run a single invocation of the ‘caligari` application.
Constant Summary collapse
- FLAGS =
The flags to be passed to ‘Pathname#fnmatch?` to filter exclusions.
File::FNM_DOTMATCH | File::FNM_PATHNAME
- HOME =
The ‘Pathname` representation of the current user’s home directory.
Pathname.new(Dir.home)
Instance Method Summary collapse
-
#initialize(*paths, **options) ⇒ self
constructor
Instantiates a new Application instance.
-
#run ⇒ self
Runs Caligari.
Constructor Details
#initialize(*paths, **options) ⇒ self
Instantiates a new Caligari::Application instance.
24 25 26 27 28 29 30 |
# File 'lib/caligari/application.rb', line 24 def initialize(*paths, **) @paths = paths.map { |path| Pathname.new(path) } .each do |key, value| instance_variable_set(:"@#{key}", value) end collect_exclusions end |
Instance Method Details
#run ⇒ self
Runs Caligari.
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/caligari/application.rb', line 35 def run @paths.each do |path| fail "#{path} is not a valid path" unless path.directory? if @traverse Dir.chdir(path) do each_file(Pathname.new('.')) { |file| link(file) } end else each_file(path) { |file| link(file) } end end self end |