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 ...@@ -2,14 +2,20 @@ module Pod
class Source class Source
class Aggregate class Aggregate
def all def all
@sources ||= begin @sources ||= dirs.map { |repo| Source.new(repo) }
repos_dir = Config.instance.repos_dir end
unless repos_dir.exist?
raise Informative, "No spec repos found in `#{repos_dir}'. " \ def dirs
"To fetch the `master' repo run: $ pod setup" repos_dir = Config.instance.repos_dir
end unless repos_dir.exist?
repos_dir.children.select(&:directory?).map { |repo| Source.new(repo) } raise Informative, "No spec repos found in `#{repos_dir}'. " \
"To fetch the `master' repo run: $ pod setup"
end end
repos_dir.children.select(&:directory?)
end
def names
dirs.map { |repo| repo.basename.to_s }.sort
end end
def all_sets def all_sets
...@@ -48,6 +54,10 @@ module Pod ...@@ -48,6 +54,10 @@ module Pod
Aggregate.new.search_by_name(name, full_text_search) Aggregate.new.search_by_name(name, full_text_search)
end end
def self.names
Aggregate.new.names
end
attr_reader :repo attr_reader :repo
def initialize(repo) def initialize(repo)
......
...@@ -36,4 +36,8 @@ describe "Pod::Source" do ...@@ -36,4 +36,8 @@ describe "Pod::Source" do
Pod::Source.search(Pod::Dependency.new('RestKit/DoesNotExist')) Pod::Source.search(Pod::Dependency.new('RestKit/DoesNotExist'))
}.should.raise Pod::Informative }.should.raise Pod::Informative
end end
it "return the names of the repos" do
Pod::Source.names.should == %w| repo1 repo2 |
end
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