Sha256: fe3b78b0b8065fa84a49bad6afe2a6f1580fd09e8a55f84bbc89f8c8f433204d

Contents?: true

Size: 597 Bytes

Versions: 5

Compression:

Stored size: 597 Bytes

Contents

require "git"

module CukeQ
  class Scm
    class GitBridge

      def initialize(url, working_copy)
        @url          = url
        @working_copy = working_copy
      end

      def update(&blk)
        repo.reset_hard
        repo.pull

        # TODO: async
        yield
      end

      def current_revision
        repo.revparse("HEAD")
      end

      def repo
        @repo ||= (
          unless File.directory? @working_copy
            Git.clone(@url, @working_copy)
          end

          Git.open(@working_copy)
        )
      end

    end # GitBridge
  end # Scm
end # CukeQ

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cukeq-0.0.1.dev5 lib/cukeq/scm/git_bridge.rb
cukeq-0.0.1.dev4 lib/cukeq/scm/git_bridge.rb
cukeq-0.0.1.dev3 lib/cukeq/scm/git_bridge.rb
cukeq-0.0.1.dev2 lib/cukeq/scm/git_bridge.rb
cukeq-0.0.1.dev lib/cukeq/scm/git_bridge.rb