fix examples and move into a dir of their own
This commit is contained in:
parent
1ee076aac6
commit
6123f69996
@ -4,9 +4,9 @@
|
||||
//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('bootstrap.php');
|
||||
require(__DIR__.'/../bootstrap.php');
|
||||
|
||||
$config=require('config.php');
|
||||
$config=require(__DIR__.'/../config.php');
|
||||
|
||||
//pass cmd line args
|
||||
if($argc<3){
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
require('bootstrap.php');
|
||||
require(__DIR__.'/../bootstrap.php');
|
||||
|
||||
$config=require("config.php");
|
||||
$config=require(__DIR__.'/../config.php');
|
||||
|
||||
//pass cmd line args
|
||||
if($argc<3){
|
28
example/test.php
Normal file
28
example/test.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
require(__DIR__.'/../bootstrap.php');
|
||||
|
||||
$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]);
|
||||
|
||||
//create a label
|
||||
if(!$label=$repo->getLabelByName('Test')){
|
||||
$label=$repo->createLabel(['name'=>'Test','color'=>'#336699']);
|
||||
}
|
||||
|
||||
//create a test issue
|
||||
$issue=$repo->createIssue([
|
||||
'title'=>'Test',
|
||||
'body'=>'Just testing'
|
||||
]);
|
||||
$issue->addLabel($label);
|
||||
$issue->addComment('Test comment');
|
||||
$issue->save();
|
48
import.php
48
import.php
@ -1,48 +0,0 @@
|
||||
<?php
|
||||
require('bootstrap.php');
|
||||
|
||||
$config=require("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]);
|
||||
|
||||
function label($name){
|
||||
if($label=$repo->getLabelByName($name)){
|
||||
return $label;
|
||||
}else{
|
||||
return $repo->createLabel($name);
|
||||
}
|
||||
}
|
||||
|
||||
function issue($name){
|
||||
if($label=$repo->getIssueByName($name)){
|
||||
return $issue;
|
||||
}else{
|
||||
return $repo->createIssue($name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
$jan=label('janurary/repeat');
|
||||
$iss=issue('test');
|
||||
$iss->addLabel($jan);
|
||||
*/
|
||||
|
||||
/*
|
||||
//do the import
|
||||
$f=fopen('import.csv','r');
|
||||
while($data=fgetcsv($f)){
|
||||
print_r($data);
|
||||
}
|
||||
*/
|
||||
|
||||
$issue=new Issue($repo);
|
||||
$issue->setTitle('nice')->setBody('ly')->save();
|
||||
print_r($issue);
|
Loading…
Reference in New Issue
Block a user