aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.app/lib/app-instance (renamed from .app/lib/app-app)14
-rwxr-xr-xapp10
-rw-r--r--app_completion6
-rw-r--r--docs/README.md2
-rwxr-xr-xtest/app-help.bats22
-rwxr-xr-xtest/app-install.bats8
-rwxr-xr-xtest/app-list-versions.bats16
-rwxr-xr-xtest/app-list.bats70
8 files changed, 74 insertions, 74 deletions
diff --git a/.app/lib/app-app b/.app/lib/app-instance
index cb87847..2012a74 100644
--- a/.app/lib/app-app
+++ b/.app/lib/app-instance
@@ -65,10 +65,10 @@ method_install_usage() {
echo "usage: install <-r resolver> -u <url>" >&2
echo "" >&2
echo "Install package from a Maven repository:" >&2
- echo " $0 [-n name] [-i instance] app install -r maven -u groupId:artifactId:version" >&2
+ echo " $0 [-n name] [-i instance] instance install -r maven -u groupId:artifactId:version" >&2
echo "" >&2
echo "Install package from a file:" >&2
- echo " $0 [-n name] [-i instance] app install -r file -u file [-v version]" >&2
+ echo " $0 [-n name] [-i instance] instance install -r file -u file [-v version]" >&2
echo "The version defaults to the current timestamp" >&2
exit 1
}
@@ -413,13 +413,13 @@ method_list_versions() {
return 0
}
-method_app_usage() {
+method_instance_usage() {
if [ -n "$1" ]
then
echo "Error:" $@ >&2
fi
- echo "usage: $0 app <method>" >&2
+ echo "usage: $0 instance <method>" >&2
echo "" >&2
echo "Available methods:" >&2
echo " install - Installs an application" >&2
@@ -428,7 +428,7 @@ method_app_usage() {
echo " set-current - Set the current version" >&2
}
-method_app() {
+method_instance() {
local name="$1"; shift
local instance="$1"; shift
local method="$1"
@@ -446,9 +446,9 @@ method_app() {
*)
if [ -z "$method" ]
then
- method_app_usage
+ method_instance_usage
else
- method_app_usage "Unknown method $method"
+ method_instance_usage "Unknown method $method"
fi
;;
esac
diff --git a/app b/app
index 0c4cbd1..f02f11d 100755
--- a/app
+++ b/app
@@ -35,7 +35,7 @@ method_usage() {
echo "usage: $0 [-n name] [-i instance] <method group>" >&2
echo "" >&2
echo "Available method groups:" >&2
- echo " app" >&2
+ echo " instance" >&2
echo " conf" >&2
echo " operate" >&2
echo "" >&2
@@ -43,7 +43,7 @@ method_usage() {
}
. $APPSH_HOME/.app/lib/app-common
-. $APPSH_HOME/.app/lib/app-app
+. $APPSH_HOME/.app/lib/app-instance
. $APPSH_HOME/.app/lib/app-conf
. $APPSH_HOME/.app/lib/app-operate
@@ -75,8 +75,8 @@ main() {
method_usage
else
case "$h" in
- app)
- method_app_usage
+ instance)
+ method_instance_usage
;;
conf)
method_conf_usage
@@ -104,7 +104,7 @@ main() {
fi
case "$method" in
- app) method_app "$name" "$instance" "$@" ;;
+ instance) method_instance "$name" "$instance" "$@" ;;
conf) method_conf "$name" "$instance" "$@" ;;
operate) method_operate "$name" "$instance" "$@" ;;
*)
diff --git a/app_completion b/app_completion
index 68a3b7b..c4bfe02 100644
--- a/app_completion
+++ b/app_completion
@@ -6,7 +6,7 @@ _appsh_contains() {
}
_appsh_methods=(
- "app"
+ "instance"
"conf"
"operate"
)
@@ -58,14 +58,14 @@ _complete_appsh() {
case $prev in
-n)
- values=$(./app app list -P name)
+ values=$(./app instance list -P name)
COMPREPLY=($(compgen -W "$values" -- ${cur}))
return 0
;;
-i)
if [ -n "$has_n" ]
then
- values=$(./app app list -n $has_n -P instance)
+ values=$(./app instance list -n $has_n -P instance)
COMPREPLY=($(compgen -W "$values" -- ${cur}))
return 0
fi
diff --git a/docs/README.md b/docs/README.md
index f818faf..a757254 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -40,7 +40,7 @@ TODOs
Commands
--------
-### `app`
+### `instance`
#### `install`
diff --git a/test/app-help.bats b/test/app-help.bats
index 68f88e3..4b94f23 100755
--- a/test/app-help.bats
+++ b/test/app-help.bats
@@ -3,35 +3,35 @@
load utils
-@test "./app app" {
- app app; echo_lines
+@test "./app instance" {
+ app instance; echo_lines
[ $status -eq $exit_usage_wrong ]
- [ $(expr "${lines[0]}" : "usage: ./app app .*") -ne 0 ]
+ [ $(expr "${lines[0]}" : "usage: ./app instance .*") -ne 0 ]
[ ${#lines[*]} == 6 ]
}
-@test "./app app install" {
- app app install; echo_lines
+@test "./app instance install" {
+ app instance install; echo_lines
[ $status -eq $exit_usage ]
[ $(expr "${lines[0]}" : "usage: install .*") -ne 0 ]
[ ${#lines[*]} == 6 ]
}
-@test "./app app list" {
- app app list; echo_lines
+@test "./app instance list" {
+ app instance list; echo_lines
[ $status -eq 0 ]
[ ${#lines[*]} == 0 ]
}
-@test "./app app list-versions" {
- app app list-versions; echo_lines
+@test "./app instance list-versions" {
+ app instance list-versions; echo_lines
[ $status -eq $exit_usage ]
[ $(expr "${lines[0]}" : "usage: list-versions .*") -ne 0 ]
[ ${#lines[*]} == 1 ]
}
-@test "./app app set-current" {
- app app "set-current"; echo_lines
+@test "./app instance set-current" {
+ app instance "set-current"; echo_lines
[ $status -eq $exit_usage ]
[ $(expr "${lines[0]}" : "usage: set-current .*") -ne 0 ]
[ ${#lines[*]} == 1 ]
diff --git a/test/app-install.bats b/test/app-install.bats
index 9961c84..59880bd 100755
--- a/test/app-install.bats
+++ b/test/app-install.bats
@@ -5,9 +5,9 @@ load utils
# TODO: Add test for installing duplicate version
-@test "./app app install app-a" {
+@test "./app instance install app-a" {
mkzip "app-a"
- app app install \
+ app instance install \
-r file \
-u $BATS_TEST_DIRNAME/data/app-a.zip \
-n app-a -i prod
@@ -23,9 +23,9 @@ Changing current symlink" ]
[ ${#lines[*]} == 6 ]
}
-@test "./app app install install-test-env" {
+@test "./app instance install install-test-env" {
mkzip "install-test-env"
- app app install \
+ app instance install \
-r file \
-u $BATS_TEST_DIRNAME/data/install-test-env.zip \
-n install-test-env -i prod -v 1.0
diff --git a/test/app-list-versions.bats b/test/app-list-versions.bats
index 207a282..17fb2d2 100755
--- a/test/app-list-versions.bats
+++ b/test/app-list-versions.bats
@@ -3,22 +3,22 @@
load utils
-@test "./app app list-versions" {
+@test "./app instance list-versions" {
mkzip "app-a"
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0
[ $status -eq 0 ]
- app app list-versions -n app-a -i env-a; echo_lines
+ app instance list-versions -n app-a -i env-a; echo_lines
[ $status -eq 0 ]
[ "$output" = "Available versions for app-a/env-a:
1.0
1.1" ]
- app app list-versions -n app-a -i env-a -P; echo_lines
+ app instance list-versions -n app-a -i env-a -P; echo_lines
[ $status -eq 0 ]
[ "$output" = "1.0
1.1" ]
diff --git a/test/app-list.bats b/test/app-list.bats
index e7e06e9..3092837 100755
--- a/test/app-list.bats
+++ b/test/app-list.bats
@@ -3,16 +3,16 @@
load utils
-@test "./app app list - all apps" {
+@test "./app instance list - all apps" {
mkzip "app-a"
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0
[ $status -eq 0 ]
- app app list; echo_lines
+ app instance list; echo_lines
[ $status -eq 0 ]
[ "$output" = "Name Instance Version
app-a env-a 1.1
@@ -20,7 +20,7 @@ app-a env-b 1.0
app-b env-a 1.0
app-b env-b 1.0 " ]
- app app list -P name -P instance -P version; echo_lines
+ app instance list -P name -P instance -P version; echo_lines
[ $status -eq 0 ]
[ "$output" = "app-a:env-a:1.1
app-a:env-b:1.0
@@ -28,75 +28,75 @@ app-b:env-a:1.0
app-b:env-b:1.0" ]
}
-@test "./app app list - -n filter" {
+@test "./app instance list - -n filter" {
mkzip "app-a"
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0
[ $status -eq 0 ]
- app app list -n foo; echo_lines
+ app instance list -n foo; echo_lines
[ $status -eq 0 ]
[ "$output" = "Name Instance Version " ]
- app app list -n app-a; echo_lines
+ app instance list -n app-a; echo_lines
[ $status -eq 0 ]
[ "$output" = "Name Instance Version
app-a env-a 1.1
app-a env-b 1.0 " ]
- app app list -n app-a -P name -P instance -P version; echo_lines
+ app instance list -n app-a -P name -P instance -P version; echo_lines
[ $status -eq 0 ]
[ "$output" = "app-a:env-a:1.1
app-a:env-b:1.0" ]
}
-@test "./app app list - -i filter" {
+@test "./app instance list - -i filter" {
mkzip "app-a"
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0
[ $status -eq 0 ]
- app app list -i foo; echo_lines
+ app instance list -i foo; echo_lines
[ $status -eq 0 ]
[ "$output" = "Name Instance Version " ]
- app app list -i env-a; echo_lines
+ app instance list -i env-a; echo_lines
[ $status -eq 0 ]
[ "$output" = "Name Instance Version
app-a env-a 1.1
app-b env-a 1.0 " ]
- app app list -i env-a -P name -P instance -P version; echo_lines
+ app instance list -i env-a -P name -P instance -P version; echo_lines
[ $status -eq 0 ]
[ "$output" = "app-a:env-a:1.1
app-b:env-a:1.0" ]
}
-@test "./app app list - -n + -i filter" {
+@test "./app instance list - -n + -i filter" {
mkzip "app-a"
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 &&
- app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 &&
+ app instance install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0
[ $status -eq 0 ]
- app app list -n foo -i bar; echo_lines
+ app instance list -n foo -i bar; echo_lines
[ $status -eq 0 ]
[ "$output" = "Name Instance Version " ]
- app app list -n app-a -i env-a; echo_lines
+ app instance list -n app-a -i env-a; echo_lines
[ $status -eq 0 ]
[ "$output" = "Name Instance Version
app-a env-a 1.1 " ]
- app app list -n app-a -i env-a -P name -P instance -P version; echo_lines
+ app instance list -n app-a -i env-a -P name -P instance -P version; echo_lines
[ $status -eq 0 ]
[ "$output" = "app-a:env-a:1.1" ]
}