@@ -61,21 +61,21 @@ def parse_spec(self, location):
6161
6262 for line in lines :
6363 if '.name' in line :
64- name = re . sub ( r'/*.*name.*?=' , '' , line )
65- spec_data ['name' ] = get_stripped_data (name )
64+ name = line . rpartition ( '=' )
65+ spec_data ['name' ] = get_stripped_data (name [ 2 ] )
6666 elif '.version' in line and '.version.' not in line :
67- version = re . sub ( r'/*.*version.*?=' , '' , line )
68- spec_data ['version' ] = get_stripped_data (version )
67+ version = line . rpartition ( '=' )
68+ spec_data ['version' ] = get_stripped_data (version [ 2 ] )
6969 elif '.license' in line :
70- license_type = re . sub ( r'/*.*license.*?=' , '' , line )
71- spec_data ['license' ] = get_stripped_data (license_type )
70+ license_type = line . rpartition ( '=' )
71+ spec_data ['license' ] = get_stripped_data (license_type [ 2 ] )
7272 elif '.source' in line and '.source_files' not in line :
7373 source = re .sub (r'/*.*source.*?>' , '' , line )
7474 stripped_source = re .sub (r',.*' , '' , source )
7575 spec_data ['source' ] = get_stripped_data (stripped_source )
7676 elif '.email' in line :
77- emails = re . sub ( r'/*.*email.*?=' , '' , line )
78- stripped_emails = get_stripped_data (emails )
77+ emails = line . rpartition ( '=' )
78+ stripped_emails = get_stripped_data (emails [ 2 ] )
7979 stripped_emails = stripped_emails .strip ()
8080 stripped_emails = stripped_emails .split (',' )
8181 spec_data ['email' ] = stripped_emails
@@ -87,17 +87,19 @@ def parse_spec(self, location):
8787 stripped_authors = stripped_authors .split (',' )
8888 spec_data ['author' ] = stripped_authors
8989 elif '.summary' in line :
90- summary = re . sub ( r'/*.*summary.*?=' , '' , line )
91- spec_data ['summary' ] = get_stripped_data (summary )
90+ summary = line . rpartition ( '=' )
91+ spec_data ['summary' ] = get_stripped_data (summary [ 2 ] )
9292 elif '.description' in line :
9393 if location .endswith ('.gemspec' ):
94- desc = re .sub (r'/*.*description.*?=' , '' , line )
95- spec_data ['description' ] = get_stripped_data (desc )
94+ # FIXME: description can be in single or multi-lines
95+ # There are many different ways to write description.
96+ desc = line .rpartition ('=' )
97+ spec_data ['description' ] = get_stripped_data (desc [2 ])
9698 else :
97- spec_data ['description' ] = get_description (location )
99+ spec_data ['description' ] = get_description (line )
98100 elif '.homepage' in line :
99- homepage_url = re . sub ( r'/*.*homepage.*?=' , '' , line )
100- spec_data ['homepage_url' ] = get_stripped_data (homepage_url )
101+ homepage_url = line . rpartition ( '=' )
102+ spec_data ['homepage_url' ] = get_stripped_data (homepage_url [ 2 ] )
101103
102104 parser = GemfileParser (location )
103105 deps = parser .parse ()
@@ -113,7 +115,7 @@ def parse_spec(self, location):
113115
114116def get_stripped_data (line ):
115117 """
116- Return data after removing unnecessary special character and space.
118+ Return line after removing unnecessary special character and space.
117119 """
118120 if '#' in line :
119121 line = line [:line .index ('#' )]
0 commit comments