##// END OF EJS Templates
scm: Ruby 1.9 compatibility in getting scm version (#4273)....
Toshi MARUYAMA -
r4800:11e4c5c1ea1f
parent child
Show More
@@ -44,6 +44,9 module Redmine
44
44
45 def scm_command_version
45 def scm_command_version
46 scm_version = scm_version_from_command_line
46 scm_version = scm_version_from_command_line
47 if scm_version.respond_to?(:force_encoding)
48 scm_version.force_encoding('ASCII-8BIT')
49 end
47 if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
50 if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
48 m[2].scan(%r{\d+}).collect(&:to_i)
51 m[2].scan(%r{\d+}).collect(&:to_i)
49 end
52 end
@@ -44,6 +44,9 module Redmine
44
44
45 def scm_command_version
45 def scm_command_version
46 scm_version = scm_version_from_command_line
46 scm_version = scm_version_from_command_line
47 if scm_version.respond_to?(:force_encoding)
48 scm_version.force_encoding('ASCII-8BIT')
49 end
47 if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)}m)
50 if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)}m)
48 m[2].scan(%r{\d+}).collect(&:to_i)
51 m[2].scan(%r{\d+}).collect(&:to_i)
49 end
52 end
@@ -44,6 +44,9 module Redmine
44
44
45 def darcs_binary_version
45 def darcs_binary_version
46 darcsversion = darcs_binary_version_from_command_line
46 darcsversion = darcs_binary_version_from_command_line
47 if darcsversion.respond_to?(:force_encoding)
48 darcsversion.force_encoding('ASCII-8BIT')
49 end
47 if m = darcsversion.match(%r{\A(.*?)((\d+\.)+\d+)})
50 if m = darcsversion.match(%r{\A(.*?)((\d+\.)+\d+)})
48 m[2].scan(%r{\d+}).collect(&:to_i)
51 m[2].scan(%r{\d+}).collect(&:to_i)
49 end
52 end
@@ -46,6 +46,9 module Redmine
46
46
47 def scm_command_version
47 def scm_command_version
48 scm_version = scm_version_from_command_line
48 scm_version = scm_version_from_command_line
49 if scm_version.respond_to?(:force_encoding)
50 scm_version.force_encoding('ASCII-8BIT')
51 end
49 if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
52 if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
50 m[2].scan(%r{\d+}).collect(&:to_i)
53 m[2].scan(%r{\d+}).collect(&:to_i)
51 end
54 end
@@ -55,6 +55,9 module Redmine
55 # release number (eg 0.9.5 or 1.0) or as a revision
55 # release number (eg 0.9.5 or 1.0) or as a revision
56 # id composed of 12 hexa characters.
56 # id composed of 12 hexa characters.
57 theversion = hgversion_from_command_line
57 theversion = hgversion_from_command_line
58 if theversion.respond_to?(:force_encoding)
59 theversion.force_encoding('ASCII-8BIT')
60 end
58 if m = theversion.match(%r{\A(.*?)((\d+\.)+\d+)})
61 if m = theversion.match(%r{\A(.*?)((\d+\.)+\d+)})
59 m[2].scan(%r{\d+}).collect(&:to_i)
62 m[2].scan(%r{\d+}).collect(&:to_i)
60 end
63 end
@@ -45,6 +45,9 module Redmine
45
45
46 def svn_binary_version
46 def svn_binary_version
47 scm_version = scm_version_from_command_line
47 scm_version = scm_version_from_command_line
48 if scm_version.respond_to?(:force_encoding)
49 scm_version.force_encoding('ASCII-8BIT')
50 end
48 if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
51 if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
49 m[2].scan(%r{\d+}).collect(&:to_i)
52 m[2].scan(%r{\d+}).collect(&:to_i)
50 end
53 end
General Comments 0
You need to be logged in to leave comments. Login now