lib/gitolite/ssh_key.rb in gitolite-0.0.2.alpha vs lib/gitolite/ssh_key.rb in gitolite-0.0.3.alpha
- old
+ new
@@ -23,11 +23,11 @@
def self.from_file(key)
raise "#{key} does not exist!" unless File.exists?(key)
#Get our owner and location
- File.basename(key) =~ /^(\w+(?:@(?:\w+\.)+\D{2,4})?)(?:@(\w+))?.pub$/i
+ File.basename(key) =~ /^([\w\.-]+(?:@(?:[\w-]+\.)+\D{2,4})?)(?:@(\w+))?.pub$/i
owner = $1
location = $2 || ""
#Get parts of the key
type, blob, email = File.read(key).split
@@ -45,10 +45,10 @@
end
def to_file(path)
key_file = File.join(path, self.filename)
File.open(key_file, "w") do |f|
- f.write (self.to_s)
+ f.write(self.to_s)
end
key_file
end
def filename