Sha256: 7152a1e6c362e0a0a1a1b0b01f90fe46915d4f1cc817a7573a919465db6beff2
Contents?: true
Size: 1.86 KB
Versions: 1
Compression:
Stored size: 1.86 KB
Contents
module DevboxLauncher class MutagenSession attr_reader :label, :config, :hostname def initialize(label:, config:, hostname:) @label = label @config = config @hostname = hostname end def create puts "Create mutagen session syncing local " \ "#{config.alpha_dir} with " \ "#{hostname} #{config.beta_dir}" create_stdout, create_stderr, create_status = Open3.capture3(create_cmd) if not create_status.success? # mutagen prints to stdout and stderr msg = "Failed to create mutagen sessions: " \ "#{create_stdout} -" \ "#{create_stderr}" fail msg end end def linux? OS.linux? end def create_cmd str = [ "mutagen sync create", config.alpha_dir, "#{hostname}:#{config.beta_dir}", "--label=#{label}", "--sync-mode=two-way-resolved", "--ignore-vcs", "--ignore=.DS_Store" ] str << "--watch-mode-alpha=no-watch" if linux? str.join(" ") end def terminate_cmd %Q(mutagen sync terminate --label-selector=#{label}) end def terminate puts "Terminating mutagen session..." terminate_stdout, terminate_stderr, terminate_status = Open3.capture3(terminate_cmd) if not terminate_status.success? # mutagen prints to stdout and stderr msg = "Failed to terminate mutagen sessions: " \ "#{terminate_stdout} -" \ "#{terminate_stderr}" fail msg end end def watch_alpha watchman.trigger("mutagen sync flush --label-selector=#{label}") end def watchman @watchman ||= Watchman.new(dir: config.alpha_dir) end def reset return if !config.configured? terminate create watch_alpha if linux? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devbox_launcher-1.1.1 | lib/devbox_launcher/models/mutagen_session.rb |