Camelcase class names around the . from filenames

Eg. shell.fm -> ShellFm
This commit is contained in:
Max Howell 2009-10-19 13:05:47 +01:00
parent 595dbc5710
commit 3d36b01da3
2 changed files with 7 additions and 1 deletions

View File

@ -183,7 +183,8 @@ class Formula
def self.class_s name
#remove invalid characters and camelcase
name.capitalize.gsub(/[-_\s]([a-zA-Z0-9])/) { $1.upcase }.gsub('+', 'x')
name.capitalize.gsub(/[-_.\s]([a-zA-Z0-9])/) { $1.upcase } \
.gsub('+', 'x')
end
def self.factory name

View File

@ -593,6 +593,11 @@ class BeerTasting <Test::Unit::TestCase
end
end
def test_class_names
assert_equal 'ShellFm', Formula.class_s('shell.fm')
assert_equal 'Fooxx', Formula.class_s('foo++')
end
def test_angband_version_style
f = MockFormula.new 'http://rephial.org/downloads/3.0/angband-3.0.9b-src.tar.gz'
assert_equal '3.0.9b', f.version