Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Created June 28, 2010 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myronmarston/456561 to your computer and use it in GitHub Desktop.
Save myronmarston/456561 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'pathname'
remote_host = 'mmarston'
path_to_local_on_remote = Pathname.new('/Volumes/DevVM')
user_home = Pathname.new(File.expand_path('~'))
given_path = Pathname.new(File.expand_path(ARGV[1]))
command = ARGV[0]
dir = path_to_local_on_remote + given_path.relative_path_from(user_home)
command = case command
when 'gitx' then %{"cd #{dir} && #{command}"}
else "#{command} #{dir}"
end
full_command = "ssh #{remote_host} #{command}"
puts full_command
Process.fork { system full_command }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment