<commit_before><?php namespace Laravella\Ravel;

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Illuminate\Filesystem\Filesystem;
use Config;

class RavelInstallCommand extends Command {

	/**
	 * The console command name.
	 *
	 * @var string
	 */
	protected $name = 'ravel:install';

	/**
	 * The console command description.
	 *
	 * @var string
	 */
	protected $description = 'Install Ravel including migrations';

	/**
	 * Create a new command instance.
	 *
	 * @return void
	 */
	public function __construct()
	{
		parent::__construct();
	}

	/**
	 * Execute the console command.
	 *
	 * @return void
	 */
	public function fire()
	{

		// $app = $this->getLaravel();
		// $env = $app->environment();
	

		if($this->checkifWorkBench())
		{
			$this->call('asset:publish',array('--bench'=>'laravella/ravel'));
			$this->call('migrate',array('--bench'=>'laravella/ravel'));
		}
		else
		{	
			$this->call('config:publish',array('package'=>'laravella/ravel'));
			$this->call('asset:publish',array('package'=>'laravella/ravel'));
			$this->call('migrate',array('--package'=>'laravella/ravel'));
		}

		$this->call('db:seed',array('--class'=>'RavelDatabaseSeeder'));

		$this->setupUploadDirectory();

		$this->info('Successfully Completed Installation of Ravel');
	}


	public function checkifWorkBench()
	{
		$path = __FILE__;
		return str_contains(strtolower($path),'/workbench/laravella/ravel/');
	}

	public function setupUploadDirectory()
	{
		$publicPath = app()->make('path.public');
		$ConfigUploadPath = app('config')->get('ravel::media.media_storage_path');
		$uploadPath = $publicPath .'/'. $ConfigUploadPath;

		if ( ! app('files')->isDirectory($uploadPath))
		{
			$dirs = explode('/', $ConfigUploadPath);
			$findPath = $publicPath;
			$realpath = '/public';
			$filesCreated = false;
			foreach($dirs as $dir)
			{
				if(!is_null($dir))
				{
					$findPath = $findPath . '/' . $dir;
					$realpath = $realpath . '/' . $dir;
					if( ! app('files')->isDirectory($findPath))
					{
						//create path
						app('files')->makeDirectory($findPath);<commit_msg>ravel commands<commit_after><?php namespace Laravella\Cms;

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Illuminate\Filesystem\Filesystem;
use Config;

class CmsInstallCommand extends Command {

	/**
	 * The console command name.
	 *
	 * @var string
	 */
	protected $name = 'cms:install';

	/**
	 * The console command description.
	 *
	 * @var string
	 */
	protected $description = 'Install Cms including migrations';

	/**
	 * Create a new command instance.
	 *
	 * @return void
	 */
	public function __construct()
	{
		parent::__construct();
	}

	/**
	 * Execute the console command.
	 *
	 * @return void
	 */
	public function fire()
	{

		// $app = $this->getLaravel();
		// $env = $app->environment();
	

		if($this->checkifWorkBench())
		{
			$this->call('asset:publish',array('--bench'=>'laravella/cms'));
			$this->call('migrate',array('--bench'=>'laravella/cms'));
		}
		else
		{	
			$this->call('config:publish',array('package'=>'laravella/cms'));
			$this->call('asset:publish',array('package'=>'laravella/cms'));
			$this->call('migrate',array('--package'=>'laravella/cms'));
		}

		$this->call('db:seed',array('--class'=>'CmsDatabaseSeeder'));

		$this->setupUploadDirectory();

		$this->info('Successfully Completed Installation of CMS');
	}


	public function checkifWorkBench()
	{
		$path = __FILE__;
		return str_contains(strtolower($path),'/workbench/laravella/cms/');
	}

	public function setupUploadDirectory()
	{
		$publicPath = app()->make('path.public');
		$ConfigUploadPath = app('config')->get('cms::media.media_storage_path');
		$uploadPath = $publicPath .'/'. $ConfigUploadPath;

		if ( ! app('files')->isDirectory($uploadPath))
		{
			$dirs = explode('/', $ConfigUploadPath);
			$findPath = $publicPath;
			$realpath = '/public';
			$filesCreated = false;
			foreach($dirs as $dir)
			{
				if(!is_null($dir))
				{
					$findPath = $findPath . '/' . $dir;
					$realpath = $realpath . '/' . $dir;
					if( ! app('files')->isDirectory($findPath))
					{
						//create path
						app('files')->makeDirectory($findPath);
{'fraction_non_alphanumeric': 0.18925831202046037, 'fraction_numerical': 0.0, 'mean_word_length': 3.93348623853211, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5612263', 'n_tokens_mistral': 1601, 'n_tokens_neox': 1398, 'n_words': 238}