Class: Texas::Task::Watch
- Extended by:
- OutputHelper
- Defined in:
- lib/texas/task/watch.rb
Class Attribute Summary collapse
-
.run_options ⇒ Object
Returns the value of attribute run_options.
Attributes inherited from Base
Class Method Summary collapse
-
.default_directories ⇒ Object
Returns the directories watched by default.
-
.directories ⇒ Object
Returns the directories watched, which can be extended.
- .directories_to_watch ⇒ Object
- .rebuild ⇒ Object
Instance Method Summary collapse
Methods included from OutputHelper
Methods inherited from Base
Constructor Details
This class inherits a constructor from Texas::Task::Base
Class Attribute Details
.run_options ⇒ Object
Returns the value of attribute run_options.
7 8 9 |
# File 'lib/texas/task/watch.rb', line 7 def end |
Class Method Details
.default_directories ⇒ Object
Returns the directories watched by default.
23 24 25 |
# File 'lib/texas/task/watch.rb', line 23 def default_directories [Texas.contents_subdir_name, "lib/", Texas.texas_dir] end |
.directories ⇒ Object
Returns the directories watched, which can be extended.
Example:
Texas::Task::Watch.directories << "images/"
32 33 34 |
# File 'lib/texas/task/watch.rb', line 32 def directories @@directories ||= default_directories end |
.directories_to_watch ⇒ Object
36 37 38 |
# File 'lib/texas/task/watch.rb', line 36 def directories_to_watch directories.uniq end |
.rebuild ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/texas/task/watch.rb', line 40 def rebuild started_at = Time.now.to_i Texas::Runner.new() finished_at = Time.now.to_i time = finished_at - started_at trace TraceInfo.new(:rebuild, "in #{time} seconds", :green) end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/texas/task/watch.rb', line 10 def run self.class. = .to_h.merge(:task => :build) dirs = Task::Watch.directories_to_watch Listen.to(*dirs) do |modified, added, removed| Task::Watch.rebuild end end |