couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r690584 - in /incubator/couchdb/trunk: src/couchdb/couch_config_writer.erl test/couch_config_test.erl test/couch_config_writer_test.erl
Date Sat, 30 Aug 2008 20:50:04 GMT
Author: jan
Date: Sat Aug 30 13:50:03 2008
New Revision: 690584

URL: http://svn.apache.org/viewvc?rev=690584&view=rev
Log:
- Remove dependency on test/local.ini
- Write out new variables in key = value format
- Fix tests

Modified:
    incubator/couchdb/trunk/src/couchdb/couch_config_writer.erl
    incubator/couchdb/trunk/test/couch_config_test.erl
    incubator/couchdb/trunk/test/couch_config_writer_test.erl

Modified: incubator/couchdb/trunk/src/couchdb/couch_config_writer.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_config_writer.erl?rev=690584&r1=690583&r2=690584&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_config_writer.erl (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_config_writer.erl Sat Aug 30 13:50:03 2008
@@ -108,7 +108,7 @@
     NewFileContents.
 
 append_new_ini_section({{ModuleName, Variable}, Value}, OldFileContents) ->
-    OldFileContents ++ "\n\n" ++ ModuleName ++ "\n" ++  Variable ++ "=" ++ Value ++ "\n".
+    OldFileContents ++ "\n\n" ++ ModuleName ++ "\n" ++  Variable ++ " = " ++ Value ++ "\n".
 
 %% @spec parse_module(Lins::string(), OldModule::string()) -> string()
 %% @doc Tries to match a line against a pattern specifying a ini module or
@@ -130,14 +130,14 @@
 %%      Variable is not found. Returns a new line composed of the Variable and
 %%      Value otherwise.
 parse_variable(Line, Variable, Value) ->
-    case regexp:match(Line, "^" ++ Variable ++ "=") of
+    case regexp:match(Line, "^" ++ Variable ++ "\s?=") of
         nomatch ->
             nomatch;
         {error, Error}->
             io:format("ini file regex error variable: '~s'~n", [Error]),
             nomatch;
         {match, _Start, _Length} ->
-            Variable ++ "=" ++ Value
+            Variable ++ " = " ++ Value
     end.
 
 %% @spec save_file(File::filename(), Contents::string()) ->

Modified: incubator/couchdb/trunk/test/couch_config_test.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/test/couch_config_test.erl?rev=690584&r1=690583&r2=690584&view=diff
==============================================================================
--- incubator/couchdb/trunk/test/couch_config_test.erl (original)
+++ incubator/couchdb/trunk/test/couch_config_test.erl Sat Aug 30 13:50:03 2008
@@ -30,6 +30,9 @@
 
     
 store(Key2, Value2) ->
+    Filename = "local.ini",
+    file:write_file(Filename, ""),
+
     Key = binary_to_list(term_to_binary(Key2)),
     Value = binary_to_list(term_to_binary(Value2)),
 
@@ -40,4 +43,8 @@
     couch_config:unset(Key),
 
     couch_config:terminate(end_of_test, ok),
+
+    % clean up
+    file:delete(Filename),
+
     Value = Result.
\ No newline at end of file

Modified: incubator/couchdb/trunk/test/couch_config_writer_test.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/test/couch_config_writer_test.erl?rev=690584&r1=690583&r2=690584&view=diff
==============================================================================
--- incubator/couchdb/trunk/test/couch_config_writer_test.erl (original)
+++ incubator/couchdb/trunk/test/couch_config_writer_test.erl Sat Aug 30 13:50:03 2008
@@ -17,47 +17,47 @@
     Contents = "; etc/couchdb/couch.ini.tpl.  Generated from couch.ini.tpl.in by configure.
 
 [CouchDB]
-RootDirectory=/Users/jan/Work/runcouch/conf9/var/lib/couchdb
-UtilDriverDir=/Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib
-MaximumDocumentSize=4294967296 ; 4 GB
+RootDirectory = /Users/jan/Work/runcouch/conf9/var/lib/couchdb
+UtilDriverDir = /Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib
+MaximumDocumentSize = 4294967296 ; 4 GB
 
 [HTTPd]
-Port=5984
-BindAddress=127.0.0.1
-DocumentRoot=/Users/jan/Work/runcouch/conf9/share/couchdb/www
+Port = 5984
+BindAddress = 127.0.0.1
+DocumentRoot = /Users/jan/Work/runcouch/conf9/share/couchdb/www
 
 [Log]
-File=/Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log
-Level=info
+File = /Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log
+Level = info
 
 [CouchDB Query Servers]
-javascript=/Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js
+javascript = /Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js
 
 [CouchDB Query Server Options]
-QueryTimeout=5000 ; 5 seconds
+QueryTimeout = 5000 ; 5 seconds
 ",
 
     Expect = "; etc/couchdb/couch.ini.tpl.  Generated from couch.ini.tpl.in by configure.
 
 [CouchDB]
-RootDirectory=/Users/jan/Work/runcouch/conf9/var/lib/couchdb
-UtilDriverDir=/Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib
-MaximumDocumentSize=4294967296 ; 4 GB
+RootDirectory = /Users/jan/Work/runcouch/conf9/var/lib/couchdb
+UtilDriverDir = /Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib
+MaximumDocumentSize = 4294967296 ; 4 GB
 
 [HTTPd]
-Port=5985
-BindAddress=127.0.0.1
-DocumentRoot=/Users/jan/Work/runcouch/conf9/share/couchdb/www
+Port = 5985
+BindAddress = 127.0.0.1
+DocumentRoot = /Users/jan/Work/runcouch/conf9/share/couchdb/www
 
 [Log]
-File=/Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log
-Level=info
+File = /Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log
+Level = info
 
 [CouchDB Query Servers]
-javascript=/Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js
+javascript = /Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js
 
 [CouchDB Query Server Options]
-QueryTimeout=5000 ; 5 seconds
+QueryTimeout = 5000 ; 5 seconds
 ",
     run_operation_and_compare_results(Contents, Expect, {{"HTTPd", "Port"}, "5985"}).
 
@@ -67,48 +67,48 @@
     Contents = "; etc/couchdb/couch.ini.tpl.  Generated from couch.ini.tpl.in by configure.
 
 [CouchDB]
-RootDirectory=/Users/jan/Work/runcouch/conf9/var/lib/couchdb
-UtilDriverDir=/Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib
-MaximumDocumentSize=4294967296 ; 4 GB
+RootDirectory = /Users/jan/Work/runcouch/conf9/var/lib/couchdb
+UtilDriverDir = /Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib
+MaximumDocumentSize = 4294967296 ; 4 GB
 
 [HTTPd]
-Port=5984
-BindAddress=127.0.0.1
-DocumentRoot=/Users/jan/Work/runcouch/conf9/share/couchdb/www
+Port = 5984
+BindAddress = 127.0.0.1
+DocumentRoot = /Users/jan/Work/runcouch/conf9/share/couchdb/www
 
 [Log]
-File=/Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log
-Level=info
+File = /Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log
+Level = info
 
 [CouchDB Query Servers]
-javascript=/Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js
+javascript = /Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js
 
 [CouchDB Query Server Options]
-QueryTimeout=5000 ; 5 seconds
+QueryTimeout = 5000 ; 5 seconds
 ",
 
     Expect = "; etc/couchdb/couch.ini.tpl.  Generated from couch.ini.tpl.in by configure.
 
 [CouchDB]
-RootDirectory=/Users/jan/Work/runcouch/conf9/var/lib/couchdb
-UtilDriverDir=/Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib
-MaximumDocumentSize=4294967296 ; 4 GB
+RootDirectory = /Users/jan/Work/runcouch/conf9/var/lib/couchdb
+UtilDriverDir = /Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib
+MaximumDocumentSize = 4294967296 ; 4 GB
 
 [HTTPd]
-Port=5984
-BindAddress=127.0.0.1
-DocumentRoot=/Users/jan/Work/runcouch/conf9/share/couchdb/www
+Port = 5984
+BindAddress = 127.0.0.1
+DocumentRoot = /Users/jan/Work/runcouch/conf9/share/couchdb/www
 
-FantasyConfiguration=Citation Needed
+FantasyConfiguration = Citation Needed
 [Log]
-File=/Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log
-Level=info
+File = /Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log
+Level = info
 
 [CouchDB Query Servers]
-javascript=/Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js
+javascript = /Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js
 
 [CouchDB Query Server Options]
-QueryTimeout=5000 ; 5 seconds
+QueryTimeout = 5000 ; 5 seconds
 ",
     run_operation_and_compare_results(Contents, Expect, {{"HTTPd", "FantasyConfiguration"},
"Citation Needed"}).
 
@@ -118,49 +118,49 @@
     Contents = "; etc/couchdb/couch.ini.tpl.  Generated from couch.ini.tpl.in by configure.
 
 [CouchDB]
-RootDirectory=/Users/jan/Work/runcouch/conf9/var/lib/couchdb
-UtilDriverDir=/Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib
-MaximumDocumentSize=4294967296 ; 4 GB
+RootDirectory = /Users/jan/Work/runcouch/conf9/var/lib/couchdb
+UtilDriverDir = /Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib
+MaximumDocumentSize = 4294967296 ; 4 GB
 
 [HTTPd]
-Port=5984
-BindAddress=127.0.0.1
-DocumentRoot=/Users/jan/Work/runcouch/conf9/share/couchdb/www
+Port = 5984
+BindAddress = 127.0.0.1
+DocumentRoot = /Users/jan/Work/runcouch/conf9/share/couchdb/www
 
 [Log]
-File=/Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log
-Level=info
+File = /Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log
+Level = info
 
 [CouchDB Query Servers]
-javascript=/Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js
+javascript = /Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js
 
 [CouchDB Query Server Options]
-QueryTimeout=5000 ; 5 seconds",
+QueryTimeout = 5000 ; 5 seconds",
 
     Expect = "; etc/couchdb/couch.ini.tpl.  Generated from couch.ini.tpl.in by configure.
 
 [CouchDB]
-RootDirectory=/Users/jan/Work/runcouch/conf9/var/lib/couchdb
-UtilDriverDir=/Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib
-MaximumDocumentSize=4294967296 ; 4 GB
+RootDirectory = /Users/jan/Work/runcouch/conf9/var/lib/couchdb
+UtilDriverDir = /Users/jan/Work/runcouch/conf9/lib/couchdb/erlang/lib/couch-0.7.3a663206/priv/lib
+MaximumDocumentSize = 4294967296 ; 4 GB
 
 [HTTPd]
-Port=5984
-BindAddress=127.0.0.1
-DocumentRoot=/Users/jan/Work/runcouch/conf9/share/couchdb/www
+Port = 5984
+BindAddress = 127.0.0.1
+DocumentRoot = /Users/jan/Work/runcouch/conf9/share/couchdb/www
 
 [Log]
-File=/Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log
-Level=info
+File = /Users/jan/Work/runcouch/conf9/var/log/couchdb/couch.log
+Level = info
 
 [CouchDB Query Servers]
-javascript=/Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js
+javascript = /Users/jan/Work/runcouch/conf9/bin/couchjs /Users/jan/Work/runcouch/conf9/share/couchdb/server/main.js
 
 [CouchDB Query Server Options]
-QueryTimeout=5000 ; 5 seconds
+QueryTimeout = 5000 ; 5 seconds
 
 [Erlang]
-Option=Value
+Option = Value
 ",
     run_operation_and_compare_results(Contents, Expect, {{"Erlang", "Option"}, "Value"}).
   
@@ -176,6 +176,6 @@
     Result = binary_to_list(Result_),
 
     % clean up
-    % file:delete(Filename),
+    file:delete(Filename),
     
     Result = Expect.



Mime
View raw message