Skip to content

Commit

Permalink
Merge pull request #134 from do3meli/refactor-composer
Browse files Browse the repository at this point in the history
Refactor composer
  • Loading branch information
do3meli committed Oct 14, 2015
2 parents ba86e31 + c801cd6 commit 3062bec
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 34 deletions.
16 changes: 5 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
# files that get generated by piLogger
etc/devices.scanned
etc/piLogger.conf
etc/aliases.conf
etc/*.conf
bin/.*.swp
html/cache
html/graphs
html/xml
html/index.html
include/composer.phar
include/composer.lock
include/vendor

# ignore AbioWire files
AbioWire
*.swp
# composer files
composer.lock
vendor

# ignore some OSX files when not working directly from my raspberry pi
# ignore temporary, hidden system files
*.swp
.DS_Store
.AppleDouble
.LSOverride
Expand Down
24 changes: 21 additions & 3 deletions bin/functions-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ function piLogger_doUpgrade_20150628-001_to_20150823-001(){

# now we can get composer and use php5-cli for it
echo " - Installing composer"
cd $baseDir/include
curl -s https://getcomposer.org/installer | php
./composer.phar install
cd $baseDir
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
composer install

# we will restart lighttpd just to be sure it picked up the correct config file
sudo dpkg -s lighttpd >/dev/null 2>&1 && { sudo /etc/init.d/lighttpd restart ; }
Expand Down Expand Up @@ -375,3 +375,21 @@ function piLogger_doUpgrade_20150920-002_to_20151020-001(){
return $?;
fi
}

#========================================
# from 20151020-001 to 20151014-001
#========================================
function piLogger_doUpgrade_20151020-001_to_20151014-001(){

echo " - moving composer files from previous installations if necessary"
[ -d $baseDir/include/vendor ] && mv $baseDir/include/vendor $baseDir/vendor
[ -f $baseDir/include/composer.lock ] && mv $baseDir/include/composer.lock $baseDir/composer.lock

echo " - check if composer files are at the correct place now"
if [ -d $baseDir/vendor ] && [ -f $baseDir/composer.lock ]; then
return 0;
else
return -1;
fi

}
3 changes: 2 additions & 1 deletion bin/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ versions="20150422-001
20150918-001
20150920-001
20150920-002
20151020-001"
20151020-001
20151014-001"

fromVersion=""
for toVersion in $versions
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion currentVersion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20151002-001
20151014-001
12 changes: 1 addition & 11 deletions html/api/rest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
<?php
#--- go to xyz/includes (which has composer.phar and composer.json)
#--- run ./composer.phar install
#
#--- the .htaccess file in the ./api directory can look like this:
#
#--- maglub@ubuntu-14:~/dev/web/public_html/api$ cat .htaccess
#--- RewriteEngine on
#--- RewriteCond %{REQUEST_FILENAME} !-f
#--- RewriteRule ^ /api/rest.php [QSA,L]

//set up environment for cli
if (!(isset($_SERVER['DOCUMENT_ROOT']) && $_SERVER['DOCUMENT_ROOT'] !== "")) {
Expand All @@ -24,8 +15,7 @@
if(isset($ENV['debug'])) { print "apa\n"; };

require_once($_SERVER['DOCUMENT_ROOT']."/stub.php");
require_once($root."/vendor/autoload.php");

require_once($root."/../vendor/autoload.php");
require_once($root . "myfunctions.inc");

#--- instantiate Slim and SlimJson
Expand Down
6 changes: 2 additions & 4 deletions html/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require_once("./stub.php");
require_once($root . "myfunctions.inc");
require_once($root."/../vendor/autoload.php");

//set up environment for cli
if (!(isset($_SERVER['DOCUMENT_ROOT']) && $_SERVER['DOCUMENT_ROOT'] !== "")) {
Expand All @@ -10,16 +11,13 @@
$_SERVER['DOCUMENT_ROOT'] = __DIR__ . "/..";
$argv = $GLOBALS['argv'];
array_shift($GLOBALS['argv']);
#$pathInfo = implode('/', $argv);
$pathInfo = $argv[0];
}

require_once($root."/vendor/autoload.php");

#--- instantiate Slim and SlimJson
$app = new \Slim\Slim(array(
'templates.path' => 'templates')
);
);

//if run from the command-line
if ($_SERVER['HTTP_HOST'] === "cron"){
Expand Down
6 changes: 3 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ $this_dir/bin/upgrade.sh --doIt
#================================
# Run composer
#================================
cd $this_dir/include
curl -s https://getcomposer.org/installer | php
./composer.phar install
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
cd $this_dir
composer install
cd -

#================================
Expand Down

0 comments on commit 3062bec

Please sign in to comment.