Permalink
Browse files

Added basic support for Growl notifications

Started repo:init functions

Repo init will eventually enable you to create a config file inside your repo with the URLs to your site to open from the command line
  • Loading branch information...
1 parent 3b2e88a commit f66aadc061a1739b34625b968086f4d0cfc6e6a1 @leonbarrett committed Mar 24, 2011
Showing with 33 additions and 10 deletions.
  1. +33 −10 beanstalk
  2. BIN beanstalk.png
View
@@ -33,10 +33,10 @@ class Beanstalk
'repo:info',
'repo:changes',
'repo:releases',
- 'account:config'
'account:config',
'web:dashboard',
'web:repos',
+ 'repo:init'
);
//List of allowed Beanstalk colours (for repos, release servers etc)
@@ -138,7 +138,6 @@ class Beanstalk
break;
case 'repo:create':
- //self::create_repo($args);
self::create_repo_wizard($args);
break;
@@ -180,23 +179,38 @@ class Beanstalk
self::fetch_releases($args);
break;
+ case 'repo:init':
+ self::_display_message('ERROR', 'Hold tight, coming soon!');
+ //self::init_repo();
+ break;
+
case 'account:config':
self::update_config();
break;
-
+
case 'web:dashboard':
self::open_url('');
break;
case 'web:repos':
self::open_url('repositories');
break;
+
}
return TRUE;
} // End of init
// ------------------------------------------------------------------------
+ function init_repo(){
+
+ $current_directory = getcwd();
+
+ fwrite(STDOUT, "Set up Beanstalk repo in: '".$current_directory."'? y/n ");
+ $dir_confirm = trim(fgets(STDIN));
+
+ }
+
function open_url($path){
$url = 'https://'.$this->beanstalk_account.'.beanstalkapp.com/'.$path;
@@ -205,6 +219,7 @@ class Beanstalk
}
+
function create_release($params,$mode){
self::_display_message('', '******************** DEPLOY REPO ********************');
@@ -327,28 +342,25 @@ class Beanstalk
case 'failed':
self::_display_message('', 'Deployment failed.');
+ self::_display_growl('Deployment Failed');
break;
case 'success':
self::_display_message('', 'Deployed successfully.');
+ self::_display_growl('Deployment Finished');
break;
case 'skipped':
self::_display_message('', 'Deployment skipped.');
+ self::_display_growl('Deployment Skipped');
break;
}
}
function update_config(){
- fwrite(STDOUT, 'Are you sure you wish to update your settings? y/n: ');
- $confirmation = strtolower(trim(fgets(STDIN)));
-
- if($confirmation == "n"){
- self::_display_message('', 'Update cancelled');
- exit();
- }
+ fwrite(STDOUT, 'Please enter your Beanstalk account details to continue?');
$config_file = $_SERVER['HOME'].DIRECTORY_SEPARATOR.'beanstalk_cli.config';
@@ -732,6 +744,7 @@ repo:deploy-all <repo_name> # Allows you to re-deploy all files to a reposit
$_message .= "\n";
fwrite(STDOUT, $_message);
+
unset($_label, $_message, $message);
if ($type == 'error' && $continue === FALSE)
@@ -740,6 +753,16 @@ repo:deploy-all <repo_name> # Allows you to re-deploy all files to a reposit
return;
} // End of _display_message
+ protected static function _display_growl($message='',$title='Beanstalk CLI'){
+
+ $image_path = $_SERVER['HOME'].DIRECTORY_SEPARATOR.'beanstalk'.DIRECTORY_SEPARATOR.'beanstalk.png';
+
+ exec("growlnotify --image '".$image_path."' --message '".$message."' --title '".$title."'");
+
+ exit();
+
+ }
+
public function display_errors($call){
if($call->error){
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f66aadc

Please sign in to comment.