This repository was archived by the owner on Dec 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathace.php
More file actions
90 lines (70 loc) · 2.08 KB
/
ace.php
File metadata and controls
90 lines (70 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
namespace Millsoft\AceTool;
/**
* AceProject CLI
* (c) 2019 by Michael Milawski.
*/
$autoload_file = __DIR__ . "/vendor/autoload.php";
$autoload_file_global = __DIR__ . "/../../autoload.php";
if (file_exists($autoload_file_global)) {
//this script is installed in the composer installation
require_once $autoload_file_global;
} else {
if (!file_exists($autoload_file)) {
throw new Exception("Composer autoload not found.");
}
require_once $autoload_file;
}
use Millsoft\AceTool\Commands\CommentCommands;
use Millsoft\AceTool\Commands\AccountCommands;
use Millsoft\AceTool\Commands\ProjectCommands;
use Millsoft\AceTool\Commands\ClockCommands;
use Millsoft\AceTool\Commands\TaskCommands;
use Millsoft\AceTool\Commands\UserCommands;
use \Rollbar\Rollbar;
use \Rollbar\Payload\Level;
class Ace
{
/**
* Enable error logging by Rollbar.
*/
private static function initErrorLogging(){
Rollbar::init(
array(
'access_token' => '66edf28d2ae349599b3f24d99c08467e',
'environment' => 'production'
)
);
}
/**
* Initialize the whole CLI system
*/
public static function init ()
{
self::initErrorLogging();
Helper::initSession();
$versionFile = __DIR__ . "/version.txt";
if(file_exists($versionFile)){
$version = file_get_contents($versionFile);
}else{
$version = '???';
}
$header = <<<header
Version: $version
(c) 2019 by Michael Milawski
header;
//Initialize a new Console AceApp:
$console = new AceApp('AceProject CLI', $header);
//Load all the modules that should be available in the console:
//Modules are stored in src/commands directory.
AccountCommands::load($console);
ProjectCommands::load($console);
CommentCommands::load($console);
ClockCommands::load($console);
TaskCommands::load($console);
UserCommands::load($console);
//Run the app:
$console->run();
}
}
Ace::init();