gemnasium-parser 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -20,18 +20,18 @@ module Gemnasium
|
|
20
20
|
PAIR = /(?:(#{KEY})\s*=>\s*(#{VALUE})|(\w+):\s+(#{VALUE}))/
|
21
21
|
OPTIONS = /#{PAIR}(?:\s*,\s*#{PAIR})*/
|
22
22
|
|
23
|
-
GEM_CALL = /^\s*gem\
|
23
|
+
GEM_CALL = /^\s*gem\(?\s*(?<q1>["'])(?<name>#{GEM_NAME})\k<q1>(?:\s*,\s*#{REQUIREMENT_LIST})?(?:\s*,\s*(?<opts>#{OPTIONS}))?\s*\)?\s*$/
|
24
24
|
|
25
25
|
SYMBOLS = /#{SYMBOL}(\s*,\s*#{SYMBOL})*/
|
26
|
-
GROUP_CALL = /^(?<i1>\s*)group\
|
26
|
+
GROUP_CALL = /^(?<i1>\s*)group\(?\s*(?<grps>#{SYMBOLS})\s*\)?\s+do\s*?\n(?<blk>.*?)\n^\k<i1>end\s*$/m
|
27
27
|
|
28
28
|
GIT_CALL = /^(?<i1>\s*)git[\s\(].*?do\s*?\n(?<blk>.*?)\n^\k<i1>end\s*$/m
|
29
29
|
|
30
30
|
PATH_CALL = /^(?<i1>\s*)path[\s\(].*?do\s*?\n(?<blk>.*?)\n^\k<i1>end\s*$/m
|
31
31
|
|
32
|
-
GEMSPEC_CALL = /^\s*gemspec(?:\s
|
32
|
+
GEMSPEC_CALL = /^\s*gemspec(?:\(?\s*(?<opts>#{OPTIONS}))?\s*\)?\s*$/
|
33
33
|
|
34
|
-
ADD_DEPENDENCY_CALL = /^\s*\w+\.add(?<type>_runtime|_development)?_dependency\
|
34
|
+
ADD_DEPENDENCY_CALL = /^\s*\w+\.add(?<type>_runtime|_development)?_dependency\(?\s*(?<q1>["'])(?<name>#{GEM_NAME})\k<q1>(?:\s*,\s*#{REQUIREMENTS})?\s*\)?\s*$/
|
35
35
|
|
36
36
|
def self.options(string)
|
37
37
|
{}.tap do |hash|
|
@@ -86,6 +86,11 @@ describe Gemnasium::Parser::Gemfile do
|
|
86
86
|
gemfile.gemspec.should == "lib/gemnasium/parser.gemspec"
|
87
87
|
end
|
88
88
|
|
89
|
+
it "parses gemspecs with parentheses" do
|
90
|
+
content(%(gemspec(:name => "gemnasium-parser")))
|
91
|
+
gemfile.should be_gemspec
|
92
|
+
end
|
93
|
+
|
89
94
|
it "parses gems of a type" do
|
90
95
|
content(%(gem "rake"))
|
91
96
|
dependency.type.should == :runtime
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemnasium-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-16 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70197965178760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.8.7
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70197965178760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70197965178260 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '2.7'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70197965178260
|
36
36
|
description: Safely parse Gemfiles and gemspecs
|
37
37
|
email: steve.richert@gmail.com
|
38
38
|
executables: []
|