Class: Zio::Up
- Inherits:
-
Object
- Object
- Zio::Up
- Includes:
- Celluloid, Celluloid::Notifications
- Defined in:
- lib/zio/up.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #_paths ⇒ Object
-
#initialize(options = {}) ⇒ Up
constructor
Celluloid.logger = nil.
- #pull(path) ⇒ Object
- #up ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Up
Celluloid.logger = nil
54 55 56 57 |
# File 'lib/zio/up.rb', line 54 def initialize(={}) @options = raise MISSING_ARGUMENTS unless [:dir] || [:set] end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
48 49 50 |
# File 'lib/zio/up.rb', line 48 def @options end |
Instance Method Details
#_paths ⇒ Object
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/zio/up.rb', line 72 def _paths return [:set] unless [:set].nil? @_paths ||= begin Dir.foreach([:dir]).map do |path| next if path == '.' || path == '..' || !File.exists?(File.(path, [:dir]) + '/.git') ab_path = File.(path, [:dir]) File.directory?(ab_path) ? ab_path : nil end.compact end end |
#pull(path) ⇒ Object
67 68 69 70 |
# File 'lib/zio/up.rb', line 67 def pull(path) stdout, stderr, status = Open3.capture3("cd #{path} && git stash && git checkout master && git pull --rebase") publish 'up_capture_complete', [path, stdout, stderr, status] end |
#up ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/zio/up.rb', line 59 def up publish 'up_paths', _paths _paths.each do |path| sleep 0.2 if [:slow] self.class.new().async.pull(path) end end |