Skip to content

Commit

Permalink
Updated scripts for new installer, bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
noccy80 committed Dec 30, 2016
1 parent 0ca4b12 commit 46fae62
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,4 @@ function demo($item) {
return call_user_func("_{$item[1]}", array_merge($defs,$attr));


}
}
11 changes: 7 additions & 4 deletions lib/vartype.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ class VarType

public static function bindType($type, callable $valid, callable $caster)
{
$cn = ucwords($type)."Var";
$def = "class {$cn} extends VarType {".
"function __construct(\$def=null,\$conf=null) { ".
"parent::__construct(".var_export($type,true).",\$def,\$conf);".
"}}";

eval($def);
self::$TYPES[$type] = [ $valid, $caster ];
}

Expand Down Expand Up @@ -69,10 +76,6 @@ public function getDefault()
return $this->def;
}

public function getNullable()
{
return $this->nullable;
}
}

VarType::bindType("int", "is_numeric", "intval");
Expand Down
5 changes: 5 additions & 0 deletions share/INSTALLER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Welcome to the new PHPL Installer!

This installer will install or upgrade PHPL including modules and themes. If there are local changes to any of the themes, they should not be overwritten. It is still recommended that you copy the theme file when editing, and then edit the copy.

You will be prompted to configure your shell automatically. Currently bash and fish can be configured.
9 changes: 9 additions & 0 deletions share/powerline.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@


function _updateprompt {
export LAST=$?
export BASH_CWD="$(pwd)"
export PS1="$(phpl-generate -s $LAST -d $BASH_CWD) "
}

export PROMPT_COMMAND="_updateprompt"
File renamed without changes.
21 changes: 21 additions & 0 deletions share/setup-bash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

OPERATION="$1"
DESTINATION="$2"

case "$1" in
"install")
echo "Copying powerline.sh to $DESTINATION"
test -e "${DESTINATION}/powerline.sh" || cp "powerline.bash" "${DESTINATION}/powerline.sh"
# Install into ~/.bashrc if not present
grep "powerline.sh" ~/.bashrc &>/dev/null
if [ $? != 0 ]; then
echo "source ${DESTINATION}/powerline.sh" >> ~/.bashrc
echo "Added phpl to .bashrc"
else
echo "phpl appears to already be added to your .bashrc"
fi
;;
*)
# Do nothing for anything else for now, uninstalling
esac
25 changes: 25 additions & 0 deletions share/setup-fish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

OPERATION="$1"
DESTINATION="$2"

_FISH_FUNCS="${HOME}/.config/fish/functions"
_FISH_PROMPT="${_FISH_FUNCS}/fish_prompt.fish"
_TEMPLATE="./powerline.fish"

case "$1" in
"install")
if [ -f "${_FISH_PROMPT}" ]; then
mv "${_FISH_PROMPT}" "${_FISH_PROMPT}.old"
fi
echo "Installing into ${_FISH_PROMPT}"
cp "${_TEMPLATE}" "${_FISH_PROMPT}"
;;
"uninstall")
echo "Removing ${_FISH_PROMPT}"
if [ -f "${_FISH_PROMPT}" ]; then
mv "${_FISH_PROMPT}" "~/fish_prompt.old"
fi
;;
esac

0 comments on commit 46fae62

Please sign in to comment.