@@ -47,9 +47,11 @@ def __init__(self):
4747 group_block_regex = re .compile (
4848 r"group[ ]?:[ ]?(?P<groupblock>.*?) do" )
4949 add_dvtdep_regex = re .compile (
50- r".*add_development_dependency (?P<line>.*)" )
50+ r".*add_development_dependency(?P<line>.*)" )
5151 add_rundep_regex = re .compile (
52- r".*add_runtime_dependency (?P<line>.*)" )
52+ r".*add_runtime_dependency(?P<line>.*)" )
53+ add_dep_regex = re .compile (
54+ r".*dependency(?P<line>.*)" )
5355
5456 def __init__ (self , filepath , appname = '' ):
5557 self .filepath = filepath # Required when calls to gemspec occurs
@@ -58,12 +60,13 @@ def __init__(self, filepath, appname=''):
5860 self .dependencies = {
5961 'development' : [],
6062 'runtime' : [],
63+ 'dependency' : [],
6164 'test' : [],
6265 'production' : [],
6366 'metrics' : []
6467 }
6568 self .contents = self .gemfile .readlines ()
66- if filepath .endswith (' gemspec' ):
69+ if filepath .endswith (( '. gemspec', '.podspec' ) ):
6770 self .gemspec = True
6871 else :
6972 self .gemspec = False
@@ -96,6 +99,11 @@ def parse_line(self, line):
9699 for column in line :
97100 stripped_column = column .replace ("'" , "" )
98101 stripped_column = stripped_column .replace ('"' , "" )
102+ stripped_column = stripped_column .replace ("%q<" , "" )
103+ stripped_column = stripped_column .replace ("(" , "" )
104+ stripped_column = stripped_column .replace (")" , "" )
105+ stripped_column = stripped_column .replace ("[" , "" )
106+ stripped_column = stripped_column .replace ("]" , "" )
99107 stripped_column = stripped_column .strip ()
100108 column_list .append (stripped_column )
101109 dep = self .Dependency ()
@@ -165,6 +173,10 @@ def parse_gemspec(self, path=''):
165173 match = GemfileParser .add_rundep_regex .match (line )
166174 if match :
167175 GemfileParser .global_group = 'runtime'
176+ else :
177+ match = GemfileParser .add_dep_regex .match (line )
178+ if match :
179+ GemfileParser .global_group = 'dependency'
168180 if match :
169181 line = match .group ('line' )
170182 self .parse_line (line )
@@ -176,4 +188,4 @@ def parse(self):
176188 if self .gemspec :
177189 return self .parse_gemspec ()
178190 else :
179- return self .parse_gemfile ()
191+ return self .parse_gemfile ()
0 commit comments