summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/init.sh29
-rw-r--r--src/core/plugins2
-rw-r--r--src/core/plugins.d/repo/commit.d.sh (renamed from src/rvs-core/commit.d.sh)8
-rw-r--r--src/core/plugins.d/repo/commit.f.sh (renamed from src/rvs-core/commit.f.sh)8
-rw-r--r--src/core/plugins.d/repo/commit.sh (renamed from src/rvs-core/commit.sh)20
-rw-r--r--src/core/plugins.d/repo/get.d.sh (renamed from src/rvs-core/get.d.sh)6
-rw-r--r--src/core/plugins.d/repo/get.f.sh (renamed from src/rvs-core/get.f.sh)4
-rw-r--r--src/core/plugins.d/repo/get.sh (renamed from src/rvs-core/get.sh)6
-rw-r--r--src/core/plugins.d/repo/lib/stdio.sh (renamed from src/rvs-core/lib/stdio.sh)4
-rw-r--r--src/core/plugins.d/users/mkuser.sh24
-rw-r--r--src/core/plugins.d/users/rmuser.sh (renamed from src/rvs-core/init.sh)12
-rw-r--r--src/core/repo.sh (renamed from src/rvs-core/repo.sh)9
-rw-r--r--src/rvs-core/lib/rvsdb.sh84
-rw-r--r--src/rvs.sh26
14 files changed, 101 insertions, 141 deletions
diff --git a/src/core/init.sh b/src/core/init.sh
new file mode 100644
index 0000000..dc8a750
--- /dev/null
+++ b/src/core/init.sh
@@ -0,0 +1,29 @@
+#!$$SHELL$$
+name='rvs init'
+ver='0.7.0'
+# Copyright (C) 2009 Luke Shumaker
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+repo=`rvs repo`
+if [ "$old" = '' ]; then
+ repo='.rvs'
+ install -d "$repo"
+fi
+
+if diff -q $RVSDIR/plugins $repo/plugins; then
+ install -T $RVSDIR/plugins $repo/plugins
+ while read plugin; do
+ if [ ! -e "$repo/$plugin" ]; then
+ install -d "$repo/$plugin"
+ if [ -e "$RVSDIR/$plugin/init" ]; then
+ $RVSDIR/$plugin/init
+ fi
+ fi
+ done < $repo/plugins
+fi
+
diff --git a/src/core/plugins b/src/core/plugins
new file mode 100644
index 0000000..18b388a
--- /dev/null
+++ b/src/core/plugins
@@ -0,0 +1,2 @@
+repo
+users
diff --git a/src/rvs-core/commit.d.sh b/src/core/plugins.d/repo/commit.d.sh
index 7a0cc9a..5b2d3fd 100644
--- a/src/rvs-core/commit.d.sh
+++ b/src/core/plugins.d/repo/commit.d.sh
@@ -1,8 +1,6 @@
#!$$SHELL$$
-# abomination module:rvs:commit:d
name='rvs commit.d'
-ver='0.6.3'
-usage='[OPTIONS] DIRECTORY'
+ver='0.7.0'
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -11,14 +9,10 @@ usage='[OPTIONS] DIRECTORY'
#
# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
-source "$RVSDIR/lib/stdio"
-source "$RVSDIR/lib/rvsdb"
-
# commit.d DIRNAME
dir="$1"
tmp=`tempfile`
-loginit "$tmp"
for file in $dir/*; do
hash=`rvs commit "$file"`
echo "$file:$hash" >> "$tmp"
diff --git a/src/rvs-core/commit.f.sh b/src/core/plugins.d/repo/commit.f.sh
index a9be426..915ba3c 100644
--- a/src/rvs-core/commit.f.sh
+++ b/src/core/plugins.d/repo/commit.f.sh
@@ -1,8 +1,6 @@
#!$$SHELL$$
-# abomination module:rvs:commit:f
name='rvs commit.f'
-ver='0.6.3'
-usage='[OPTIONS] FILE'
+ver='0.7.0'
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,9 +15,9 @@ source "$RVSDIR/lib/rvsdb"
# commit.f FILENAME
file="$1"
-hash=`getid $file`
+#hash=`md5sum $file | sed "s/ .*$//"`
+hash=`sha1sum $file | sed "s/ .*$//"`
if [ ! -f "`rvs repo`/files/$hash" ]; then
- #cp "$file" "`rvs repo`/files/$hash"
install -m 644 -o $USER -g $USER -T "$file" "`rvs repo`/files/$hash"
fi
echo "$hash"
diff --git a/src/rvs-core/commit.sh b/src/core/plugins.d/repo/commit.sh
index 9fb44fc..0c8cfc5 100644
--- a/src/rvs-core/commit.sh
+++ b/src/core/plugins.d/repo/commit.sh
@@ -1,8 +1,6 @@
#!$$SHELL$$
-# abomination module:rvs:commit
name='rvs commit'
-ver='0.6.3'
-usage='[OPTIONS] [FILE]'
+ver='0.7.0'
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -12,7 +10,6 @@ usage='[OPTIONS] [FILE]'
# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
source "$RVSDIR/lib/stdio"
-source "$RVSDIR/lib/rvsdb"
# commit FILE
if [ $# -gt 0 ]; then
@@ -40,13 +37,14 @@ fi
ret=`rvs "commit.$type" "$file"`
tmp=`tempfile`
-loginit "$tmp"
-logwrite "$tmp" 'name' "$file"
-logwrite "$tmp" 'hash' "$ret"
-logwrite "$tmp" 'type' "$type"
-logwrite "$tmp" 'author' "$user"
-logwrite "$tmp" 'owner' "$owner"
-logwrite "$tmp" 'owner' "$license"
+cat << __EOF__ > "$tmp"
+name:$file
+hash:$ret
+type:$type
+author:$user
+owner:$owner
+license:$license
+__EOF__
rvs commit.f "$tmp"
rm "$tmp"
diff --git a/src/rvs-core/get.d.sh b/src/core/plugins.d/repo/get.d.sh
index a58a7c0..2443850 100644
--- a/src/rvs-core/get.d.sh
+++ b/src/core/plugins.d/repo/get.d.sh
@@ -1,8 +1,6 @@
#!$$SHELL$$
-# abomination module:rvs:get:d
name='rvs get.d'
-ver='0.6.3'
-usage='[OPTIONS] ID FILENAME'
+ver='0.7.0'
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -11,7 +9,7 @@ usage='[OPTIONS] ID FILENAME'
#
# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
-source "$RVSDIR/lib/stdio"
+#source "$RVSDIR/lib/stdio"
source "$RVSDIR/lib/rvsdb"
# get.d ID DIRNAME
diff --git a/src/rvs-core/get.f.sh b/src/core/plugins.d/repo/get.f.sh
index 3c17df5..e631a1f 100644
--- a/src/rvs-core/get.f.sh
+++ b/src/core/plugins.d/repo/get.f.sh
@@ -1,8 +1,6 @@
#!$$SHELL$$
-# abomination module:rvs:get:f
name='rvs get.f'
-ver='0.6.3'
-usage='[OPTIONS] ID FILENAME'
+ver='0.7.0'
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/rvs-core/get.sh b/src/core/plugins.d/repo/get.sh
index 1d3eb76..4317c40 100644
--- a/src/rvs-core/get.sh
+++ b/src/core/plugins.d/repo/get.sh
@@ -1,8 +1,6 @@
#!$$SHELL$$
-# abomination module:rvs:get
-name='rvs commit'
-ver='0.6.3'
-usage='[OPTIONS] ID [FILENAME]'
+name='rvs get'
+ver='0.7.0'
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/rvs-core/lib/stdio.sh b/src/core/plugins.d/repo/lib/stdio.sh
index 8facc79..e6ef31a 100644
--- a/src/rvs-core/lib/stdio.sh
+++ b/src/core/plugins.d/repo/lib/stdio.sh
@@ -1,8 +1,6 @@
#!$$SHELL$$
-# abomination module:rvs:lib:stdio
#name='rvs stdio'
-#ver='0.6.2'
-#usage=''
+#ver='0.7.0'
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/core/plugins.d/users/mkuser.sh b/src/core/plugins.d/users/mkuser.sh
new file mode 100644
index 0000000..74c8a77
--- /dev/null
+++ b/src/core/plugins.d/users/mkuser.sh
@@ -0,0 +1,24 @@
+#!$$SHELL$$
+name='rvs mkuser'
+ver='0.7.0'
+# Copyright (C) 2009 Luke Shumaker
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+read -p 'username: ' author
+read -p 'give copyright to: ' owner
+if [ "$owner" != 'Public Domain' ]; then
+ read -p 'use the license: ' license
+else
+ license=''
+fi
+cat << __EOF__ > "`rvs repo`/users/$author"
+author:$author
+owner:$owner
+license:$license
+__EOF__
+
diff --git a/src/rvs-core/init.sh b/src/core/plugins.d/users/rmuser.sh
index ff650a5..82a71c5 100644
--- a/src/rvs-core/init.sh
+++ b/src/core/plugins.d/users/rmuser.sh
@@ -1,8 +1,6 @@
#!$$SHELL$$
-# abomination rvs init
-name='rvs init'
-ver='0.6.3'
-usage='[OPTIONS]'
+name='rvs rmuser'
+ver='0.7.0'
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -11,8 +9,6 @@ usage='[OPTIONS]'
#
# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
-source "$RVSDIR/lib/stdio"
-source "$RVSDIR/lib/rvsdb"
-
-mkdir -p .rvs/{,files}
+uname=$1
+rm "`rvs repo`/users/$uname"
diff --git a/src/rvs-core/repo.sh b/src/core/repo.sh
index 1db22c9..a94ccb8 100644
--- a/src/rvs-core/repo.sh
+++ b/src/core/repo.sh
@@ -1,8 +1,6 @@
#!$$SHELL$$
-# abomination rvs init
name='rvs repo'
-ver='0.6.3'
-usage='[OPTIONS]'
+ver='0.7.0'
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -11,8 +9,6 @@ usage='[OPTIONS]'
#
# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
-source "$RVSDIR/lib/stdio"
-
repo='.rvs'
pwd=`pwd`
@@ -24,6 +20,7 @@ done
if [ -e "`pwd`/$repo" ]; then
echo "`pwd`/$repo"
else
- fatal 'no rvs repository found'
+ echo "$name: no rvs repository found" >> /dev/stderr
+ exit 1
fi
diff --git a/src/rvs-core/lib/rvsdb.sh b/src/rvs-core/lib/rvsdb.sh
deleted file mode 100644
index 41f0e03..0000000
--- a/src/rvs-core/lib/rvsdb.sh
+++ /dev/null
@@ -1,84 +0,0 @@
-#!$$SHELL$$
-# abomination module:rvs:lib:rvsdb
-#name='rvs db'
-#ver='0.6.3'
-logver='0.6.0'
-# Copyright (C) 2009 Luke Shumaker
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
-
-source "$RVSDIR/lib/stdio"
-
-# getid file
-getid() {
- #md5sum $file | sed "s/ .*$//"
- sha1sum $file | sed "s/ .*$//"
-}
-
-# loginit LOG
-loginit() {
- log="$1"
- echo "#!rvsdb $logver" > "$log";
-}
-
-# lograw LOG
-lograw() {
- log="$1"
- sed '1s/#!rvsdb .*//' "$log"
-}
-
-# _find LOG FIELD VAL
-_find() {
- log="$1"
- field="$2"
- val="$3"
- lograw $log | \
- cut -d : -f field | \
- sed -n "/^$val$/=" | \
- tr "\n" , | \
- sed 's/,$//'
-}
-
-# logread LOG VAR
-logread() {
- log="$1"
- var="$2"
- lograw "$log" | sed -n "s/^$var://p"
- #lograw "$log" | sed -n `_find "$log" '1' "$var"`p | cut -d : -f 2-
-}
-
-# logwrite LOG VAR VAL
-logwrite() {
- log="$1"
- var="$2"
- val="$3"
-
-# #lines=`_find "$log" '1' "$var"`
-# #if [ "$lines" = '' ]; then
-# if [ "`lograw "$log" | grep "^$var:"`" == '' ]; then
-# # no exiswhereting occurances
-# echo "$var:$val" >> "$log"
-# else
-# # found others
-# # escape slashes
-# var=`echo "$var" | sed 's:/:\\\\/:g'`
-# val=`echo "$val" | sed 's:/:\\\\/:g'`
-# sed -i "s/^$var:.*$/$var:$val/" "$log"
-# #lograw "$log" | ??????
-# fi
- echo "$var:$val" >> $log
-}
-
-# logfind LOG VAL
-logfind() {
- log="$1"
- val="$2"
- # make a comma-delimeted list of the lines with our values
- lines=`_find "$log" '2-' "$val"`
- lograw "$log" | sed -n ${lines}p | cut -d : -f 1
-}
-
diff --git a/src/rvs.sh b/src/rvs.sh
index a44570d..f47659f 100644
--- a/src/rvs.sh
+++ b/src/rvs.sh
@@ -1,8 +1,6 @@
#!$$SHELL$$
-# abomination module:rvs
name='rvs'
-ver='0.6.3'
-usage='COMMAND [OPTIONS]'
+ver='0.7.0'
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -11,9 +9,13 @@ usage='COMMAND [OPTIONS]'
#
# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
-export RVSDIR='$$libdir$$'
-source "$RVSDIR/lib/stdio"
-#source "$RVSDIR/lib/rvsdb"
+RVSDIR='$$libdir$$'
+REPO=`$RVSDIR/repo`
+
+error() {
+ echo "$name: $1" >> /dev/stderr
+ exit 1
+}
# START OPTION HANDLING #
com=$1;
@@ -22,8 +24,20 @@ case "$com" in
'') error 'no command specified';;
*)
if [ -f "$RVSDIR/$com" ]; then
+ export RVSDIR
$RVSDIR/$@
+ done='yes'
else
+ while read plugin; do
+ if [ -f "$RVSDIR/$plugin/$com" ]; then
+ export RVSDIR=$RVSDIR/$plugin
+ $RVSDIR/$@
+ done='yes'
+ break
+ fi
+ done < $REPO/plugins
+ fi
+ if [ "$done" != 'yes' ]; then
error "unrecognized command \`$com'"
fi
:;;