Skip to content

Commit

Permalink
restart services, open in term/iterm
Browse files Browse the repository at this point in the history
  • Loading branch information
vmitchell85 committed Mar 28, 2017
1 parent 8748f35 commit 7d86086
Show file tree
Hide file tree
Showing 7 changed files with 852 additions and 102 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Latest stable version is tagged with a release and uploaded to [Packal.org](http
- `forge open {site or server}` OR `fo {site or server}` : Opens the specified server or site's Forge page in your browser
- `forge deploy {site}` : Deploys the site specified (must confirm)
- `forge reboot {server}` : Reboots the specified server (must confirm)
- `forge mysql {server}` : Restarts MySQL on the specified server (must confirm)
- `forge postgres {server}` : Restarts Postgres on the specified server (must confirm)
- `forge nginx {server}` : Restarts Nginx on the specified server (must confirm)
- `forge term {server}` : Opens SSH connection in Terminal to the specified server
- `forge iterm {server}` : Opens SSH connection in iTerm to the specified server
- `forge reload` : Fetches new data from Forge API
- `forge clear` : Deletes your API Key and Forge Data

Expand Down
Binary file modified alForge.alfredworkflow
Binary file not shown.
28 changes: 28 additions & 0 deletions src/alforge/Mysql.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace AlForge;

use AlForge\Forge;
use Alfred\Workflows\Workflow;

class Mysql extends Forge
{
public function search($query)
{
echo $this->serverSearch($query);
}

public function execute($server_id)
{
$server = $this->getServerInfo($server_id);

if($this->confirm("Are you sure you want to restart MYSQL on `$server->name`?")){
$response = $this->apiRequest("https://forge.laravel.com/api/v1/servers/$server->id/mysql/reboot");
$this->respond(
"Command sent to Forge",
["push_title" => "Restarting MYSQL on `$server->name`"]
);
}

}
}
28 changes: 28 additions & 0 deletions src/alforge/Nginx.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace AlForge;

use AlForge\Forge;
use Alfred\Workflows\Workflow;

class Nginx extends Forge
{
public function search($query)
{
echo $this->serverSearch($query);
}

public function execute($server_id)
{
$server = $this->getServerInfo($server_id);

if($this->confirm("Are you sure you want to restart Nginx on `$server->name`?")){
$response = $this->apiRequest("https://forge.laravel.com/api/v1/servers/$server->id/nginx/reboot");
$this->respond(
"Command sent to Forge",
["push_title" => "Restarting Nginx on `$server->name`"]
);
}

}
}
28 changes: 28 additions & 0 deletions src/alforge/Postgres.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace AlForge;

use AlForge\Forge;
use Alfred\Workflows\Workflow;

class Postgres extends Forge
{
public function search($query)
{
echo $this->serverSearch($query);
}

public function execute($server_id)
{
$server = $this->getServerInfo($server_id);

if($this->confirm("Are you sure you want to restart Postgres on `$server->name`?")){
$response = $this->apiRequest("https://forge.laravel.com/api/v1/servers/$server->id/postgres/reboot");
$this->respond(
"Command sent to Forge",
["push_title" => "Restarting Postgres on `$server->name`"]
);
}

}
}
26 changes: 26 additions & 0 deletions src/alforge/Term.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace AlForge;

use AlForge\Forge;
use Alfred\Workflows\Workflow;

class Term extends Forge
{
public function search($query)
{
echo $this->serverSearch($query);
}

public function execute($server_id)
{
$server = $this->getServerInfo($server_id);

echo $server->ip_address;

// $query = "ssh forge@$server->ip_address";

// exec("osascript -e 'tell application \"Terminal\" to do script \"$query\"'");
// exec("osascript -e 'activate application \"Terminal\"'");
}
}
Loading

0 comments on commit 7d86086

Please sign in to comment.