-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
evilebottnawi
committed
Jan 6, 2018
1 parent
a7edf92
commit bff49cd
Showing
10 changed files
with
375 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
// Maximize error reporting | ||
error_reporting(E_ALL | E_STRICT); | ||
|
||
// TODO: if we could get rid of this and have composer figure things out it'd make it | ||
// a bit more sane | ||
require(dirname(__file__) . '/../lib/Raven/Autoloader.php'); | ||
Raven_Autoloader::register(); | ||
|
||
function raven_cli_test($command, $args) | ||
{ | ||
// Do something silly | ||
try { | ||
throw new Exception('This is a test exception sent from the Raven CLI.'); | ||
} catch (Exception $ex) { | ||
return $ex; | ||
} | ||
} | ||
|
||
function cmd_test($dsn) | ||
{ | ||
// Parse DSN as a test | ||
try { | ||
if (empty(Raven_Client::parseDSN($dsn))) { | ||
exit('ERROR: Missing DSN value'); | ||
} | ||
} catch (InvalidArgumentException $ex) { | ||
exit("ERROR: There was an error parsing your DSN:\n " . $ex->getMessage()); | ||
} | ||
|
||
$client = new Raven_Client($dsn, array( | ||
'trace' => true, | ||
'curl_method' => 'sync', | ||
'app_path' => realpath(__DIR__ . '/..'), | ||
'base_path' => realpath(__DIR__ . '/..'), | ||
)); | ||
|
||
$config = get_object_vars($client); | ||
$required_keys = array('server', 'project', 'public_key', 'secret_key'); | ||
|
||
echo "Client configuration:\n"; | ||
foreach ($required_keys as $key) { | ||
if (empty($config[$key])) { | ||
exit("ERROR: Missing configuration for $key"); | ||
} | ||
if (is_array($config[$key])) { | ||
echo "-> $key: [".implode(", ", $config[$key])."]\n"; | ||
} else { | ||
echo "-> $key: $config[$key]\n"; | ||
} | ||
|
||
} | ||
echo "\n"; | ||
|
||
echo "Sending a test event:\n"; | ||
|
||
$ex = raven_cli_test("command name", array("foo" => "bar")); | ||
$event_id = $client->captureException($ex); | ||
|
||
echo "-> event ID: $event_id\n"; | ||
|
||
$last_error = $client->getLastError(); | ||
if (!empty($last_error)) { | ||
exit("ERROR: There was an error sending the test event:\n " . $last_error); | ||
} | ||
|
||
echo "\n"; | ||
echo "Done!"; | ||
} | ||
|
||
|
||
function main() { | ||
global $argv; | ||
|
||
if (!isset($argv[1])) { | ||
exit('Usage: sentry test <dsn>'); | ||
} | ||
|
||
$cmd = $argv[1]; | ||
|
||
switch ($cmd) { | ||
case 'test': | ||
cmd_test(@$argv[2]); | ||
break; | ||
default: | ||
exit('Usage: sentry test <dsn>'); | ||
} | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
namespace Composer\Installers; | ||
|
||
/** | ||
* Plugin/theme installer for majima | ||
* @author David Neustadt | ||
*/ | ||
class MajimaInstaller extends BaseInstaller | ||
{ | ||
protected $locations = array( | ||
'plugin' => 'plugins/{$name}/', | ||
); | ||
|
||
/** | ||
* Transforms the names | ||
* @param array $vars | ||
* @return array | ||
*/ | ||
public function inflectPackageVars($vars) | ||
{ | ||
return $this->correctPluginName($vars); | ||
} | ||
|
||
/** | ||
* Change hyphenated names to camelcase | ||
* @param array $vars | ||
* @return array | ||
*/ | ||
private function correctPluginName($vars) | ||
{ | ||
$camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) { | ||
return strtoupper($matches[0][1]); | ||
}, $vars['name']); | ||
$vars['name'] = ucfirst($camelCasedName); | ||
return $vars; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
vendor/composer/installers/src/Composer/Installers/ModxInstaller.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
namespace Composer\Installers; | ||
|
||
/** | ||
* An installer to handle MODX specifics when installing packages. | ||
*/ | ||
class ModxInstaller extends BaseInstaller | ||
{ | ||
protected $locations = array( | ||
'extra' => 'core/packages/{$name}/' | ||
); | ||
} |
63 changes: 63 additions & 0 deletions
63
vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
namespace Composer\Installers; | ||
|
||
class PxcmsInstaller extends BaseInstaller | ||
{ | ||
protected $locations = array( | ||
'module' => 'app/Modules/{$name}/', | ||
'theme' => 'themes/{$name}/', | ||
); | ||
|
||
/** | ||
* Format package name. | ||
* | ||
* @param array $vars | ||
* | ||
* @return array | ||
*/ | ||
public function inflectPackageVars($vars) | ||
{ | ||
if ($vars['type'] === 'pxcms-module') { | ||
return $this->inflectModuleVars($vars); | ||
} | ||
|
||
if ($vars['type'] === 'pxcms-theme') { | ||
return $this->inflectThemeVars($vars); | ||
} | ||
|
||
return $vars; | ||
} | ||
|
||
/** | ||
* For package type pxcms-module, cut off a trailing '-plugin' if present. | ||
* | ||
* return string | ||
*/ | ||
protected function inflectModuleVars($vars) | ||
{ | ||
$vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy) | ||
$vars['name'] = str_replace('module-', '', $vars['name']); // strip out module- | ||
$vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module | ||
$vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s | ||
$vars['name'] = ucwords($vars['name']); // make module name camelcased | ||
|
||
return $vars; | ||
} | ||
|
||
|
||
/** | ||
* For package type pxcms-module, cut off a trailing '-plugin' if present. | ||
* | ||
* return string | ||
*/ | ||
protected function inflectThemeVars($vars) | ||
{ | ||
$vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy) | ||
$vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme- | ||
$vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme | ||
$vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s | ||
$vars['name'] = ucwords($vars['name']); // make module name camelcased | ||
|
||
return $vars; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Composer\Installers; | ||
|
||
class SiteDirectInstaller extends BaseInstaller | ||
{ | ||
protected $locations = array( | ||
'module' => 'modules/{$vendor}/{$name}/', | ||
'plugin' => 'plugins/{$vendor}/{$name}/' | ||
); | ||
|
||
public function inflectPackageVars($vars) | ||
{ | ||
return $this->parseVars($vars); | ||
} | ||
|
||
protected function parseVars($vars) | ||
{ | ||
$vars['vendor'] = strtolower($vars['vendor']) == 'sitedirect' ? 'SiteDirect' : $vars['vendor']; | ||
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); | ||
$vars['name'] = str_replace(' ', '', ucwords($vars['name'])); | ||
|
||
return $vars; | ||
} | ||
} |
Oops, something went wrong.