Sha256: 6470238e5a3c547e5caf9bc764de83ee39cc5971d41c52c696a0a3ad3ee08bc8

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

require 'exogenesis/support/passenger'

# Clone, Update and Delete Git Repos
# REQUIRES: git
class GitRepo < Passenger
  register_as :git_repo
  needs :repos
  with_emoji :arrow_down

  # Clone the Repo if it doesn't exist
  # Pull the Repo if it does
  def up
    each_repo_and_target do |git_repo, target|
      if target.exist?
        pull_repo(git_repo, target)
      else
        clone_repo(git_repo, target)
      end
    end
  end

  # Delete the Repos
  def down
    each_repo_and_target do |_, target|
      rm_rf(target)
    end
  end

  private

  def each_repo_and_target
    repos.each_pair do |git_repo, raw_target|
      yield git_repo, get_path_for(raw_target)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exogenesis-1.0.0 lib/exogenesis/passengers/git_repo.rb
exogenesis-0.2.0 lib/exogenesis/passengers/git_repo.rb