forked from pocketarc/git-deploy-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject.php
More file actions
61 lines (50 loc) · 1.28 KB
/
Project.php
File metadata and controls
61 lines (50 loc) · 1.28 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
<?php
namespace RudraX;
include_once ("Util.php");
class Project {
public static function setup() {
self::copyRobo ();
self::updateGitIgnore ();
}
public static function checkStructure(){
}
public static function copyRobo() {
if (file_exists ( "lib/codegyre/robo/robo" )) {
copy("lib/rudrax/application/robo.php","robo");
chmod("robo", 0777);
return true;
} else {
Util::error ( "Composer package codegyre/robo does not exits, make sure it does" );
return false;
}
}
public static function updateGitIgnore() {
Util::log ( "Updating .gitignore file" );
$handle = @fopen ( ".gitignore", "a" );
fclose ( $handle );
$handle = @fopen ( ".gitignore", "r+" );
if ($handle) {
$entries = array (
"robo","build" ,"lib"
);
$entriesOk = array ();
while ( ($buffer = fgets ( $handle, 1024 )) !== false ) {
foreach ( $entries as $entry ) {
if (strpos ( $buffer, "robo" ) !== false) {
$entriesOk [$entry] = true;
}
}
}
foreach ( $entries as $entry ) {
if (!isset ( $entriesOk [$entry] )) {
Util::log ( "New Entry ::" . $entry );
fwrite ( $handle, "\n".$entry);
}
}
if (! feof ( $handle )) {
Util::error ( "Error: unexpected fgets() fail" );
}
fclose ( $handle );
}
}
}