Commit ff7a7196 authored by Fabio Pelosin's avatar Fabio Pelosin

[Source] The name should be an attribute.

parent 47655826
...@@ -18,10 +18,6 @@ module Pod ...@@ -18,10 +18,6 @@ module Pod
end end
end end
def names
dirs.map { |repo| repo.basename.to_s }.sort
end
def all_sets def all_sets
all.map(&:pod_sets).flatten all.map(&:pod_sets).flatten
end end
...@@ -58,16 +54,16 @@ module Pod ...@@ -58,16 +54,16 @@ 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)
@repo = repo @repo = repo
end end
def name
@repo.basename.to_s
end
def pod_sets def pod_sets
@repo.children.map do |child| @repo.children.map do |child|
if child.directory? && child.basename.to_s != '.git' if child.directory? && child.basename.to_s != '.git'
......
...@@ -38,6 +38,6 @@ describe "Pod::Source" do ...@@ -38,6 +38,6 @@ describe "Pod::Source" do
end end
it "return the names of the repos" do it "return the names of the repos" do
Pod::Source.names.should == %w| repo1 repo2 | Pod::Source.all.map(&:name).should == %w| repo1 repo2 |
end 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