Class: Zine::Watcher
- Inherits:
-
Object
- Object
- Zine::Watcher
- Defined in:
- lib/zine/watcher.rb
Overview
Watch files for changes
Instance Attribute Summary collapse
-
#delete_array ⇒ Object
readonly
Returns the value of attribute delete_array.
-
#listener_array ⇒ Object
Returns the value of attribute listener_array.
-
#upload_array ⇒ Object
readonly
Returns the value of attribute upload_array.
Instance Method Summary collapse
-
#initialize(posts_and_headlines, build_directory, source_directory) ⇒ Watcher
constructor
A new instance of Watcher.
- #notice(file_name) ⇒ Object
-
#start ⇒ Object
Build a delete list & an upload list for SSH from changes in build, & rebuild & reload on changes in source.
Constructor Details
#initialize(posts_and_headlines, build_directory, source_directory) ⇒ Watcher
Returns a new instance of Watcher.
12 13 14 15 16 17 18 19 |
# File 'lib/zine/watcher.rb', line 12 def initialize(posts_and_headlines, build_directory, source_directory) @posts_and_headlines = posts_and_headlines @build_directory = File.join Dir.pwd, build_directory @source_directory = File.join Dir.pwd, source_directory @upload_array = [] @delete_array = [] @listener_array = [] end |
Instance Attribute Details
#delete_array ⇒ Object (readonly)
Returns the value of attribute delete_array.
9 10 11 |
# File 'lib/zine/watcher.rb', line 9 def delete_array @delete_array end |
#listener_array ⇒ Object
Returns the value of attribute listener_array.
10 11 12 |
# File 'lib/zine/watcher.rb', line 10 def listener_array @listener_array end |
#upload_array ⇒ Object (readonly)
Returns the value of attribute upload_array.
9 10 11 |
# File 'lib/zine/watcher.rb', line 9 def upload_array @upload_array end |
Instance Method Details
#notice(file_name) ⇒ Object
21 22 23 |
# File 'lib/zine/watcher.rb', line 21 def notice(file_name) @upload_array << file_name end |
#start ⇒ Object
Build a delete list & an upload list for SSH from changes in build, & rebuild & reload on changes in source
27 28 29 30 |
# File 'lib/zine/watcher.rb', line 27 def start watch_build_dir watch_source_dir end |