mirror of
https://github.com/zhigang1992/CocoaPods.git
synced 2026-04-30 18:32:27 +08:00
[Source] list the name of the repos.
This commit is contained in:
@@ -2,14 +2,20 @@ module Pod
|
||||
class Source
|
||||
class Aggregate
|
||||
def all
|
||||
@sources ||= begin
|
||||
repos_dir = Config.instance.repos_dir
|
||||
unless repos_dir.exist?
|
||||
raise Informative, "No spec repos found in `#{repos_dir}'. " \
|
||||
"To fetch the `master' repo run: $ pod setup"
|
||||
end
|
||||
repos_dir.children.select(&:directory?).map { |repo| Source.new(repo) }
|
||||
@sources ||= dirs.map { |repo| Source.new(repo) }
|
||||
end
|
||||
|
||||
def dirs
|
||||
repos_dir = Config.instance.repos_dir
|
||||
unless repos_dir.exist?
|
||||
raise Informative, "No spec repos found in `#{repos_dir}'. " \
|
||||
"To fetch the `master' repo run: $ pod setup"
|
||||
end
|
||||
repos_dir.children.select(&:directory?)
|
||||
end
|
||||
|
||||
def names
|
||||
dirs.map { |repo| repo.basename.to_s }.sort
|
||||
end
|
||||
|
||||
def all_sets
|
||||
@@ -48,6 +54,10 @@ module Pod
|
||||
Aggregate.new.search_by_name(name, full_text_search)
|
||||
end
|
||||
|
||||
def self.names
|
||||
Aggregate.new.names
|
||||
end
|
||||
|
||||
attr_reader :repo
|
||||
|
||||
def initialize(repo)
|
||||
|
||||
@@ -36,4 +36,8 @@ describe "Pod::Source" do
|
||||
Pod::Source.search(Pod::Dependency.new('RestKit/DoesNotExist'))
|
||||
}.should.raise Pod::Informative
|
||||
end
|
||||
|
||||
it "return the names of the repos" do
|
||||
Pod::Source.names.should == %w| repo1 repo2 |
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user