class Dotpack::Repo
Attributes
name[R]
path[R]
Public Class Methods
all()
click to toggle source
# File lib/dotpack/repo.rb, line 12 def self.all return @repos unless @repos.nil? FileUtils.mkdir_p REPO_DIR @repos = Dir[REPO_DIR + '/*'].map{|p| Repo.new(p)} @repos end
find_by_name(name)
click to toggle source
# File lib/dotpack/repo.rb, line 19 def self.find_by_name(name) repos = all() repos.each do |r| return r if r.name == name end nil end
new(path)
click to toggle source
# File lib/dotpack/repo.rb, line 39 def initialize(path) @path = path @name = File.basename(path).sub(/(.*)__/, '\1/') end
Public Instance Methods
update()
click to toggle source
# File lib/dotpack/repo.rb, line 27 def update Dir.chdir @path return false unless system "git fetch origin >/dev/null 2>&1" commits = `git log HEAD..origin/master --oneline` return false if commits == "" last = commits.lines.last.split(' ').first puts "Updated #{@name} to #{last}" system "git pull -f origin master >/dev/null" true end