Skip to content

Commit

Permalink
Fixed marklogic-community#395: automatically adjust rewriter based on…
Browse files Browse the repository at this point in the history
… ml version
  • Loading branch information
grtjn committed Apr 30, 2015
1 parent a63db66 commit 519ec4e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions deploy/lib/server_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,19 @@ def config
def bootstrap
raise ExitException.new("Bootstrap requires the target environment's hostname to be defined") unless @hostname.present?

if @server_version > 7 && @properties["ml.app-type"] == 'rest' && @properties["ml.url-rewriter"] == "/MarkLogic/rest-api/rewriter.xqy"
@logger.info "WARN: XQuery REST rewriter has been deprecated since MarkLogic 8"
@properties["ml.url-rewriter"] = "/MarkLogic/rest-api/rewriter.xml"

elsif @server_version < 8 && @properties["ml.app-type"] == 'rest' && @properties["ml.url-rewriter"] == "/MarkLogic/rest-api/rewriter.xml"
@logger.info "WARN: XML REST rewriter not supported on MarkLogic 7 or less"
@properties["ml.url-rewriter"] = "/MarkLogic/rest-api/rewriter.xqy"

elsif @server_version > 7 && @properties["ml.app-type"] == 'hybrid'
@logger.info "WARN: Running hybrid app-type with MarkLogic 8 requires manual patching of Roxy rewriter."
@logger.info " See https://github.com/marklogic/roxy/issues/416 for details."
end

logger.info "Bootstrapping your project into MarkLogic #{@properties['ml.server-version']} on #{@hostname}..."
setup = File.read(ServerConfig.expand_path("#{@@path}/lib/xquery/setup.xqy"))
r = execute_query %Q{#{setup} setup:do-setup(#{get_config})}
Expand Down

0 comments on commit 519ec4e

Please sign in to comment.