[asterisk-commits] mnicholson: branch mnicholson/asttest r247271 - /team/mnicholson/asttest/astt...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 17 13:20:39 CST 2010


Author: mnicholson
Date: Wed Feb 17 13:20:36 2010
New Revision: 247271

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=247271
Log:
Added config:from_file() and modified asterisk:load_config() to use it

Modified:
    team/mnicholson/asttest/asttest/lua/astlib.lua

Modified: team/mnicholson/asttest/asttest/lua/astlib.lua
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/asttest/asttest/lua/astlib.lua?view=diff&rev=247271&r1=247270&r2=247271
==============================================================================
--- team/mnicholson/asttest/asttest/lua/astlib.lua (original)
+++ team/mnicholson/asttest/asttest/lua/astlib.lua Wed Feb 17 13:20:36 2010
@@ -111,14 +111,9 @@
 		end
 	end
 
-	local f, err = io.open(file, "r");
-	if not f then
-		error("error opening file '" .. file .. "': " .. err)
-	end
-
-	local c = self:new_config(conf_name)
-	c:verbatim(f:read("*a"))
-	f:close()
+	local c = config:from_file(conf_name, file, self.work_area .. "/etc/asterisk/" .. conf_name)
+	self[conf_name] = c
+	return c
 end
 
 function asterisk:new_config(name)
@@ -200,6 +195,20 @@
 end
 
 config = {}
+function config:from_file(name, src_filename, dst_filename)
+	local ac = config:new(name, dst_filename)
+
+	local f, err = io.open(src_filename, "r");
+	if not f then
+		error("error opening file '" .. src_filename .. "': " .. err)
+	end
+
+	ac:verbatim(f:read("*a"))
+	f:close()
+
+	return ac
+end
+
 function config:new(name, filename)
 	local ac = {
 		name = name,




More information about the asterisk-commits mailing list