Permalink
Browse files

Several minor bugfixes around package and variables.

  • Loading branch information...
1 parent 2250602 commit e629231c4a55ff2cf46bea4037aca9f430029052 @wayneeseguin wayneeseguin committed Sep 8, 2011
@@ -46,6 +46,9 @@ package()
do
_token="$1" && shift
case "${_token}" in
+ (cli)
+ _command=cli
+ ;;
(is)
_command=is
case "$1" in
@@ -145,8 +148,9 @@ package()
esac
done
+ true ${package_name:=${extension}}
+
[[ -n "${package_name}" ]] || fail "Package name must be set/given"
- [[ -n "${package_version}" ]] || fail "Package version must be set/given"
case "${_command}" in
(make)
@@ -162,7 +166,7 @@ package()
(is)
case "$_subcommand" in
(active|installed)
- __sm.package.is.${_subcommand}
+ __sm.package.is.${_subcommand} "${_params[@]}"
;;
esac
;;
@@ -1,12 +1,16 @@
#!/bin/sh
+variable() { variables "$@"; }
+
variables()
{
trace_filter variables
local _command _variables=() _type
if __sm.string.starts.with.one.of "$* " \
+ "is empty " \
+ "is nonempty " \
"are empty " \
"are nonempty " \
"must be empty " \
@@ -47,9 +51,9 @@ variables()
# TODO: Think through variables more...
case "${_command}" in
- (are.empty|are.nonempty)
+ (is.empty|is.nonempty|are.empty|are.nonempty)
[[ -n "${_variables[*]}" ]] || error "No variable names given for validation"
- __sm.variables.${_command} "${_variables[@]}"
+ __sm.variables.${_command/#is/are} "${_variables[@]}"
;;
(must.be.empty|must.be.nonempty)
[[ -n "${_variables[*]}" ]] || error "No variable names given for validation"
@@ -423,7 +423,7 @@ __sm.package.init()
for variable in default_version base_url md5_url user
do
- if variable is empty package_${variable}
+ if variable is empty "package_${variable}"
then
config read file defaults from ${package_name} \
key ${variable} variable ${variable} prefix package
@@ -432,7 +432,7 @@ __sm.package.init()
for variable in website_url archive_format
do
- if variable is empty ${variable}
+ if variable is empty "${variable}"
then
config read file defaults from ${package_name} \
key ${variable} variable ${variable}
@@ -810,7 +810,6 @@ __sm.package.patches.apply()
done
}
-
__sm.package.is.active()
{
local _name="${1:-}" _version="${2:-}"
@@ -5,3 +5,5 @@ api/os
api/defaults
api/templates
api/user
+api/variables
+api/config

0 comments on commit e629231

Please sign in to comment.