Skip to content

Commit

Permalink
[Dependency] Support initialization from string with multiple require…
Browse files Browse the repository at this point in the history
…ments

Closes CocoaPods/CocoaPods#1076
  • Loading branch information
fabiopelosin committed May 31, 2013
1 parent f37f918 commit 1dfeece
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/cocoapods-core/dependency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ def self.from_string(string)
when /HEAD/
Dependency.new(name, :head)
else
Dependency.new(name, version)
version_requirements = version.split(',') if version
Dependency.new(name, version_requirements)
end
end

Expand Down
6 changes: 6 additions & 0 deletions spec/dependency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ module Pod
d.external_source.should.be.nil
end

it "creates a dependency from a string with multiple version requirements" do
d = Dependency.from_string("FontAwesomeIconFactory (< 2.0, >= 1.0.1)")
d.name.should == "FontAwesomeIconFactory"
d.requirement.should == Requirement.new('< 2.0', '>= 1.0.1')
end

it "doesn't include external source when initialized from a string as incomplete and thus it should be provided by the client" do
d = Dependency.from_string("BananaLib (from `www.example.com', tag `1.0')")
d.name.should == "BananaLib"
Expand Down

0 comments on commit 1dfeece

Please sign in to comment.