Skip to content
Browse files

Allow parentheses in gemfile git and path method calls

  • Loading branch information...
1 parent ea2d481 commit d7f383c74b924eca8ca5cd03b26788af9231a661 @laserlemon laserlemon committed
Showing with 20 additions and 2 deletions.
  1. +2 −2 lib/gemnasium/parser/patterns.rb
  2. +18 −0 spec/gemnasium/parser/gemfile_spec.rb
View
4 lib/gemnasium/parser/patterns.rb
@@ -25,9 +25,9 @@ module Patterns
SYMBOLS = /#{SYMBOL}(\s*,\s*#{SYMBOL})*/
GROUP_CALL = /^(?<i1>\s*)group\s*\(?\s*(?<grps>#{SYMBOLS})\s*\)?\s+do\s*?\n(?<blk>.*?)\n^\k<i1>end\s*$/m
- GIT_CALL = /^(?<i1>\s*)git\s+.*?\n(?<blk>.*?)\n^\k<i1>end\s*$/m
+ GIT_CALL = /^(?<i1>\s*)git[\s\(].*?do\s*?\n(?<blk>.*?)\n^\k<i1>end\s*$/m
- PATH_CALL = /^(?<i1>\s*)path\s+.*?\n(?<blk>.*?)\n^\k<i1>end\s*$/m
+ PATH_CALL = /^(?<i1>\s*)path[\s\(].*?do\s*?\n(?<blk>.*?)\n^\k<i1>end\s*$/m
GEMSPEC_CALL = /^\s*gemspec(?:\s+(?<opts>#{OPTIONS}))?\s*$/
View
18 spec/gemnasium/parser/gemfile_spec.rb
@@ -170,6 +170,15 @@ def reset
dependencies.size.should == 0
end
+ it "ignores gems in a git block with parentheses" do
+ content(<<-EOF)
+ git("https://github.com/rails/rails.git") do
+ gem "rails"
+ end
+ EOF
+ dependencies.size.should == 0
+ end
+
it "ignores gems in a path block" do
content(<<-EOF)
path "vendor/rails" do
@@ -179,6 +188,15 @@ def reset
dependencies.size.should == 0
end
+ it "ignores gems in a path block with parentheses" do
+ content(<<-EOF)
+ path("vendor/rails") do
+ gem "rails"
+ end
+ EOF
+ dependencies.size.should == 0
+ end
+
it "records dependency line numbers" do
content(<<-EOF)
gem "rake"

0 comments on commit d7f383c

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