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
|
|
|
use Symfony\Component\Console\Formatter\OutputFormatterStyle; |
25
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
26
|
|
|
|
27
|
|
|
class Container extends \ConsoleHelpers\ConsoleKit\Container |
28
|
|
|
{ |
29
|
|
|
|
30
|
|
|
/** |
|
|
|
|
31
|
|
|
* {@inheritdoc} |
|
|
|
|
32
|
|
|
*/ |
33
|
19 |
|
public function __construct(array $values = array()) |
34
|
19 |
|
{ |
35
|
19 |
|
parent::__construct($values); |
36
|
|
|
|
37
|
19 |
|
$this['app_name'] = 'SVN-Buddy'; |
38
|
19 |
|
$this['app_version'] = '@git-version@'; |
39
|
|
|
|
40
|
19 |
|
$this['working_directory_sub_folder'] = '.svn-buddy'; |
41
|
|
|
|
42
|
19 |
|
$this['config_defaults'] = array( |
43
|
19 |
|
'repository-connector.username' => '', |
44
|
19 |
|
'repository-connector.password' => '', |
45
|
19 |
|
'repository-connector.last-revision-cache-duration' => '10 minutes', |
46
|
|
|
); |
47
|
|
|
|
48
|
|
|
$this->extend('output', function ($output, $c) { |
|
|
|
|
49
|
|
|
/** @var OutputInterface $output */ |
50
|
19 |
|
$output->getFormatter()->setStyle('debug', new OutputFormatterStyle('white', 'magenta')); |
51
|
|
|
|
52
|
5 |
|
return $output; |
53
|
19 |
|
}); |
54
|
|
|
|
55
|
|
|
$this['process_factory'] = function () { |
56
|
3 |
|
return new ProcessFactory(); |
57
|
|
|
}; |
58
|
|
|
|
59
|
|
|
$this['merge_source_detector'] = function () { |
60
|
1 |
|
$merge_source_detector = new MergeSourceDetectorAggregator(0); |
61
|
1 |
|
$merge_source_detector->add(new ClassicMergeSourceDetector(0)); |
62
|
1 |
|
$merge_source_detector->add(new InPortalMergeSourceDetector(50)); |
63
|
|
|
|
64
|
1 |
|
return $merge_source_detector; |
65
|
|
|
}; |
66
|
|
|
|
67
|
|
|
$this['repository_url_resolver'] = function ($c) { |
68
|
|
|
return new UrlResolver($c['repository_connector']); |
69
|
|
|
}; |
70
|
|
|
|
71
|
|
|
$this['cache_manager'] = function ($c) { |
72
|
3 |
|
return new CacheManager($c['working_directory'], $c['io']); |
73
|
|
|
}; |
74
|
|
|
|
75
|
|
|
$this['revision_log_factory'] = function ($c) { |
76
|
1 |
|
return new RevisionLogFactory($c['repository_connector'], $c['cache_manager']); |
77
|
|
|
}; |
78
|
|
|
|
79
|
|
|
$this['revision_list_parser'] = function () { |
80
|
1 |
|
return new RevisionListParser(); |
81
|
|
|
}; |
82
|
|
|
|
83
|
|
|
$this['repository_connector'] = function ($c) { |
84
|
2 |
|
return new Connector($c['config_editor'], $c['process_factory'], $c['io'], $c['cache_manager']); |
85
|
|
|
}; |
86
|
|
|
|
87
|
|
|
$this['date_helper'] = function () { |
88
|
1 |
|
return new DateHelper(); |
89
|
|
|
}; |
90
|
|
|
|
91
|
1 |
|
$this['editor'] = function () { |
92
|
1 |
|
return new InteractiveEditor(); |
93
|
|
|
}; |
94
|
19 |
|
} |
95
|
|
|
|
96
|
|
|
} |
97
|
|
|
|