Sha256: 4d7efd3911a840e2a553c6980ae2f70cb57f31c55bacbbc8192c9050a51607c3

Contents?: true

Size: 773 Bytes

Versions: 2

Compression:

Stored size: 773 Bytes

Contents

module Astrovan
  module Update
    def update(options = {})
      shared_repository = self.shared_repository
      repository = self.repository
      release_path = self.release_path
      current_path = self.current_path

      # TODO: do we need branch support, submodule config, etc?
      exec <<-END, options
        if [ -d '#{shared_repository}' ]
        then
          cd #{shared_repository} &&
          git fetch #{repository}
        else
          git clone --bare #{repository} #{shared_repository}
        fi &&
        git clone #{shared_repository} #{release_path}
      END

      symlink release_path, options.merge(:to => current_path)

      yield if block_given?
    rescue => e
      # TODO: rollback
      # rollback
      raise
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sbfaulkner-astrovan-0.5.3 lib/astrovan/update.rb
sbfaulkner-astrovan-0.5.4 lib/astrovan/update.rb