This repository has been archived by the owner on May 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from yoctu/develop
Develop
- Loading branch information
Showing
23 changed files
with
367 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/bin/bash | ||
|
||
SELF="${BASH_SOURCE[0]##*/}" | ||
NAME="${SELF%.sh}" | ||
|
||
OPTS="svxEh" | ||
USAGE="Usage: $SELF [$OPTS]" | ||
|
||
HELP=" | ||
$USAGE | ||
Options: | ||
-s simulate | ||
-v set -v | ||
-x set -x | ||
-e set -ve | ||
-h Help | ||
" | ||
|
||
function _quit () | ||
{ | ||
local retCode="$1" msg="${@:2}" | ||
|
||
echo -e "$msg" | ||
exit $retCode | ||
} | ||
|
||
function _notify() | ||
{ | ||
echo -e "\n\n\n\n\n################################## $* #####################################\n\n\n\n\n" >&2 | ||
} | ||
|
||
while getopts "${OPTS}" arg; do | ||
case "${arg}" in | ||
s) _run="echo" ;; | ||
v) set -v ;; | ||
x) set -x ;; | ||
e) set -ve ;; | ||
h) _quit 0 "$HELP" ;; | ||
?) _quit 1 "Invalid Argument: $USAGE" ;; | ||
*) _quit 1 "$USAGE" ;; | ||
esac | ||
done | ||
shift $((OPTIND - 1)) | ||
|
||
fileuuid="bck8:49f0d248-f21d-4a14-871d-31b007189081" | ||
project="yoctapi" | ||
ppa_repo="public" | ||
|
||
trap '_quit 2 "An Error occured while running script"' ERR | ||
|
||
_notify "Install dependencies" | ||
sudo apt-get update >&/dev/null ; sudo apt-get install -y apt-transport-https devscripts debianutils jq gridsite-clients &>/dev/null | ||
wget -qO - https://ppa.yoctu.com/archive.key | sudo apt-key add - | ||
|
||
curl -s -o /tmp/jq -O -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 | ||
chmod +x /tmp/jq | ||
sudo mv /tmp/jq /usr/bin/jq | ||
|
||
echo "deb https://ppa.yoctu.com/ all unstable" | sudo tee /etc/apt/sources.list | ||
sudo apt-get update &>/dev/null | ||
cd /tmp | ||
|
||
sudo apt-get install yoctu-client-scripts &>/dev/null | ||
|
||
_notify "Finished installing dependencies" | ||
|
||
_notify "Fetch changelog" | ||
cd - | ||
|
||
filer-client.sh -U https://filer.test.flash.global -X get -u $fileuuid | ||
|
||
mv /tmp/${project}-changelog debian/changelog | ||
|
||
_notify "Fetched changelog" | ||
|
||
_notify "Setup Github" | ||
sudo -s curl -o /bin/git-to-deb.sh -O -L https://ppa.yoctu.com/git-to-deb.sh | ||
sudo chmod +x /bin/git-to-deb.sh | ||
|
||
git config --global user.email "[email protected]" | ||
git config --global user.name "git" | ||
_notify "Setup done" | ||
|
||
_notify "Build package" | ||
|
||
git-to-deb.sh -i >/dev/null | ||
|
||
filer-client.sh -U https://filer.test.flash.global -c MISCELLANEOUS -n "${project}-changelog" -f debian/changelog -C "need=Changelog file for $project" -m "text/plain" -X update -u $fileuuid | ||
_notify "Build done" | ||
|
||
_notify "Rsync to ppa" | ||
mv ../$project*.deb ../$project.deb | ||
export LC_FLASH_PROJECT_ID="$project" | ||
|
||
IFS='/' read nonused heads branch <<<$CPHP_GIT_REF | ||
[[ "$heads" == "tags" ]] && branch="$heads" | ||
export LC_FLASH_ARGS="project=$project ppa_repo=$ppa_repo git_branch=$branch flashGitRef=$CPHP_GIT_REF" | ||
export LC_FLASH_YAML="000-default-flash-debian-script.yaml" | ||
|
||
export LC_FLASH_BRANCH=$CPHP_GIT_REF && scp -P2222 -o StrictHostKeyChecking=no -i ~/.ssh/automate.key ../$project.deb [email protected]:/tmp/${LC_FLASH_PROJECT_ID}.deb | ||
_notify "Rsync done" | ||
|
||
rm -rf debian |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
application_name="yosh" | ||
application_name="yoctapi" | ||
html_dir="${DOCUMENT_ROOT%/}/../html" | ||
css_dir="${DOCUMENT_ROOT%/}/../css" | ||
js_dir="${DOCUMENT_ROOT%/}/../js" | ||
img_dir="${DOCUMENT_ROOT%/}/../img" | ||
fonts_dir="${DOCUMENT_ROOT%/}/../fonts" | ||
api_dir="${DOCUMENT_ROOT%/}../api" | ||
etc_conf_dir="/etc/$application_name/" | ||
login_method="auth::request" | ||
login_page="login" | ||
login_unauthorized="html::print::out ${html_dir}/login.html" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
declare -A LOGGING | ||
LOGGING['file':'method']="file" | ||
LOGGING['file':'tag']="log" | ||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[public:assoc] YOCTAPI | ||
|
||
# Read Credentials | ||
YOCTAPI['route':'MATCHER':'read':'credentials':'host']="localhost" | ||
YOCTAPI['route':'MATCHER':'read':'credentials':'user']="USER" | ||
YOCTAPI['route':'MATCHER':'read':'credentials':'password']="PASSWORD" | ||
YOCTAPI['route':'MATCHER':'read':'credentials':'database']="DATABASE" | ||
YOCTAPI['route':'MATCHER':'read':'connector']="mysql" | ||
|
||
# Write Credentials | ||
YOCTAPI['route':'MATCHER':'write':'credentials':'host']="localhost" | ||
YOCTAPI['route':'MATCHER':'write':'credentials':'user']="USER" | ||
YOCTAPI['route':'MATCHER':'write':'credentials':'password']="PASSWORD" | ||
YOCTAPI['route':'MATCHER':'write':'credentials':'database']="DATABASE" | ||
YOCTAPI['route':'MATCHER':'write':'connector']="mysql" | ||
|
||
# GET FILTERS | ||
YOCTAPI['route':'MATCHER':'request':'get':'filter']="FILER1,FITLER2" | ||
YOCTAPI['route':'MATCHER':'request':'get':'object']="OBJECT" | ||
YOCTAPI['route':'MATCHER':'request':'get':'search']="SEARCH" | ||
YOCTAPI['route':'MATCHER':'request':'get':'table']="TABLE" | ||
|
||
# POST FILTERS | ||
YOCTAPI['route':'MATCHER':'request':'post':'table']="TABLE" | ||
|
||
# PUT FILTERS | ||
YOCTAPI['route':'MATCHER':'request':'put':'search']="SEARCH" | ||
YOCTAPI['route':'MATCHER':'request':'put':'table']="TABLE" | ||
|
||
# DELETE FILTERS | ||
YOCTAPI['route':'MATCHER':'request':'delete':'search']="SEARCH" | ||
YOCTAPI['route':'MATCHER':'request':'delete':'table']="TABLE" | ||
|
||
YOCTAPI['route':'bertrand':'request':'delete':'search']="SEARCH" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Source: yoctapi | ||
Section: utils | ||
Maintainer: Dzove855 <[email protected]> | ||
Build-Depends: debhelper | ||
Standards-Version: 0.8.20 | ||
|
||
Package: yoctapi | ||
Architecture: all | ||
Maintainer: Dzogovic Vehbo <[email protected]> | ||
Priority: optional | ||
Depends: jq, yosh, libyosh-gateway | ||
Description: yoctapi (yoctu shell) - Micro Web Framework lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/make -f | ||
%: | ||
dh $@ | ||
|
||
override_dh_builddeb: | ||
dh_builddeb -- -Zgzip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
auth var/www/yoctapi/ | ||
bin var/www/yoctapi/ | ||
config var/www/yoctapi/ | ||
lib var/www/yoctapi/ | ||
public var/www/yoctapi/ | ||
README.md usr/share/yoctapi/doc/ | ||
dist/apache2/yoctapi.conf etc/apache2/sites-available/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<VirtualHost *:80> | ||
|
||
define documentroot /var/www/yoctapi/public | ||
|
||
DocumentRoot ${documentroot} | ||
|
||
<Directory ${documentroot}> | ||
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch | ||
AddHandler cgi-script .sh | ||
|
||
RewriteEngine On | ||
RewriteCond %{REQUEST_FILENAME} -s [OR] | ||
RewriteCond %{REQUEST_FILENAME} -l [OR] | ||
RewriteCond %{REQUEST_FILENAME} -d | ||
RewriteRule ^.*$ - [NC,L] | ||
RewriteRule ^.*$ /main.sh [NC,L] | ||
|
||
DirectoryIndex main.sh | ||
|
||
</Directory> | ||
|
||
undefine documentroot | ||
|
||
</VirtualHost> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.