Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am working on a project where I only have FTP control of the server. I am basically hand deploying changes from GIT commits to the server.

Is there any way to automate this (without writing the script myself, which I'm about to do), without being able to install git on the server?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

I think what you need is git-ftp. I never tried it, anyway.

share|improve this answer
    
Thanks, David, that looks quite awesome. I'll check it out. –  Yar Jul 14 '11 at 18:05
    
return if it fixed your problem –  kokbira Jul 14 '11 at 18:17
add comment

While I was waiting for answers, I cooked this up. Though now I"ll have to check out git-ftp as David Costa suggests. This script doesn't actually do anything: it just gives you commands for your own FTPing.

#!/usr/bin/env ruby
if __FILE__ == $0
  puts "Pulls file list between two git commits and makes ftp commands"
  if ARGV.length != 2
    puts "Sorry, include two hashes as arguments separated by spaces"
    exit
  end

  hash1 = ARGV[0]
  hash2 = ARGV[1]

  command = "git log #{hash1}..#{hash2} --name-status --pretty=\"%p\""

  results = `#{command}`
  results = results.to_a[2..-1].join

  lines = results.to_a
  lines.each do |line|
    modifyAddDelete = line[0..0]
    if (modifyAddDelete=="M" || modifyAddDelete=="A")
      command = "put"
    elsif (modifyAddDelete = "D")
      command = "delete"
    end
    filename = line[2..1000]
    puts "#{command} #{filename}"

  end

end
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.