1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00

Added fixmes & minor updates.

Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
Tony Tkáčik 2018-05-18 15:56:38 +02:00
parent b72149b69c
commit 6dafaf5b9d
5 changed files with 63 additions and 29 deletions

View file

@ -1,2 +1,3 @@
## Maven configuration ## Maven configuration
export MAVEN_OPTS='-Xms256m -XX:MaxPermSize=512m -Xmx1024m' export MAVEN_OPTS='-Xms256m -XX:MaxPermSize=512m -Xmx1024m'
export GOPATH='/home/tony/.go/'

View file

@ -1,36 +1,44 @@
#!/usr/bin/env nux-runner #!/usr/bin/env nuxr-nuxsh
## Portable *nix environment by tonydamage ## Portable *nix environment by tonydamage
## status:: ## status::
## Show status of nux-env installation ## Show status of nux-env installation
task.status() {
echo nux-env folder: $NUX_ENV_DIR @namespace task. {
pushd $NUX_ENV_DIR > /dev/null function :status {
git status echo nux-env folder: $NUX_ENV_DIR
popd > /dev/null pushd $NUX_ENV_DIR > /dev/null
} git status
popd > /dev/null
}
## update:: ## update::
## pulls latest nux-env from repository. ## pulls latest nux-env from repository.
task.update() { function :update {
pushd $NUX_ENV_DIR > /dev/null pushd $NUX_ENV_DIR > /dev/null
git stash git stash
git pull -r git pull -r
git stash pop git stash pop
popd > /dev/null popd > /dev/null
} }
## install:: ## install::
## Install nux-env recommended binaries if not present ## Install nux-env recommended binaries if not present
task.install() { function :install {
: :
} }
## fixmes::
## List all fixmes for nux-env
function :fixmes {
fgrep -n FIXME "$NUX_INC_DIR/..bin/"*
find "$NUX_INC_DIR" -iname "*.sh" | xargs fgrep -n FIXME
}
## help library:: <inc> ## help library:: <inc>
## Displays help for specified nuxs-env library. ## Displays help for specified nuxs-env library.
## ##
task.help.library() { function :help.library name {
local name="$1" nux.help.comment $NUX_INC_DIR/$name.inc.sh
nux.help.comment $NUX_INC_DIR/$name.inc.sh }
} }

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env nux-runner
type ffmpeg > /dev/null 2>&1 && FFMPEG_OR_LIBAV=ffmpeg type ffmpeg > /dev/null 2>&1 && FFMPEG_OR_LIBAV=ffmpeg
type avconv > /dev/null 2>&1 && FFMPEG_OR_LIBAV=avconv type avconv > /dev/null 2>&1 && FFMPEG_OR_LIBAV=avconv
@ -19,20 +19,44 @@ function task.nikon-mp4 {
} }
function task.downscale { function task.downscale {
TARGET=$1 local TARGET=$1; shift;
shift local SIZE=$1; shift
SIZE=2048 local i=0;
local count="$#";
mkdir -p $TARGET;
for image in "$@"; do for image in "$@"; do
let "i=i+1"
target_file=$TARGET/$(basename $image) target_file=$TARGET/$(basename $image)
echo "Downsampling image $image to $target_file" echo "Image: $i/$count Downsampling $image -> $target_file"
convert $image \ convert $image \
-filter Lanczos -sampling-factor 1x1 \ -filter Lanczos -sampling-factor 1x1 \
-resize "${SIZE}x${SIZE}>" \ -resize "${SIZE}x${SIZE}>" \
-quality 90 \ -quality 90 \
$target_file $target_file
done done
} }
TASK=$1
shift
task.$TASK "$@" ## to:: <jpg|png> <image...>
##
## Convert image to
##
function task.to {
target=$1;
shift;
if ! nux.check.function "media.to.$target" ; then
echo Target type "$target" is not supported.
return -1
fi
for file in "$@"; do
target_dir=$(dirname "$file");
target_file=$(basename "$file" | sed -re 's/\.[a-z0-9_]+$//g' -e "s/\$/.$target/g" );
target_full="$target_dir/$target_file";
media.to.$target "$file" "$target_full"
echo $file $target_file
done
}
function media.to.jpg {
convert "$1" -quality 90 -auto-orient "$2"
}

View file

@ -82,6 +82,7 @@ nux.dsl.exec() {
local language="$1"; local language="$1";
local file="$2"; local file="$2";
local cached="${3:-$file${NUDSL_CACHE_SUFFIX}}"; local cached="${3:-$file${NUDSL_CACHE_SUFFIX}}";
#FIXME: Add no-cache
if nux.dsl.plan "$language" "$file" "$cached"; then if nux.dsl.plan "$language" "$file" "$cached"; then
source "$cached"; source "$cached";
fi fi

View file

@ -11,7 +11,7 @@ nux.use nuxr/repl
nux.log debug "Running task: $TASK"; nux.log debug "Running task: $TASK";
task.$TASK "$@" # Runs task task.$TASK "$@" # Runs task
else else
echo "$NUX_SCRIPTNAME: Unrecognized task ''$TASK' not available." echo "$NUX_SCRIPTNAME: Unrecognized task '$TASK' not available."
echo "Try '$NUX_SCRIPTNAME help' for more information." echo "Try '$NUX_SCRIPTNAME help' for more information."
return -1 return -1
} }