Skip to content

Commit

Permalink
More wording alterations and code simplification.
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed Aug 20, 2011
1 parent 7d8083a commit 8b91e87
Show file tree
Hide file tree
Showing 13 changed files with 113 additions and 158 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Bash Delectable Scripting Modules (BDSM) Framework
S{cripting,ystem,tack} Management (SM) Framework

Copyright (c) 2009-2011 Wayne E. Seguin

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# S{cripting,ystem,tack} Management (SM) Framework
(Core)
# S{cripting,ystem,tack} Management (SM) Framework (Core)

SM is a system scripting and DSL & management framework for beating software
and systems into submission!
Expand Down
91 changes: 41 additions & 50 deletions core/cli/actions/clone
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,50 @@
NYI
# extension_is_installed removed, as it was not working already.

if array_is_nonempty extension_args
then
for (( index = 0 ; index < ${#extension_args[@]} ; index++ ))
do
token="${extension_args[${index}]}"
case "${token}" in
to)
_target="${extension_args[$((++index))]}"
;;
from)
_source="${extension_args[$((++index))]}"
;;
*)
if [[ -z "${_source}" ]]
then
_source="$token"
elif [[ -z "${_target}" ]]
then
_target="$token"
else
break
fi
;;
esac
done
array_is_nonempty extension_args ||
error "An extension name must be specified."

# Sanity checks.
if variable_is_nonempty _source
then
if variable_is_nonempty _target
then
if extension_is_installed "${_source}"
for (( index = 0 ; index < ${#extension_args[@]} ; index++ ))
do
token="${extension_args[${index}]}"
case "${token}" in
to)
_target="${extension_args[$((++index))]}"
;;
from)
_source="${extension_args[$((++index))]}"
;;
*)
if [[ -z "${_source}" ]]
then
if extension_is_installed "${_target}"
then
error "The target extension '${_target}' already exists; "\
"cannot create it from ${_source}."
else
copy_directory \
from "${extensions_development_path}/${_source}" \
to "${extensions_development_path}/${_target}"

fi
_source="$token"
elif [[ -z "${_target}" ]]
then
_target="$token"
else
error "The extension '${_source}' was not found installed; "\
"cannot create a new extension from it."
break
fi
else
error "A target extension name must be specified."
fi
else
error "A source extension name must be specified."
fi
;;
esac
done

# Sanity checks.
variable_is_nonempty _source ||
error "A source extension name must be specified."

variable_is_nonempty _target ||
error "A target extension name must be specified."

extension_is_installed "${_source}" ||
error "The extension '${_source}' was not found installed; "\
"cannot create a new extension from it."

if extension_is_installed "${_target}"
then
error "The target extension '${_target}' already exists; "\
"cannot create it from ${_source}."
else
error "An extension name must be specified."
copy_directory \
from "${extensions_development_path}/${_source}" \
to "${extensions_development_path}/${_target}"
fi
40 changes: 15 additions & 25 deletions core/cli/actions/console
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,19 @@

shell_version=( $( ${user_shell} --version | head -n 1 ) )

if [[ "${shell_version[1]}" == "bash," ]] && (( ${BASH_VERSINFO[0]} > 3 ))
then
trap - ERR
${user_shell} --rcfile <(echo "
[[ -s ~/.bash_profile ]] && source ~/.bash_profile
[[ -s ~/.profile ]] && source ~/.profile
source ${sm_path}/core/sm/modules/shell/core/initialize
module ext/vcs
fail()
{
backtrace \"\$*\" no_exit
}
error()
{
printf \"\\nERROR: \$*\\n\" >&2
}
exit()
{
builtin exit 0
}
trap \"backtrace \\\"A command has returned error code (\\\$?) without being handled.\\\" no_exit\" ERR
export PS1='(sm) [ret=\$?] \w > '
") -i
else
[[ "${shell_version[1]}" == "bash," ]] && (( ${BASH_VERSINFO[0]} > 3 )) ||
error "Unsuported shell:\n ${shell_version[*]}\n\nUse bash 4 for console\n"
fi

trap - ERR
${user_shell} --rcfile <(echo "
[[ -s ~/.bash_profile ]] && source ~/.bash_profile
[[ -s ~/.profile ]] && source ~/.profile
source ${sm_path}/core/sm/modules/shell/core/initialize
module ext/vcs
fail() { backtrace \"\$*\" no_exit ; }
error() { printf \"\\nERROR: \$*\\n\" >&2 ; }
exit() { builtin exit 0 ; }
trap \"backtrace \\\"A command has returned error code (\\\$?) without being handled.\\\" no_exit\" ERR
export PS1='(sm) [ret=\$?] \w > '
") -i

12 changes: 6 additions & 6 deletions core/cli/actions/help
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

extension="<extension>"

description "Benevolent Delectable S{cripting,ystem} Manager (BDSM) Framework (Core)"
description "Benevolent Delectable S{cripting,ystem} Manager (SM) Framework (Core)"

action "{file_name}" "Run the provided {file_name}, with BDSM initialized."
action "{file_name}" "Run the provided {file_name}, with SM initialized."
action "smrc" "Install smrc template file into ~/.smrc."
action_separator
action "get head" "Fetch and install the latest BDSM development version."
action "get head" "Fetch and install the latest SM development version."
action "ext install {name} {uri}" "Install extension {name} from {uri}."
action "ext update {name}" "Update extension {name}."
action "sets" "List all installed extension sets and their extensions."
action "sets help" "Show available extension sets help."
action_separator
action "version" "Display the curently installed BDSM version."
action "version" "Display the curently installed SM version."
action "help" "Display this help."

notes="
Expand All @@ -38,8 +38,8 @@ notes="
"

resource "http://bdsm.beginrescueend.com/"
resource "http://bdsm.beginrescueend.com/extensions/"
resource "http://sm.beginrescueend.com/"
resource "http://sm.beginrescueend.com/extensions/"
resource "https://www.pivotaltracker.com/projects/26822"

show_help usage
19 changes: 7 additions & 12 deletions core/cli/actions/open
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
#!/usr/bin/env bash

if array_is_nonempty extension_args
then
if path_exists "${extensions_development_path}/${extension_args[0]}"
then
enter "${extensions_development_path}/${extension_args[0]}"

os_open "$PWD"
else
error "Failed to open '${extension_args[0]}'; it appears to not be installed."
fi
else
array_is_nonempty extension_args ||
fail "You must specify at least one extension name."
fi

path_exists "${extensions_development_path}/${extension_args[0]}" ||
error "Failed to open '${extension_args[0]}'; it appears to not be installed."

os_open "${extensions_development_path}/${extension_args[0]}"

13 changes: 0 additions & 13 deletions core/cli/actions/remove

This file was deleted.

16 changes: 7 additions & 9 deletions core/cli/actions/src
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#!/usr/bin/env bash

if array_is_nonempty extension_args
array_is_nonempty extension_args ||
fail "You must specify at least one extension name."

if path_exists "${extensions_development_path}/${extension_args[0]}"
then
if path_exists "${extensions_development_path}/${extension_args[0]}"
then
printf "${extensions_development_path}/${extension_args[0]}"
else
printf "." # Stay put!
error "Failed to edit '${extension_args[0]}'; it appears to not be installed."
fi
printf "${extensions_development_path}/${extension_args[0]}"
else
fail "You must specify at least one extension name."
printf "." # Stay put!
error "Failed to edit '${extension_args[0]}'; it appears to not be installed."
fi

12 changes: 6 additions & 6 deletions core/cli/actions/website
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

if array_is_nonempty extension_args
then
enter "${extensions_development_path}/${extension_args[0]}/"
os_open "$PWD"
else
array_is_nonempty extension_args ||
fail "You must specify at least one extension name."
fi

enter "${extensions_development_path}/${extension_args[0]}/"

os_open "$PWD"

10 changes: 5 additions & 5 deletions core/cli/man/man1/cli.1
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
.\" $Log$
.\"

.TH BDSM 1 "2011 August 17" "BDSM"
.TH SM 1 "2011 August 17" "SM Framework"

.SH SYNOPSIS
.B sm
[cli] {file|options...} {namespace} action {action-params}

.SH DESCRIPTION
Benevolent Delectable S{cripting,ystem} Manager (BDSM) Framework (Core)
S{cripting,ystem} Manager (SM) Framework (Core)

.SH Actions
.TP 13
.B {file_name}
Run the provided {file_name}, with BDSM initialized.
Run the provided {file_name}, with SM initialized.
.TP 13
.B smrc
Install/update smrc template file in ~/.smrc.
Expand All @@ -28,7 +28,7 @@ Force install smrc template file into ~/.smrc (no update).

.TP 13
.B get head
Fetch and install the latest BDSM development version.
Fetch and install the latest SM development version.
.TP 13
.B ext install {name} {uri}
Install extension {name} from {uri}.
Expand All @@ -45,7 +45,7 @@ Show available extension sets help.

.TP 13
.B version
Display the curently installed BDSM version.
Display the curently installed SM version.
.TP 13
.B help
Display this help.
Expand Down
2 changes: 1 addition & 1 deletion core/cli/man/man1/cli_curl.1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.\" $Log$
.\"

.TH BDSM 1 "2011 August 19" "BDSM"
.TH SM 1 "2011 August 19" "SM Framework"

.SH DESCRIPTION
By default curl does not allow to download resources securred (SSL) with not
Expand Down
4 changes: 2 additions & 2 deletions core/cli/man/man1/cli_smrc.1
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
.\" $Log$
.\"

.TH BDSM 1 "2011 August 17" "BDSM"
.TH SM 1 "2011 August 17" "SM Framework"

.SH SYNOPSIS
.B sm
[cli] smrc [install]

.SH DESCRIPTION
BDSM action to update or generate ~/.smrc file
SM action to update or generate ~/.smrc file

.SH Actions
.TP 13
Expand Down
Loading

0 comments on commit 8b91e87

Please sign in to comment.