Sha256: 48152b518e0972de37a9e157f2e62887642423d844bdd84cbf1123f22f38297a

Contents?: true

Size: 655 Bytes

Versions: 2

Compression:

Stored size: 655 Bytes

Contents

module Space
  class Repo
    attr_reader :number, :path, :git, :bundle

    def initialize(number, path)
      @number = number
      @path = File.expand_path(path)
      @git = Git.new(path)
      @bundle = Bundle.new(path)
    end

    def name
      @name ||= File.basename(path)
    end

    def ref
      git.commit
    end

    def dependencies
      Repos.select(bundle.deps.map(&:name))
    end

    def reset
      git.reset
      bundle.reset
    end

    def execute(cmd)
      chdir do
        puts "in #{path}".ansi(:bold, :yellow)
        system(cmd)
      end
    end

    def chdir(&block)
      Dir.chdir(path, &block)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
space-0.0.3 lib/space/models/repo.rb
space-0.0.2 lib/space/models/repo.rb