diff --git a/composer.json b/composer.json index 0d6b98a..07d086e 100644 --- a/composer.json +++ b/composer.json @@ -1,14 +1,14 @@ { - "name": "acme/bot", - "description": "my bot!", + "name": "jhodges/giteabot-examples", + "description": "Some examples for the giteabot php api", "authors": [ { - "name": "Me", - "email": "me@example.com" + "name": "James", + "email": "inbox.dev@jhodges.co.uk" } ], "require": { - "jh/giteabot": "dev-composer" + "jhodges/giteabot": "dev-develop" }, "repositories": { "repo-name": { diff --git a/composer.lock b/composer.lock index 222d622..0a84983 100644 --- a/composer.lock +++ b/composer.lock @@ -4,19 +4,24 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e4333e0eb4df20a9093b9e14e4ac3536", + "content-hash": "b3bb2bfb9afd1fce021dcecb79442c77", "packages": [ { - "name": "jh/giteabot", - "version": "dev-composer", + "name": "jhodges/giteabot", + "version": "dev-develop", "source": { "type": "git", "url": "https://git.jhodges.co.uk/james/GiteaBot", - "reference": "d6ca95922617f25903dda431d9ed695c7a270ae4" + "reference": "d5c65bcb7e84d09ecdb6f6c084c4438104231099" }, "type": "library", + "autoload": { + "psr-4": { + "JHodges\\GiteaBot\\": "src/" + } + }, "license": [ - "OS" + "GPL3" ], "authors": [ { @@ -25,14 +30,14 @@ } ], "description": "Simple PHP library to interface with Gitea API", - "time": "2019-08-24T13:52:48+00:00" + "time": "2019-08-26T08:51:06+00:00" } ], "packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": { - "jh/giteabot": 20 + "jhodges/giteabot": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/src/close_all.php b/src/close_all.php index 33b6cd3..3a45139 100644 --- a/src/close_all.php +++ b/src/close_all.php @@ -1,17 +1,7 @@ [debug]\n"); -} -$debug = ($argc==4 && $argv[3]=='debug'); - -//open connection and repo -$client=new Client($config['url'],$config['user'],$config['pass'],$debug); -$repo=$client->getRepo($argv[1],$argv[2]); +// load the config, create the connection and load the repo sepcified on the cmd line args +// we will then have $client and $repo available +require('setup.php'); //close all issues $repo->forIssues(function($issue){ diff --git a/src/no_label_milestone.php b/src/no_label_milestone.php index 4113927..e879ca0 100644 --- a/src/no_label_milestone.php +++ b/src/no_label_milestone.php @@ -1,22 +1,14 @@ [debug]\n"); -} -$debug = ($argc==4 && $argv[3]=='debug'); - -//open connection and repo -$client=new Client($config['url'],$config['user'],$config['pass'],$debug); -$repo=$client->getRepo($argv[1],$argv[2]); +// load the config, create the connection and load the repo sepcified on the cmd line args +// we will then have $client and $repo available +require('setup.php'); //get the labels of interest $nolabelLabel=$repo->getLabelByName('no-label'); diff --git a/src/repeat.php b/src/repeat.php index d924a0a..2ce6375 100644 --- a/src/repeat.php +++ b/src/repeat.php @@ -1,18 +1,9 @@ [debug]\n"); -} -$debug = ($argc==4 && $argv[3]=='debug'); - -//open connection and repo -$client=new Client($config['url'],$config['user'],$config['pass'],$debug); -$repo=$client->getRepo($argv[1],$argv[2]); +// load the config, create the connection and load the repo sepcified on the cmd line args +// we will then have $client and $repo available +require('setup.php'); +//define the repeat terms $terms=[ 'months'=>['janurary','feburary','march','april','may','june','july','august','september','october','november','december'], 'days'=>['monday','tuesday','wednesday','thursday','friday','saturday','sunday'], diff --git a/src/setup.php b/src/setup.php new file mode 100644 index 0000000..bd77de3 --- /dev/null +++ b/src/setup.php @@ -0,0 +1,17 @@ + [debug]\n"); +} +$debug = ($argc==4 && $argv[3]=='debug'); + +//open connection and repo +$client=new Client($config['url'],$config['user'],$config['pass'],$debug); +$repo=$client->getRepo($argv[1],$argv[2]); + diff --git a/src/test.csv b/src/test.csv deleted file mode 100644 index 4ea922e..0000000 --- a/src/test.csv +++ /dev/null @@ -1 +0,0 @@ -"example title","example body","test" diff --git a/src/test.php b/src/test.php index 917d057..369dcb8 100644 --- a/src/test.php +++ b/src/test.php @@ -1,17 +1,7 @@ [debug]\n"); -} -$debug = ($argc==4 && $argv[3]=='debug'); - -//open connection and repo -$client=new Client($config['url'],$config['user'],$config['pass'],$debug); -$repo=$client->getRepo($argv[1],$argv[2]); +// load the config, create the connection and load the repo sepcified on the cmd line args +// we will then have $client and $repo available +require('setup.php'); //get the test label or create if not exist if(!$label=$repo->getLabelByName('Test')){