Skip to content

Commit bfa27cf

Browse files
committed
Merge pull request #3 from jacobi007/jk-enable-include-paths
Add support for include_paths config
2 parents 06045c9 + 873c1f4 commit bfa27cf

File tree

2 files changed

+39
-13
lines changed

2 files changed

+39
-13
lines changed

Runner.php

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,47 @@ public function __construct($config, $server)
2020

2121
public function queueDirectory($dir, $prefix = '')
2222
{
23+
if(isset($this->config['include_paths'])) {
24+
$this->queueWithIncludePaths();
25+
} else {
26+
$this->queuePaths($dir, $prefix, $this->config['exclude_paths']);
27+
}
28+
29+
$this->server->process_work(false);
30+
}
31+
32+
public function queueWithIncludePaths() {
33+
foreach ($this->config['include_paths'] as $f) {
34+
if ($f !== '.' and $f !== '..') {
35+
36+
if (is_dir("/code$f")) {
37+
$this->queuePaths("/code$f", "$f/");
38+
continue;
39+
}
40+
41+
$this->server->addwork(array("/code/$f"));
42+
}
43+
}
44+
}
45+
46+
public function queuePaths($dir, $prefix = '', $exclusions = []) {
2347
$dir = rtrim($dir, '\\/');
2448

2549
foreach (scandir($dir) as $f) {
26-
if (in_array("$prefix$f", $this->config["exclude_paths"])) {
50+
if (in_array("$prefix$f", $exclusions)) {
2751
continue;
2852
}
2953

3054
if ($f !== '.' and $f !== '..') {
3155
if (is_dir("$dir/$f")) {
32-
$this->queueDirectory("$dir/$f", "$prefix$f/");
56+
$this->queuePaths("$dir/$f", "$prefix$f/", $exclusions);
3357
continue;
3458
}
3559

60+
$prefix = ltrim($prefix, "\\/");
3661
$this->server->addwork(array("/code/$prefix$f"));
3762
}
3863
}
39-
40-
$this->server->process_work(false);
4164
}
4265

4366
public function run($files)

circle.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@ machine:
33
- docker
44
environment:
55
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
6-
7-
dependencies:
8-
override:
9-
- echo $gcloud_json_key_base64 | sed 's/ //g' | base64 -d > /tmp/gcloud_key.json
10-
- curl https://sdk.cloud.google.com | bash
11-
- gcloud auth activate-service-account --key-file /tmp/gcloud_key.json
12-
- gcloud docker -a
6+
PRIVATE_REGISTRY: us.gcr.io/code_climate
137

148
test:
159
override:
16-
- docker build -t=$registry_root/$CIRCLE_PROJECT_REPONAME:b$CIRCLE_BUILD_NUM .
10+
- docker build -t=$PRIVATE_REGISTRY/$CIRCLE_PROJECT_REPONAME:b$CIRCLE_BUILD_NUM .
1711

1812
deployment:
1913
registry:
2014
branch: master
15+
owner: codeclimate
2116
commands:
22-
- docker push $registry_root/$CIRCLE_PROJECT_REPONAME:b$CIRCLE_BUILD_NUM
17+
- echo $GCLOUD_JSON_KEY_BASE64 | sed 's/ //g' | base64 -d > /tmp/gcloud_key.json
18+
- curl https://sdk.cloud.google.com | bash
19+
- gcloud auth activate-service-account $gcloud_account_email --key-file /tmp/gcloud_key.json
20+
- gcloud docker -a
21+
- docker push $PRIVATE_REGISTRY/$CIRCLE_PROJECT_REPONAME:b$CIRCLE_BUILD_NUM
22+
23+
notify:
24+
webhooks:
25+
- url: https://cc-slack-proxy.herokuapp.com/circle

0 commit comments

Comments
 (0)