Class: Overmind::CLI
- Inherits:
-
Object
- Object
- Overmind::CLI
- Defined in:
- lib/overmind/cli.rb
Overview
Command-line interface for running golang library Overmind It ensures that the necessary dependencies, such as tmux, are present and runs Overmind with any provided arguments.
Constant Summary collapse
- SUPPORTED_OS_REGEX =
/darwin|linux|bsd/i
- LIBRARY_PATH =
Path to the library’s executable files
File.("#{File.dirname(__FILE__)}/../../libexec")
- OVERMIND_PATH =
"#{LIBRARY_PATH}/overmind"
- TMUX_FOLDER_PATH =
"#{LIBRARY_PATH}/prebuilt-tmux/bin"
- TMUX_PATH =
"#{TMUX_FOLDER_PATH}/tmux"
Instance Method Summary collapse
Instance Method Details
#run(args = []) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/overmind/cli.rb', line 15 def run(args = []) os_validate! validate_tmux_present! validate_overmind_present! # Ensures arguments are properly quoted if they contain spaces args = args.map { |x| x.include?(" ") ? "'#{x}'" : x } # Use prebuild tmux if found path_with_tmux = File.exist?(TMUX_PATH) ? "#{TMUX_FOLDER_PATH}:#{ENV["PATH"]}" : ENV["PATH"] # exec the Overmind process with modified PATH if necessary exec({"PATH" => path_with_tmux}, "#{OVERMIND_PATH} #{args.join(" ")}") end |