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.
10 11 12 13 14 15 16 17 |
# File 'lib/zine/watcher.rb', line 10 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.
7 8 9 |
# File 'lib/zine/watcher.rb', line 7 def delete_array @delete_array end |
#listener_array ⇒ Object
Returns the value of attribute listener_array.
8 9 10 |
# File 'lib/zine/watcher.rb', line 8 def listener_array @listener_array end |
#upload_array ⇒ Object (readonly)
Returns the value of attribute upload_array.
7 8 9 |
# File 'lib/zine/watcher.rb', line 7 def upload_array @upload_array end |
Instance Method Details
#notice(file_name) ⇒ Object
19 20 21 |
# File 'lib/zine/watcher.rb', line 19 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
25 26 27 28 |
# File 'lib/zine/watcher.rb', line 25 def start watch_build_dir watch_source_dir end |