@@ -186,22 +186,26 @@ def self.init
186186 sample_properties = "roxy/sample/build.sample.properties"
187187 sample_options = "roxy/sample/all.sample.xml"
188188 sample_rest_properties = "roxy/sample/properties.sample.xml"
189+ sample_app_config = "roxy/deploy/sample/custom-config.xqy"
189190 else
190- sample_config = ServerConfig . expand_path ( "#{ @@path } /sample/ml-config.sample.xml" )
191- sample_properties = ServerConfig . expand_path ( "#{ @@path } /sample/build.sample.properties" )
191+ sample_config = ServerConfig . expand_path ( "#{ @@path } /sample/ml-config.sample.xml" )
192+ sample_properties = ServerConfig . expand_path ( "#{ @@path } /sample/build.sample.properties" )
192193 sample_options = ServerConfig . expand_path ( "#{ @@path } /sample/all.sample.xml" )
193194 sample_rest_properties = ServerConfig . expand_path ( "#{ @@path } /sample/properties.sample.xml" )
195+ sample_app_config = ServerConfig . expand_path ( "#{ @@path } /sample/custom-config.xqy" )
194196 end
195197
196198 # output files
197199 build_properties = ServerConfig . expand_path ( "#{ @@path } /build.properties" )
198200 options_file = ServerConfig . expand_path ( "#{ @@path } /../rest-api/config/options/all.xml" )
199201 rest_properties = ServerConfig . expand_path ( "#{ @@path } /../rest-api/config/properties.xml" )
202+ app_config = ServerConfig . expand_path ( "#{ @@path } /../src/config/config.xqy" )
200203
201204 # dirs to create
202205 rest_ext_dir = ServerConfig . expand_path ( "#{ @@path } /../rest-api/ext" )
203206 rest_transforms_dir = ServerConfig . expand_path ( "#{ @@path } /../rest-api/transforms" )
204207 options_dir = ServerConfig . expand_path ( "#{ @@path } /../rest-api/config/options" )
208+ config_dir = ServerConfig . expand_path ( "#{ @@path } /../src/config" )
205209
206210 # get supplied options
207211 force = find_arg ( [ '--force' ] ) . present?
@@ -258,6 +262,10 @@ def self.init
258262 # Update properties file to set server-version to value specified on command-line
259263 properties_file . gsub! ( /server-version=6/ , "server-version=#{ server_version } " )
260264
265+ if [ "rest" , "bare" ] . include? app_type
266+ properties_file . gsub! ( /application-conf-file=src\/ app\/ config\/ config.xqy/ , 'application-conf-file=src/config/config.xqy' )
267+ end
268+
261269 # save the replacements
262270 open ( build_properties , 'w' ) { |f | f . write ( properties_file ) }
263271 end
@@ -271,6 +279,11 @@ def self.init
271279 copy_file sample_rest_properties , rest_properties
272280 end
273281
282+ if [ "rest" , "bare" ] . include? app_type
283+ FileUtils . mkdir_p config_dir
284+ copy_file sample_app_config , app_config
285+ end
286+
274287 target_config = ServerConfig . expand_path ( ServerConfig . properties [ "ml.config.file" ] )
275288
276289 if !force && !force_config && File . exists? ( target_config )
@@ -1905,8 +1918,7 @@ def deploy_modules
19051918 def deploy_src
19061919 test_dir = @properties [ 'ml.xquery-test.dir' ]
19071920 xquery_dir = @properties [ 'ml.xquery.dir' ]
1908- # modules_db = @properties['ml.modules-db']
1909- app_config_file = File . join xquery_dir , "/app/config/config.xqy"
1921+ app_configs = @properties [ 'ml.application-conf-file' ]
19101922 test_config_file = File . join test_dir , "/test-config.xqy"
19111923 load_html_as_xml = @properties [ 'ml.load-html-as-xml' ]
19121924 load_js_as_binary = @properties [ 'ml.load-js-as-binary' ]
@@ -1933,6 +1945,7 @@ def deploy_src
19331945
19341946 end
19351947
1948+ total_count = 0
19361949 modules_databases . each do |dest_db |
19371950 if dest_db == "filesystem"
19381951 logger . info "Skipping deployment of src to #{ dest_db } .."
@@ -1941,7 +1954,6 @@ def deploy_src
19411954
19421955 ignore_us = [ ]
19431956 ignore_us << "^#{ test_dir } .*$" unless test_dir . blank? || deploy_tests? ( dest_db )
1944- ignore_us << "^#{ app_config_file } $"
19451957 ignore_us << "^#{ test_config_file } $"
19461958 ignore_us << "^#{ folders_to_ignore } $" unless folders_to_ignore . blank?
19471959
@@ -1956,7 +1968,34 @@ def deploy_src
19561968 src_permissions . flatten!
19571969 end
19581970
1959- @logger . debug ( "source permissions: #{ src_permissions } " )
1971+ @logger . debug "source permissions: #{ src_permissions } "
1972+ if app_configs . present?
1973+ logger . debug "Deploying application configurations"
1974+
1975+ app_configs . split ( ',' ) . each do |item |
1976+ buffer = File . read item
1977+ replace_properties ( buffer , File . basename ( item ) )
1978+
1979+ item_name = item
1980+ prefix = '/'
1981+ if item_name === 'src/app/config/config.xqy'
1982+ item_name = '/config.xqy'
1983+ ignore_us << '/app/config/config.xqy'
1984+ prefix = 'app/config/'
1985+ elsif item . start_with? ( "src/" )
1986+ item_name = '/' + item [ 4 , item . length ]
1987+ ignore_us << item_name
1988+ end
1989+
1990+ logger . debug "deploying application configuration #{ item } with name #{ item_name } on #{ dest_db } "
1991+ total_count += xcc . load_buffer item_name ,
1992+ buffer ,
1993+ :db => dest_db ,
1994+ :add_prefix => File . join ( @properties [ "ml.modules-root" ] , prefix ) ,
1995+ :permissions => src_permissions
1996+ end
1997+ logger . debug "Done deploying application configurations"
1998+ end
19601999
19612000 total_count = load_data xquery_dir ,
19622001 :add_prefix => @properties [ "ml.modules-prefix" ] ,
@@ -1968,16 +2007,6 @@ def deploy_src
19682007 :load_css_as_binary => load_css_as_binary ,
19692008 :permissions => src_permissions
19702009
1971- if File . exist? app_config_file
1972- buffer = File . read app_config_file
1973- replace_properties ( buffer , File . basename ( app_config_file ) )
1974-
1975- total_count += xcc . load_buffer "/config.xqy" ,
1976- buffer ,
1977- :db => dest_db ,
1978- :add_prefix => File . join ( @properties [ "ml.modules-root" ] , "app/config" ) ,
1979- :permissions => src_permissions
1980- end
19812010
19822011 if deploy_tests? ( dest_db ) && File . exist? ( test_config_file )
19832012 buffer = File . read test_config_file
0 commit comments