class Pod

Attributes

name[R]
path[R]

Public Class Methods

new(path) click to toggle source
# File lib/updater/pod.rb, line 6
def initialize(path)
  @path = path
  @name = @path.split(File::SEPARATOR).last
end

Public Instance Methods

git() click to toggle source
# File lib/updater/pod.rb, line 33
def git
  @git ||= Git.new(@path)
end
git_source() click to toggle source
# File lib/updater/pod.rb, line 17
def git_source
  source = versions.sort.last.contents["source"]["git"]
  source ||= begin
    http_source = versions.sort.last.contents["source"]["http"]
    uri = URI.parse(http_source)
    host = uri.host.match(/www.(.*)/).captures.first
    scheme = "git"
    path = uri.path.split("/").take(3).join("/").concat(".git")
    URI::Generic.build({scheme: scheme, host: host, path: path}).to_s
  end
end
save() click to toggle source
# File lib/updater/pod.rb, line 29
def save
  versions.each(&:save)
end
versions() click to toggle source
# File lib/updater/pod.rb, line 11
def versions
  @versions ||= Dir.glob(File.join(@path, '*')).map do |version_path| 
    Version.new(version_path)
  end
end