Commit 329f29ba authored by Fabio Pelosin's avatar Fabio Pelosin

[Source] list the name of the repos.

parent ffe95281
......@@ -2,14 +2,20 @@ module Pod
class Source
class Aggregate
def all
@sources ||= begin
@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?).map { |repo| Source.new(repo) }
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment