Skip to content

Commit

Permalink
Bring back the Installer script for .env
Browse files Browse the repository at this point in the history
  • Loading branch information
Roni Laukkarinen committed Jun 11, 2015
1 parent 89bf860 commit 067d44c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -20,16 +20,16 @@
"require": {
"ronilaukkarinen/dudestack": "dev-master"
},
"config": {
"config": {
"preferred-install": "dist",
"generate-salts": true
},
"autoload": {
"psr-4": {"Roots\\Bedrock\\": "scripts/Roots/Bedrock"}
},
"scripts": {
"post-root-package-install": ["Bedrock\\Installer::addSalts"]
},
"post-root-package-install": ["Roots\\Bedrock\\Installer::addSalts"]
},
"repositories": [
{
"type": "composer",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -1,11 +1,11 @@
<?php

namespace Bedrock;
namespace Roots\Bedrock;

use Composer\Script\Event;

class Installer {
public static $KEYS = array(
public static $KEYS = [
'AUTH_KEY',
'SECURE_AUTH_KEY',
'LOGGED_IN_KEY',
Expand All @@ -14,10 +14,10 @@ class Installer {
'SECURE_AUTH_SALT',
'LOGGED_IN_SALT',
'NONCE_SALT'
);
];

public static function addSalts(Event $event) {
$root = dirname(dirname(__DIR__));
$root = dirname(dirname(dirname(__DIR__)));
$composer = $event->getComposer();
$io = $event->getIO();

Expand All @@ -32,7 +32,7 @@ public static function addSalts(Event $event) {
}

$salts = array_map(function ($key) {
return sprintf("%s='%s'", $key, Installer::generate_salt());
return sprintf("%s='%s'", $key, Installer::generateSalt());
}, self::$KEYS);

$env_file = "{$root}/.env";
Expand All @@ -49,7 +49,7 @@ public static function addSalts(Event $event) {
* Slightly modified/simpler version of wp_generate_password
* https://github.com/WordPress/WordPress/blob/cd8cedc40d768e9e1d5a5f5a08f1bd677c804cb9/wp-includes/pluggable.php#L1575
*/
public static function generate_salt($length = 64) {
public static function generateSalt($length = 64) {
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$chars .= '!@#$%^&*()';
$chars .= '-_ []{}<>~`+=,.;:/?|';
Expand All @@ -61,4 +61,4 @@ public static function generate_salt($length = 64) {

return $salt;
}
}
}

0 comments on commit 067d44c

Please sign in to comment.