Class: Texas::Task::Watch
- Inherits:
-
Base
- Object
- Base
- Texas::Task::Watch
show all
- Defined in:
- lib/texas/task/watch.rb
Class Attribute Summary collapse
Attributes inherited from Base
#options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#build, #initialize
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 run_options
@run_options
end
|
Class Method Details
.directories_to_watch ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/texas/task/watch.rb', line 18
def self.directories_to_watch
arr = []
arr << "tex"
arr << "figures"
arr << Texas.texas_dir
arr
end
|
.rebuild ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/texas/task/watch.rb', line 26
def self.rebuild
started_at = Time.now.to_i
@build = Build::Final.new(run_options)
@build.run
finished_at = Time.now.to_i
puts (finished_at - started_at).to_s + " seconds to rebuild"
rescue Exception => e
puts @build.current_template.filename
puts "[ERROR] while building \n#{e}"
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.run_options = options
dirs = Task::Watch.directories_to_watch
Listen.to(*dirs) do |modified, added, removed|
Task::Watch.rebuild
end
end
|