<commit_before><?php

namespace Canvas\Console;

use Canvas\Tag;
use Canvas\Post;
use Canvas\Topic;
use Faker\Generator;
use Ramsey\Uuid\Uuid;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Illuminate\Foundation\Auth\User;
use Illuminate\Support\Facades\Route;
use Illuminate\Console\DetectsApplicationNamespace;

class SetupCommand extends Command
{
    use DetectsApplicationNamespace;

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'canvas:setup {--data : Specifies that demo data should be seeded}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Scaffold basic blog views and routes';

    /**
     * The views that need to be exported.
     *
     * @var array
     */
    protected $views = [
        'layouts/app.stub'     => 'layouts/app.blade.php',
        'partials/navbar.stub' => 'partials/navbar.blade.php',
        'partials/styles.stub' => 'partials/styles.blade.php',
        'index.stub'           => 'index.blade.php',
        'show.stub'            => 'show.blade.php',
    ];

    /**
     * Execute the console command.
     *
     * @return void
     * @throws \Exception
     */
    public function handle()
    {
        $this->createDirectories();
        $this->exportViews();
        $this->buildController();
        $this->registerRoutes();

        // Optionally seed the database with demo data
        if ($this->option('data')) {
            if (User::find(1)) {
                $this->seed();

                $this->info('Setup complete. Head over to <comment>'.url('/blog').'</comment> to get started.');
            } else {
                $this->error('No users found. Please create a user and run the setup again.');
            }
        }
    }

    /**
     * Create the view directories.
     *
     * @return void
     */
    private function createDirectories()
    {
        if (! is_dir($directory = resource_path('views/blog/layouts'))) {
            mkdir($directory, 0755, true);
        }

        if (! is_dir($directory = resource_path('views/blog/partials'))) {
            mkdir($directory, 0755, true);
        }
    }

    /**
     * Export the default blog views.
     *
     * @return void
     */
    private function exportViews()
    {
        foreach ($this->views as $key => $value) {<commit_msg>Fixed the info line never being called in the setup command without the --data option<commit_after><?php

namespace Canvas\Console;

use Canvas\Tag;
use Canvas\Post;
use Canvas\Topic;
use Faker\Generator;
use Ramsey\Uuid\Uuid;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Illuminate\Foundation\Auth\User;
use Illuminate\Support\Facades\Route;
use Illuminate\Console\DetectsApplicationNamespace;

class SetupCommand extends Command
{
    use DetectsApplicationNamespace;

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'canvas:setup {--data : Specifies that demo data should be seeded}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Scaffold basic blog views and routes';

    /**
     * The views that need to be exported.
     *
     * @var array
     */
    protected $views = [
        'layouts/app.stub'     => 'layouts/app.blade.php',
        'partials/navbar.stub' => 'partials/navbar.blade.php',
        'partials/styles.stub' => 'partials/styles.blade.php',
        'index.stub'           => 'index.blade.php',
        'show.stub'            => 'show.blade.php',
    ];

    /**
     * Execute the console command.
     *
     * @return void
     * @throws \Exception
     */
    public function handle()
    {
        $this->createDirectories();
        $this->exportViews();
        $this->buildController();
        $this->registerRoutes();

        // Optionally seed the database with demo data
        if ($this->option('data')) {
            if (User::find(1)) {
                $this->seed();
            } else {
                $this->error('No users found. Please create a user and re-run the setup.');
            }
        }

        $this->info('Setup complete. Head over to <comment>'.url('/blog').'</comment> to get started.');
    }

    /**
     * Create the view directories.
     *
     * @return void
     */
    private function createDirectories()
    {
        if (! is_dir($directory = resource_path('views/blog/layouts'))) {
            mkdir($directory, 0755, true);
        }

        if (! is_dir($directory = resource_path('views/blog/partials'))) {
            mkdir($directory, 0755, true);
        }
    }

    /**
     * Export the default blog views.
     *
     * @return void
     */
    private function exportViews()
    {
        foreach ($this->views as $key => $value) {
{'fraction_non_alphanumeric': 0.13394495412844037, 'fraction_numerical': 0.003669724770642202, 'mean_word_length': 2.0490988191423245, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 37, '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': '6585583', 'n_tokens_mistral': 1444, 'n_tokens_neox': 1424, 'n_words': 353}