Class: Entangler::Executor::Base
- Inherits:
-
Object
- Object
- Entangler::Executor::Base
- Defined in:
- lib/entangler/executor/base.rb
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
readonly
Returns the value of attribute base_dir.
Instance Method Summary collapse
- #generate_abs_path(rel_path) ⇒ Object
-
#initialize(base_dir, opts = {}) ⇒ Base
constructor
A new instance of Base.
- #run ⇒ Object
- #strip_base_path(path, base_dir = self.base_dir) ⇒ Object
Constructor Details
#initialize(base_dir, opts = {}) ⇒ Base
Returns a new instance of Base.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/entangler/executor/base.rb', line 14 def initialize(base_dir, opts = {}) @base_dir = File.realpath(File.(base_dir)) @notify_sleep = 0 @exported_at = 0 @opts = opts @opts[:ignore] = [/^\/\.git.*/] unless @opts.has_key?(:ignore) @opts[:ignore] << /^\/\.entangler.*/ validate_opts logger.info("Starting executor") end |
Instance Attribute Details
#base_dir ⇒ Object (readonly)
Returns the value of attribute base_dir.
12 13 14 |
# File 'lib/entangler/executor/base.rb', line 12 def base_dir @base_dir end |
Instance Method Details
#generate_abs_path(rel_path) ⇒ Object
26 27 28 |
# File 'lib/entangler/executor/base.rb', line 26 def generate_abs_path(rel_path) File.join(self.base_dir, rel_path) end |
#run ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/entangler/executor/base.rb', line 34 def run start_notify_daemon start_local_io start_remote_io start_local_consumer logger.debug("NOTIFY PID: #{@notify_daemon_pid}") Signal.trap("INT") { kill_off_threads } wait_for_threads end |
#strip_base_path(path, base_dir = self.base_dir) ⇒ Object
30 31 32 |
# File 'lib/entangler/executor/base.rb', line 30 def strip_base_path(path, base_dir = self.base_dir) File.(path).sub(base_dir, '') end |