@@ -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,14 @@ 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+ path = ('gemspec' , 'podspec' )
70+ if filepath .endswith (path ):
6771 self .gemspec = True
6872 else :
6973 self .gemspec = False
@@ -96,6 +100,11 @@ def parse_line(self, line):
96100 for column in line :
97101 stripped_column = column .replace ("'" , "" )
98102 stripped_column = stripped_column .replace ('"' , "" )
103+ stripped_column = stripped_column .replace ("%q<" , "" )
104+ stripped_column = stripped_column .replace ("(" , "" )
105+ stripped_column = stripped_column .replace (")" , "" )
106+ stripped_column = stripped_column .replace ("[" , "" )
107+ stripped_column = stripped_column .replace ("]" , "" )
99108 stripped_column = stripped_column .strip ()
100109 column_list .append (stripped_column )
101110 dep = self .Dependency ()
@@ -165,6 +174,10 @@ def parse_gemspec(self, path=''):
165174 match = GemfileParser .add_rundep_regex .match (line )
166175 if match :
167176 GemfileParser .global_group = 'runtime'
177+ else :
178+ match = GemfileParser .add_dep_regex .match (line )
179+ if match :
180+ GemfileParser .global_group = 'dependency'
168181 if match :
169182 line = match .group ('line' )
170183 self .parse_line (line )
@@ -176,4 +189,4 @@ def parse(self):
176189 if self .gemspec :
177190 return self .parse_gemspec ()
178191 else :
179- return self .parse_gemfile ()
192+ return self .parse_gemfile ()
0 commit comments