Skip to content

Commit

Permalink
Fixed marklogic-community#362: added support for app-type bare
Browse files Browse the repository at this point in the history
  • Loading branch information
grtjn committed Feb 20, 2015
1 parent 930b3a8 commit 275d729
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.mdown
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Download the [ml](https://github.com/marklogic/roxy/raw/master/ml) file
1. Open a command prompt in the root folder of Roxy.
2. Run ml init to create sample configuration files.
*You must specify the --server-version option with a value of 4, 5, 6 or 7*.
*You must specify the --app-type with a value or rest, hybrid, or mvc*.
*You must specify the --app-type with a value or bare, rest, hybrid, or mvc*.

`$ ml init app-name --server-version=7 --app-type=rest`
3. Modify deploy/build.properties with your application's settings.
Expand Down
1 change: 1 addition & 0 deletions deploy/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ group=Default

#
# The type of application. Choices are:
# bare: a bare Roxy app project
# mvc: a normal, XQuery-based Roxy MVC app
# rest: an app based on the ML6 REST API
# hybrid: an app that uses Roxy rewriting and the ML6 REST API
Expand Down
10 changes: 7 additions & 3 deletions deploy/lib/server_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,13 @@ def self.init
properties_file.gsub!(/rewrite-resolves-globally=/, "rewrite-resolves-globally=true")
end

# rest applications don't use Roxy's MVC structure, so they can use MarkLogic's rewriter and error handler
if app_type == "rest"
# ML8 rest uses the new native rewriter
if app_type == "bare"
# bare applications don't use rewriter and error handler
properties_file.gsub!(/url-rewriter=\/roxy\/rewrite.xqy/, "url-rewriter=")
properties_file.gsub!(/error-handler=\/roxy\/error.xqy/, "error-handler=")
elsif app_type == "rest"
# rest applications don't use Roxy's MVC structure, so they can use MarkLogic's rewriter and error handler
# Note: ML8 rest uses the new native rewriter
rewriter_name = (server_version == "8") ? "rewriter.xml" : "rewriter.xqy"
properties_file.gsub!(/url-rewriter=\/roxy\/rewrite.xqy/, "url-rewriter=/MarkLogic/rest-api/" + rewriter_name)
properties_file.gsub!(/error-handler=\/roxy\/error.xqy/, "error-handler=/MarkLogic/rest-api/error-handler.xqy")
Expand Down
1 change: 1 addition & 0 deletions deploy/sample/build.sample.properties
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ appuser-password=random

#
# The type of application. Choices are:
# bare: a bare Roxy app project
# mvc: a normal, XQuery-based Roxy MVC app
# rest: an app based on the ML6 REST API
# hybrid: an app that uses Roxy rewriting and the ML6 REST API
Expand Down
1 change: 1 addition & 0 deletions deploy/test/data/ml7-properties/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ appuser-password=Z:S1P%c9%afEqJUZu)UA

#
# The type of application. Choices are:
# bare: a bare Roxy app project
# mvc: a normal, XQuery-based Roxy MVC app
# rest: an app based on the ML6 REST API
# hybrid: an app that uses Roxy rewriting and the ML6 REST API
Expand Down
1 change: 1 addition & 0 deletions deploy/test/data/ml7-properties/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ xquery.dir=${basedir}/src
group=Default
#
# The type of application. Choices are:
# bare: a bare Roxy app project
# mvc: a normal, XQuery-based Roxy MVC app
# rest: an app based on the ML6 REST API
# hybrid: an app that uses Roxy rewriting and the ML6 REST API
Expand Down
9 changes: 5 additions & 4 deletions ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ hash ruby 2>&- || { echo >&2 "Ruby is required to run the ml scripts."; exit 1;

usage()
{
printf "Usage: ml new app-name --server-version=[version-number] [--branch=branch] [--app-type=mvc|hybrid|rest] [--git]\n
printf "Usage: ml new app-name --server-version=[version-number] [--branch=branch] [--app-type=bare|mvc|hybrid|rest] [--git]\n
use --git to automatically configure a git repo
use --branch to specify the GitHub branch of the Roxy project your project
will be based on (master, dev)
use --app-type to specify the project type:
bare: a bare Roxy project
mvc: a Roxy MVC project
rest: a MarkLogic REST API project
hybrid: a hybrid of both types
hybrid: a hybrid of MVC and REST types
use --force to force installation into an existing directory\n"
}

Expand Down Expand Up @@ -89,9 +90,9 @@ then
exit 1
fi

if [ "$APPTYPE" != "mvc" ] && [ "$APPTYPE" != "rest" ] && [ "$APPTYPE" != "hybrid" ]
if [ "$APPTYPE" != "bare" ] && [ "$APPTYPE" != "mvc" ] && [ "$APPTYPE" != "rest" ] && [ "$APPTYPE" != "hybrid" ]
then
printf "\nValid values for app-type are mvc, rest and hybrid. Aborting\n"
printf "\nValid values for app-type are bare, mvc, rest and hybrid. Aborting\n"
exit 1
fi

Expand Down
4 changes: 2 additions & 2 deletions ml.bat
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ if EXIST %app_name% GOTO alreadyexists

:skip_already_exists

if not "%APPTYPE%"=="mvc" if not "%APPTYPE%"=="rest" if not "%APPTYPE%"=="hybrid" (
echo Valid values for app-type are mvc, rest and hybrid. Aborting.
if not "%APPTYPE%"=="bare" if not "%APPTYPE%"=="mvc" if not "%APPTYPE%"=="rest" if not "%APPTYPE%"=="hybrid" (
echo Valid values for app-type are bare, mvc, rest and hybrid. Aborting.
exit /b
)

Expand Down

0 comments on commit 275d729

Please sign in to comment.