Class: BoxGrinder::FSObserver
- Inherits:
-
Object
- Object
- BoxGrinder::FSObserver
- Defined in:
- lib/boxgrinder-build/util/permissions/fs-observer.rb
Instance Attribute Summary collapse
-
#filter_set ⇒ Object
Returns the value of attribute filter_set.
-
#path_set ⇒ Object
Returns the value of attribute path_set.
Instance Method Summary collapse
-
#initialize(user, group, opts = {}) ⇒ FSObserver
constructor
ownership of.
-
#update(update = {}) ⇒ Object
Receives updates from FSMonitor#add_path.
Constructor Details
#initialize(user, group, opts = {}) ⇒ FSObserver
ownership of
34 35 36 37 38 39 40 41 |
# File 'lib/boxgrinder-build/util/permissions/fs-observer.rb', line 34 def initialize(user, group, opts={}) @path_set = Set.new(Array(opts[:paths])) # Filter some default directories, plus any subdirectories of # paths we discover at runtime @filter_set = Set.new([%r(^/(etc|dev|sys|bin|sbin|etc|lib|lib64|boot|run|proc|selinux|tmp)(/|$))]) @user = user @group = group end |
Instance Attribute Details
#filter_set ⇒ Object
Returns the value of attribute filter_set.
25 26 27 |
# File 'lib/boxgrinder-build/util/permissions/fs-observer.rb', line 25 def filter_set @filter_set end |
#path_set ⇒ Object
Returns the value of attribute path_set.
24 25 26 |
# File 'lib/boxgrinder-build/util/permissions/fs-observer.rb', line 24 def path_set @path_set end |
Instance Method Details
#update(update = {}) ⇒ Object
Receives updates from FSMonitor#add_path
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/boxgrinder-build/util/permissions/fs-observer.rb', line 54 def update(update={}) case update[:command] when :add_path unless match_filter?(update[:data]) @path_set.add(update[:data]) @filter_set.merge(subdirectory_regex(update[:data])) end when :stop_capture, :chown do_chown end end |