Skip to content

Commit

Permalink
Add option for additional ssh options
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuay03 committed Jan 22, 2024
1 parent 0b870b9 commit 6af05c8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Options:
All paths should be relative to the base sync directory.
-p, --port PORT Overwrite the SSH port (usually 22)
(doesn't do anything in slave mode)
--ssh-options '-F ./config' Additional SSH options
(doesn't do anything in slave mode)
--force-polling Forces the use of the listen polling adapter
(works cross-platform, generally slower, doesn't do anything in slave mode)
--no-rvm Skip attempting to load RVM on remote
Expand Down
4 changes: 4 additions & 0 deletions exe/entangler
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ OptionParser.new do |opts|
value_opt(options, opts, :port, '-p', '--port PORT', 'Overwrite the SSH port (usually 22)',
"(doesn't do anything in slave mode)")

value_opt(options, opts, :ssh_options, "--ssh-options '-F ./config'", 'Additional SSH options',
"(doesn't do anything in slave mode)")

bool_opt(options, opts, :force_polling, '--force-polling',
'Forces the use of the listen polling adapter',
"(works cross-platform, generally slower, doesn't do anything in slave mode)")
Expand Down Expand Up @@ -124,6 +127,7 @@ if options[:ignore]
end
end

opts[:ssh_options] = options[:ssh_options]
opts[:force_polling] = options[:force_polling]
opts[:no_rvm] = options[:no_rvm]
opts[:quiet] = options[:quiet]
Expand Down
8 changes: 6 additions & 2 deletions lib/entangler/executor/master.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ def generate_ssh_command(cmd, source_rvm: false)
cmd
end

"ssh -q #{remote_hostname} -p #{@opts[:remote_port]} -C \"#{prefixed_cmd}\""
"#{generic_ssh_command} -C \"#{prefixed_cmd}\""
end

def generic_ssh_command
"ssh -q #{remote_hostname} -p #{@opts[:remote_port]} #{@opts[:ssh_options]}"
end

def remote_hostname
Expand All @@ -83,7 +87,7 @@ def rsync_cmd_string(rsync_ignores_file_path)
remote_path += "#{@opts[:remote_base_dir]}/"

cmd = "rsync -azv --exclude-from #{rsync_ignores_file_path}"
cmd += " -e \"ssh -p #{@opts[:remote_port]}\"" if @opts[:remote_mode]
cmd += " -e \"#{generic_ssh_command}\"" if @opts[:remote_mode]
cmd + " --delete #{base_dir}/ #{remote_path}"
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/entangler/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Entangler
VERSION = '1.5.0'
VERSION = '1.5.1'
end

0 comments on commit 6af05c8

Please sign in to comment.