refactor for the new lib structure
This commit is contained in:
parent
41ff24e0ab
commit
e54c149df4
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "acme/bot",
|
"name": "jhodges/giteabot-examples",
|
||||||
"description": "my bot!",
|
"description": "Some examples for the giteabot php api",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Me",
|
"name": "James",
|
||||||
"email": "me@example.com"
|
"email": "inbox.dev@jhodges.co.uk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"jh/giteabot": "dev-composer"
|
"jhodges/giteabot": "dev-develop"
|
||||||
},
|
},
|
||||||
"repositories": {
|
"repositories": {
|
||||||
"repo-name": {
|
"repo-name": {
|
||||||
|
19
composer.lock
generated
19
composer.lock
generated
@ -4,19 +4,24 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "e4333e0eb4df20a9093b9e14e4ac3536",
|
"content-hash": "b3bb2bfb9afd1fce021dcecb79442c77",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "jh/giteabot",
|
"name": "jhodges/giteabot",
|
||||||
"version": "dev-composer",
|
"version": "dev-develop",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.jhodges.co.uk/james/GiteaBot",
|
"url": "https://git.jhodges.co.uk/james/GiteaBot",
|
||||||
"reference": "d6ca95922617f25903dda431d9ed695c7a270ae4"
|
"reference": "d5c65bcb7e84d09ecdb6f6c084c4438104231099"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"JHodges\\GiteaBot\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
"license": [
|
"license": [
|
||||||
"OS"
|
"GPL3"
|
||||||
],
|
],
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
@ -25,14 +30,14 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Simple PHP library to interface with Gitea API",
|
"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": [],
|
"packages-dev": [],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": {
|
"stability-flags": {
|
||||||
"jh/giteabot": 20
|
"jhodges/giteabot": 20
|
||||||
},
|
},
|
||||||
"prefer-stable": false,
|
"prefer-stable": false,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
|
@ -1,17 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require(__DIR__.'/../vendor/autoload.php');
|
// load the config, create the connection and load the repo sepcified on the cmd line args
|
||||||
|
// we will then have $client and $repo available
|
||||||
$config=require(__DIR__.'/config.php');
|
require('setup.php');
|
||||||
|
|
||||||
//pass cmd line args
|
|
||||||
if($argc<3){
|
|
||||||
die(basename(__FILE__)." <USER> <REPO> [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]);
|
|
||||||
|
|
||||||
//close all issues
|
//close all issues
|
||||||
$repo->forIssues(function($issue){
|
$repo->forIssues(function($issue){
|
||||||
|
@ -1,22 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
//1a. Adds a no-milestone label to any issues with no milestone
|
/*****
|
||||||
//1b. Also removes the label if present on an issue with a milestone
|
** 1a. Adds a no-milestone label to any issues with no milestone
|
||||||
//2a. Adds a no-label label to any issues with no labels (excluding the no-label and no-milestone)
|
** 1b. Also removes the label if present on an issue with a milestone
|
||||||
//2b. Also removes the label if present on an issue with a label (excluding the no-label and no-milestone)
|
** 2a. Adds a no-label label to any issues with no labels (excluding the no-label and no-milestone)
|
||||||
|
** 2b. Also removes the label if present on an issue with a label (excluding the no-label and no-milestone)
|
||||||
|
******/
|
||||||
|
|
||||||
require(__DIR__.'/../vendor/autoload.php');
|
// load the config, create the connection and load the repo sepcified on the cmd line args
|
||||||
|
// we will then have $client and $repo available
|
||||||
$config=require(__DIR__.'/config.php');
|
require('setup.php');
|
||||||
|
|
||||||
//pass cmd line args
|
|
||||||
if($argc<3){
|
|
||||||
die(basename(__FILE__)." <USER> <REPO> [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]);
|
|
||||||
|
|
||||||
//get the labels of interest
|
//get the labels of interest
|
||||||
$nolabelLabel=$repo->getLabelByName('no-label');
|
$nolabelLabel=$repo->getLabelByName('no-label');
|
||||||
|
@ -1,18 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
require(__DIR__.'/../vendor/autoload.php');
|
// load the config, create the connection and load the repo sepcified on the cmd line args
|
||||||
|
// we will then have $client and $repo available
|
||||||
$config=require(__DIR__.'/config.php');
|
require('setup.php');
|
||||||
|
|
||||||
//pass cmd line args
|
|
||||||
if($argc<3){
|
|
||||||
die(basename(__FILE__)." <USER> <REPO> [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]);
|
|
||||||
|
|
||||||
|
//define the repeat terms
|
||||||
$terms=[
|
$terms=[
|
||||||
'months'=>['janurary','feburary','march','april','may','june','july','august','september','october','november','december'],
|
'months'=>['janurary','feburary','march','april','may','june','july','august','september','october','november','december'],
|
||||||
'days'=>['monday','tuesday','wednesday','thursday','friday','saturday','sunday'],
|
'days'=>['monday','tuesday','wednesday','thursday','friday','saturday','sunday'],
|
||||||
|
17
src/setup.php
Normal file
17
src/setup.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
require(__DIR__.'/../vendor/autoload.php');
|
||||||
|
|
||||||
|
use JHodges\GiteaBot\Client;
|
||||||
|
|
||||||
|
$config=require(__DIR__.'/config.php');
|
||||||
|
|
||||||
|
//pass cmd line args
|
||||||
|
if($argc<3){
|
||||||
|
die(basename(__FILE__)." <USER> <REPO> [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]);
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
"example title","example body","test"
|
|
|
16
src/test.php
16
src/test.php
@ -1,17 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require(__DIR__.'/../vendor/autoload.php');
|
// load the config, create the connection and load the repo sepcified on the cmd line args
|
||||||
|
// we will then have $client and $repo available
|
||||||
$config=require(__DIR__.'/config.php');
|
require('setup.php');
|
||||||
|
|
||||||
//pass cmd line args
|
|
||||||
if($argc<3){
|
|
||||||
die(basename(__FILE__)." <USER> <REPO> [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]);
|
|
||||||
|
|
||||||
//get the test label or create if not exist
|
//get the test label or create if not exist
|
||||||
if(!$label=$repo->getLabelByName('Test')){
|
if(!$label=$repo->getLabelByName('Test')){
|
||||||
|
Loading…
Reference in New Issue
Block a user