Skip to content
Browse files

fix pattern to allow gem's name with a period

  • Loading branch information...
1 parent 63a200e commit c9b3e43c3021967d5c1bb115e7dd1555e01c6444 @gonzoyumo gonzoyumo committed
View
2 lib/gemnasium/parser/patterns.rb
@@ -1,7 +1,7 @@
module Gemnasium
module Parser
module Patterns
- GEM_NAME = /[a-zA-Z0-9\-_]+/
+ GEM_NAME = /[a-zA-Z0-9\-_\.]+/
QUOTED_GEM_NAME = /(?:(?<gq>["'])(?<name>#{GEM_NAME})\k<gq>|%q<(?<name>#{GEM_NAME})>)/
MATCHER = /(?:=|!=|>|<|>=|<=|~>)/
View
6 spec/gemnasium/parser/gemfile_spec.rb
@@ -43,6 +43,12 @@ def reset
dependencies.size.should == 0
end
+ it "parses gems with a period in the name" do
+ content(%(gem "pygment.rb", ">= 0.8.7"))
+ dependency.name.should == "pygment.rb"
+ dependency.requirement.should == ">= 0.8.7"
+ end
+
it "parses non-requirement gems" do
content(%(gem "rake"))
dependency.name.should == "rake"
View
10 spec/gemnasium/parser/gemspec_spec.rb
@@ -55,6 +55,16 @@ def reset
dependencies.size.should == 0
end
+ it "parses gems with a period in the name" do
+ content(<<-EOF)
+ Gem::Specification.new do |gem|
+ gem.add_dependency "pygment.rb", ">= 0.8.7"
+ end
+ EOF
+ dependency.name.should == "pygment.rb"
+ dependency.requirement.should == ">= 0.8.7"
+ end
+
it "parses non-requirement gems" do
content(<<-EOF)
Gem::Specification.new do |gem|

5 comments on commit c9b3e43

@gonzoyumo
Gemnasium member

I should have mentioned credits:
as pointed out by laserlemon

:)

@laserlemon

Ha, no credit-seeking here. Thanks for the well-written/tested fix! :clap:

@gonzoyumo
Gemnasium member

sure but still, you've done most of the job :)

Please sign in to comment.
Something went wrong with that request. Please try again.