Class: Pod::RsyncSource

Inherits:
Source
  • Object
show all
Defined in:
lib/rsync_source.rb

Overview

Subclass of Pod::Source to provide support for RSYNC Specs repositories

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.rsync_repo?(dir) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/rsync_source.rb', line 12

def self.rsync_repo?(dir)
  (dir+".rsync_config").exist?
end

.rsync_source_by_url(url) ⇒ Object



28
29
30
31
32
# File 'lib/rsync_source.rb', line 28

def self.rsync_source_by_url(url)
  rsync_sources.find do |source|
    source.url == url
  end
end

.rsync_sourcesObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rsync_source.rb', line 16

def self.rsync_sources
  if Pod::Config.instance.repos_dir.exist?
    dirs = Pod::Config.instance.repos_dir.children.select(&:directory?)
    dirs = dirs.select do |dir|
      RsyncSource.rsync_repo?(dir)
    end
    dirs.map { |dir| RsyncSource.new(dir) }
  else
    []
  end
end

Instance Method Details

#urlObject



5
6
7
8
9
# File 'lib/rsync_source.rb', line 5

def url
    u = File.open(repo + '.rsync_config', "r:UTF-8", &:read).strip
    u = u+"/" unless u.end_with?("/")
    u
end