-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhubdrop-set-source.php
executable file
·80 lines (80 loc) · 2.23 KB
/
hubdrop-set-source.php
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
#!/usr/bin/php
<?php
//
//// Hello World
//print "Welcome to hubdrop.\n";
//print "==================\n";
//
//$project = '';
//$source = '';
//$user = 'hubdrop';
//
//// Get Project from $argv 1
//if (empty($argv[1])){
// exit("You need to specify a Drupal.org project.\n");
//} else {
// $project = $argv[1];
//}
//
//// Get Source from $argv 2
//if (!empty($argv[2])){
//
// // Ensure its either drupal or github
// if ($argv[2] != 'drupal' && $argv[2] != 'github'){
// exit("You must specify either 'drupal' or 'github' as the source repo.\n");
// } else {
// $source = $argv[2];
//
// // Removing this requirement. hubdrop user makes much more sense.
// //// If it's drupal, we need a username:
// //if ($source == 'github') {
// // if (empty($argv[3])){
// // exit("If source is github, you must specify a drupal user with commit access to $project.\n");
// // } else {
// // $user = $argv[3];
// // }
// //}
// }
//} else {
// exit("You must specify either 'drupal' or 'github' as the source repo.\n");
//}
//
//$hubdrop_github_org = 'drupalprojects';
//
//$drupal_read_repo = "http://git.drupal.org/project/$project.git";
//$drupal_write_repo = "[email protected]:project/$project.git";
//$github_git_repo = "[email protected]:$hubdrop_github_org/$project.git";
//
//// @TODO: Un-hardcode this.
//$d = "/var/hubdrop/repos/$project.git";
//chdir($d);
//
//print $d . "\n";
//print "------------------\n";
//
//// @TODO: Test for access first!
//if ($source == 'github'){
// print "Setting GitHub Repo as the Source.\n";
// print "----------------------------------\n";
// print hexec("git remote set-url --push origin $drupal_write_repo");
// print hexec("git remote set-url origin $github_git_repo");
//}
//elseif ($source == 'drupal') {
// print "Setting Drupal Repo as the Source.\n";
// print "----------------------------------\n";
// print hexec("git remote set-url --push origin $github_git_repo");
// print hexec("git remote set-url origin $drupal_read_repo");
//}
//
///**
// * HubDrop Exec
// */
//function hexec($cmd){
// $output = '';
// $output .= "Running $cmd\n";
// $output .= "------------------\n";
//
// $lines = array();
// exec($cmd, $lines);
// return $output . implode("\n", $lines);
//}