Commit 35af568e authored by Nicolas Widart's avatar Nicolas Widart

Squashed 'Modules/Core/' changes from 86e93cf..37d3173

37d3173 Merge pull request #16 from AsgardCms/install-cmd-imporvements
89069ed Check if there is input given
433c7c5 Make the login box bg the main blue color
b4206a9 Add empty value to --no-interaction flag
2c0d873 Add a --no-interaction flag for composer
c739c2a Merge pull request #15 from AsgardCms/fixNamespace
b2deacf Fix entity location
e847196 Merge pull request #14 from AsgardCms/installedCheck-removePublishConfigs
597c3b1 Remove publish configuration method.
435f067 Using the finder to check if installed.
27f4ebd Merge branch 'develop' of github.com:AsgardCms/Core into develop
4aad3c5 Preparing publish theme command
a936009 Merge pull request #13 from AsgardCms/better-isIstalled-check
ec608dd Use the environment variable as a check
6585d43 Add composer file back
010deb4 Removing old composer file
5cd978c Merge commit '8bb62f5d'
1de84d9 fix merge conflict
04efe60 Adapting the installation to the new user entity namespace

git-subtree-dir: Modules/Core
git-subtree-split: 37d3173adef90123447d82395fe3341b4facfea6
parent 8bb62f5d
......@@ -2255,7 +2255,7 @@ Component: timeline
margin-top: 30px;
text-align: center;
}
/*
/*
Page: register and login
*/
.form-box {
......@@ -2275,7 +2275,7 @@ Component: timeline
border-top-right-radius: 4px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
background: #3d9970;
background: #00c0ef;
box-shadow: inset 0px -3px 0px rgba(0, 0, 0, 0.2);
padding: 20px 10px;
text-align: center;
......
/*
/*
Page: register and login
*/
.form-box {
.form-box {
width: 360px;
margin: 90px auto 0 auto;
.header {
.border-radius(4px, 4px, 0, 0);
background: @olive;
background: @aqua;
box-shadow: inset 0px -3px 0px rgba(0,0,0,0.2);
padding: 20px 10px;
text-align: center;
......@@ -15,7 +15,7 @@
font-weight: 300;
color: #fff;
}
.body, .footer {
padding: 10px 20px;
background: #fff;
......@@ -26,17 +26,17 @@
border: #fff;
}
}
> .btn {
margin-bottom: 10px;
}
}
.footer {
.border-radius(0, 0, 4px, 4px);
}
@media (max-width: @screen-sm) {
width: 90%;
}
}
\ No newline at end of file
}
......@@ -5,7 +5,6 @@ use Illuminate\Console\Command;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Schema;
use Modules\Core\Services\Composer;
class InstallCommand extends Command
......@@ -76,8 +75,6 @@ class InstallCommand extends Command
$this->publishAssets();
$this->publishConfigurations();
$this->blockMessage(
'Success!',
'Platform ready! You can now login with your username and password at /backend'
......@@ -96,12 +93,12 @@ class InstallCommand extends Command
$this->runSentinelMigrations();
$this->info('Running Sentinel seed...');
$this->call('db:seed', ['--class' => 'Modules\User\Database\Seeders\SentinelGroupSeedTableSeeder']);
$this->call('db:seed', ['--class' => 'Modules\User\Database\Seeders\SentinelGroupSeedTableSeeder', '--no-interaction' => '']);
$this->replaceUserRepositoryBindings('Sentinel');
$this->bindUserRepositoryOnTheFly('Sentinel');
$this->call('publish:config', ['package' => 'cartalyst/sentinel']);
$this->call('publish:config', ['package' => 'cartalyst/sentinel', '--no-interaction' => '']);
$this->replaceCartalystUserModelConfiguration('Cartalyst\Sentinel\Users\EloquentUser', 'Sentinel');
$this->createFirstUser('sentinel');
......@@ -115,12 +112,12 @@ class InstallCommand extends Command
private function runSentryUserCommands()
{
$this->info('Running Sentry migrations...');
$this->call('migrate', ['--package' => 'cartalyst/sentry']);
$this->call('migrate', ['--package' => 'cartalyst/sentry', '--no-interaction' => '']);
$this->info('Running Sentry seed...');
$this->call('db:seed', ['--class' => 'Modules\User\Database\Seeders\SentryGroupSeedTableSeeder']);
$this->call('db:seed', ['--class' => 'Modules\User\Database\Seeders\SentryGroupSeedTableSeeder', '--no-interaction' => '']);
$this->call('publish:config', ['package' => 'cartalyst/sentry']);
$this->call('publish:config', ['package' => 'cartalyst/sentry', '--no-interaction' => '']);
$this->replaceCartalystUserModelConfiguration('Cartalyst\Sentry\Users\Eloquent\User', 'Sentry');
$this->createFirstUser('sentry');
......@@ -135,10 +132,25 @@ class InstallCommand extends Command
{
$this->line('Creating an Admin user account...');
$firstname = $this->ask('Enter your first name');
$lastname = $this->ask('Enter your last name');
$email = $this->ask('Enter your email address');
$password = $this->secret('Enter a password');
do {
$firstname = $this->ask('Enter your first name');
if ($firstname == '') $this->error('First name is required');
} while(!$firstname);
do {
$lastname = $this->ask('Enter your last name');
if ($lastname == '') $this->error('Last name is required');
} while(!$lastname);
do {
$email = $this->ask('Enter your email address');
if ($email == '') $this->error('Email is required');
} while(!$email);
do {
$password = $this->secret('Enter a password');
if ($password == '') $this->error('Password is required');
} while(!$password);
$userInfo = [
'first_name' => $firstname,
......@@ -163,7 +175,7 @@ class InstallCommand extends Command
*/
private function runSentinelMigrations()
{
$this->call('migrate', ['--package' => 'cartalyst/sentinel']);
$this->call('migrate', ['--package' => 'cartalyst/sentinel', '--no-interaction' => '']);
}
/**
......@@ -171,36 +183,13 @@ class InstallCommand extends Command
*/
private function runMigrations()
{
$this->call('module:migrate', ['module' => 'Setting']);
$this->call('module:migrate', ['module' => 'Menu']);
$this->call('module:migrate', ['module' => 'Media']);
$this->call('module:migrate', ['module' => 'Setting', '--no-interaction' => '']);
$this->call('module:migrate', ['module' => 'Menu', '--no-interaction' => '']);
$this->call('module:migrate', ['module' => 'Media', '--no-interaction' => '']);
$this->info('Application migrated!');
}
/**
*
*/
private function publishConfigurations()
{
$this->call('publish:config', ['package' => 'dimsav/laravel-translatable']);
$this->call('publish:config', ['package' => 'mcamara/laravel-localization']);
$this->call('publish:config', ['package' => 'pingpong/modules']);
$this->call('publish:config', ['package' => 'mpedrera/themify']);
$this->adaptThemifyConfiguration();
}
/**
* Configure the mpedrera/themify configuration
* @throws \Illuminate\Filesystem\FileNotFoundException
*/
private function adaptThemifyConfiguration()
{
$themifyConfig = $this->finder->get('config/packages/mpedrera/themify/config.php');
$themifyConfig = str_replace('app_path()', 'base_path()', $themifyConfig);
$this->finder->put('config/packages/mpedrera/themify/config.php', $themifyConfig);
}
/**
* Symfony style block messages
* @param $title
......@@ -220,9 +209,9 @@ class InstallCommand extends Command
*/
private function publishAssets()
{
$this->call('module:publish', ['module' => 'Core']);
$this->call('module:publish', ['module' => 'Media']);
$this->call('module:publish', ['module' => 'Menu']);
$this->call('module:publish', ['module' => 'Core', '--no-interaction' => '']);
$this->call('module:publish', ['module' => 'Media', '--no-interaction' => '']);
$this->call('module:publish', ['module' => 'Menu', '--no-interaction' => '']);
}
/**
......@@ -230,10 +219,18 @@ class InstallCommand extends Command
*/
private function configureDatabase()
{
// Ask for credentials
$databaseName = $this->ask('Enter your database name');
$databaseUsername = $this->ask('Enter your database username');
$databasePassword = $this->secret('Enter your database password');
do {
$databaseName = $this->ask('Enter your database name');
if ($databaseName == '') $this->error('Database name is required');
} while(!$databaseName);
do {
$databaseUsername = $this->ask('Enter your database username');
if ($databaseUsername == '') $this->error('Database username is required');
} while(!$databaseUsername);
do {
$databasePassword = $this->secret('Enter your database password');
if ($databasePassword == '') $this->error('Database password is required');
} while(!$databasePassword);
$this->setLaravelConfiguration($databaseName, $databaseUsername, $databasePassword);
$this->configureEnvironmentFile($databaseName, $databaseUsername, $databasePassword);
......@@ -331,7 +328,7 @@ class InstallCommand extends Command
$path = "config/packages/cartalyst/{$driver}/config.php";
$config = $this->finder->get($path);
$config = str_replace($search, "Modules\\User\\Entities\\{$Driver}User", $config);
$config = str_replace($search, "Modules\\User\\Entities\\{$Driver}\\User", $config);
$this->finder->put($path, $config);
}
......@@ -376,7 +373,7 @@ class InstallCommand extends Command
*/
private function checkIfInstalled()
{
return Schema::hasTable('users');
return $this->finder->isFile('.env');
}
}
<?php namespace Modules\Core\Console;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
class PublishThemeAssetsCommand extends Command
{
protected $name = 'asgard:publish:theme';
protected $description = 'Publish theme assets';
public function fire()
{
$this->info('Publishing assets for ' . $this->argument('theme'));
}
protected function getArguments()
{
return array(
array('theme', InputArgument::REQUIRED, 'The theme name')
);
}
}
......@@ -4,6 +4,7 @@ use Illuminate\Contracts\Foundation\Application;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Modules\Core\Console\InstallCommand;
use Modules\Core\Console\PublishThemeAssetsCommand;
use Modules\Core\Services\Composer;
use Modules\Menu\Entities\Menuitem;
use Modules\Menu\Repositories\Eloquent\EloquentMenuItemRepository;
......@@ -79,6 +80,12 @@ class CoreServiceProvider extends ServiceProvider
private function registerCommands()
{
$this->registerInstallCommand();
$this->registerThemeCommand();
$this->commands([
'command.asgard.install',
'command.asgard.publish.theme',
]);
}
/**
......@@ -93,10 +100,13 @@ class CoreServiceProvider extends ServiceProvider
new Composer($app['files'])
);
});
}
$this->commands(
'command.asgard.install'
);
private function registerThemeCommand()
{
$this->app->bindShared('command.asgard.publish.theme', function() {
return new PublishThemeAssetsCommand;
});
}
private function registerMenuRoutes()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment