|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the SVN-Buddy library. |
|
4
|
|
|
* For the full copyright and license information, please view |
|
5
|
|
|
* the LICENSE file that was distributed with this source code. |
|
6
|
|
|
* |
|
7
|
|
|
* @copyright Alexander Obuhovich <[email protected]> |
|
8
|
|
|
* @link https://github.com/console-helpers/svn-buddy |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace ConsoleHelpers\SVNBuddy; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
use ConsoleHelpers\SVNBuddy\Cache\CacheManager; |
|
15
|
|
|
use ConsoleHelpers\SVNBuddy\Helper\DateHelper; |
|
16
|
|
|
use ConsoleHelpers\SVNBuddy\MergeSourceDetector\ClassicMergeSourceDetector; |
|
17
|
|
|
use ConsoleHelpers\SVNBuddy\MergeSourceDetector\InPortalMergeSourceDetector; |
|
18
|
|
|
use ConsoleHelpers\SVNBuddy\MergeSourceDetector\MergeSourceDetectorAggregator; |
|
19
|
|
|
use ConsoleHelpers\SVNBuddy\Process\ProcessFactory; |
|
20
|
|
|
use ConsoleHelpers\SVNBuddy\Repository\Connector\Connector; |
|
21
|
|
|
use ConsoleHelpers\SVNBuddy\Repository\Connector\UrlResolver; |
|
22
|
|
|
use ConsoleHelpers\SVNBuddy\Repository\Parser\RevisionListParser; |
|
23
|
|
|
use ConsoleHelpers\SVNBuddy\Repository\RevisionLog\RevisionLogFactory; |
|
24
|
|
|
|
|
25
|
|
|
class Container extends \ConsoleHelpers\ConsoleKit\Container |
|
26
|
|
|
{ |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
|
|
|
|
|
29
|
|
|
* {@inheritdoc} |
|
|
|
|
|
|
30
|
|
|
*/ |
|
31
|
19 |
|
public function __construct(array $values = array()) |
|
32
|
|
|
{ |
|
33
|
19 |
|
parent::__construct($values); |
|
34
|
|
|
|
|
35
|
19 |
|
$this['app_name'] = 'SVN-Buddy'; |
|
36
|
19 |
|
$this['app_version'] = '@git-version@'; |
|
37
|
|
|
|
|
38
|
19 |
|
$this['working_directory_sub_folder'] = '.svn-buddy'; |
|
39
|
|
|
|
|
40
|
19 |
|
$this['config_defaults'] = array( |
|
41
|
19 |
|
'repository-connector.username' => '', |
|
42
|
19 |
|
'repository-connector.password' => '', |
|
43
|
19 |
|
'repository-connector.last-revision-cache-duration' => '10 minutes', |
|
44
|
|
|
); |
|
45
|
|
|
|
|
46
|
|
|
$this['process_factory'] = function () { |
|
47
|
3 |
|
return new ProcessFactory(); |
|
48
|
|
|
}; |
|
49
|
|
|
|
|
50
|
|
|
$this['merge_source_detector'] = function () { |
|
51
|
1 |
|
$merge_source_detector = new MergeSourceDetectorAggregator(0); |
|
52
|
1 |
|
$merge_source_detector->add(new ClassicMergeSourceDetector(0)); |
|
53
|
1 |
|
$merge_source_detector->add(new InPortalMergeSourceDetector(50)); |
|
54
|
|
|
|
|
55
|
1 |
|
return $merge_source_detector; |
|
56
|
|
|
}; |
|
57
|
|
|
|
|
58
|
|
|
$this['repository_url_resolver'] = function ($c) { |
|
59
|
|
|
return new UrlResolver($c['repository_connector']); |
|
60
|
|
|
}; |
|
61
|
|
|
|
|
62
|
|
|
$this['cache_manager'] = function ($c) { |
|
63
|
19 |
|
return new CacheManager($c['working_directory']); |
|
64
|
|
|
}; |
|
65
|
|
|
|
|
66
|
|
|
$this['revision_log_factory'] = function ($c) { |
|
67
|
19 |
|
return new RevisionLogFactory($c['repository_connector'], $c['cache_manager'], $c['io']); |
|
68
|
|
|
}; |
|
69
|
|
|
|
|
70
|
|
|
$this['revision_list_parser'] = function () { |
|
71
|
1 |
|
return new RevisionListParser(); |
|
72
|
|
|
}; |
|
73
|
|
|
|
|
74
|
|
|
$this['repository_connector'] = function ($c) { |
|
75
|
2 |
|
return new Connector($c['config_editor'], $c['process_factory'], $c['io'], $c['cache_manager']); |
|
76
|
|
|
}; |
|
77
|
|
|
|
|
78
|
|
|
$this['date_helper'] = function () { |
|
79
|
1 |
|
return new DateHelper(); |
|
80
|
|
|
}; |
|
81
|
|
|
|
|
82
|
1 |
|
$this['editor'] = function () { |
|
83
|
1 |
|
return new InteractiveEditor(); |
|
84
|
|
|
}; |
|
85
|
19 |
|
} |
|
86
|
|
|
|
|
87
|
|
|
} |
|
88
|
|
|
|