Sha256: 454ee3c57fa5df159e2a8004bf3a96cd51c9a586477f19b5441275e0b235faa2

Contents?: true

Size: 945 Bytes

Versions: 3

Compression:

Stored size: 945 Bytes

Contents

require 'pullr/command_line'

module Pullr
  module SCM
    module Git
      include CommandLine

      #
      # Pulls down a copy of a Git source repository.
      #
      # @param [Addressable::URI] uri
      #   The URI of the Git repository.
      #
      # @param [String] dest
      #   Optional destination to pull the repository down into.
      #
      def scm_pull(uri,dest=nil)
        if dest
          sh 'git', 'clone', uri, dest
        else
          sh 'git', 'clone', uri
        end
      end

      #
      # Updates a local Git repository.
      #
      # @param [String] path
      #   Path to the local repository to update.
      #
      # @param [Addressable::URI] uri
      #   Optional URI of the remote Git repository to update from.
      #
      def scm_update(path,uri=nil)
        cd(path) do
          sh 'git', 'reset', '-q', '--hard', 'HEAD'
          sh 'git', 'pull'
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pullr-0.1.3 lib/pullr/scm/git.rb
pullr-0.1.2 lib/pullr/scm/git.rb
pullr-0.1.1 lib/pullr/scm/git.rb