From 88091edfce78497ee2a595f8c1dce6f6aee5e50d Mon Sep 17 00:00:00 2001 From: Francois Catuhe Date: Thu, 18 Jan 2018 09:56:45 +0100 Subject: [PATCH] fix error when filename contains '-' hypen character --- router.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router.rb b/router.rb index 32fac0b..2eba6b1 100644 --- a/router.rb +++ b/router.rb @@ -11,7 +11,7 @@ def run filepath = gets.chomp tables = schema_parser(filepath) db = generate_xml_db(tables) - filename = filepath.match(/\/(\w+)\/db\/schema.rb/)[1] + filename = filepath.match(/\/([\w-]+)\/db\/schema.rb/)[1] xml_path = "#{File.dirname(filepath)}/#{filename}.xml" File.open(xml_path, 'wb') { |file| file.write(db) } when 2