<?php
/**
 * This file is part of the cast package.
 *
 * Copyright (c) 2013 Jason Coward <jason@opengeek.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Cast\Commands;

class CastInit extends CastCommand
{
    protected $command = 'init';

    public function run(array $args = array())
    {
        $directory = isset($args[0]) ? $args[0] : $this->cast->git->getPath();

        if ($this->cast->git->isInitialized()) throw new \RuntimeException('Cannot reinitialize an existing git repository at ' . $this->cast->git->getPath());

        if ($this->cast->git->getOption('core.bare', null, false)) {
            throw new \RuntimeException('Cast does not currently support bare repositories');
        }

        $this->cast->serializeModel(null, rtrim($directory, '/') . '/');

        return $this->cast->git->init->run($args);
    }
}

<?php
/**
 * This file is part of the cast package.
 *
 * Copyright (c) 2013 Jason Coward <jason@opengeek.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Cast\Commands;

use Cast\Cast;

class CastInit extends CastCommand
{
    protected $command = 'init';

    public function run(array $args = array())
    {
        $directory = isset($args[0]) && !empty($args[0]) ? $args[0] : $this->cast->git->getPath();

        if ($this->cast->git->isInitialized()) throw new \RuntimeException('Cannot reinitialize an existing git repository at ' . $directory);

        if ($this->cast->git->getOption('core.bare', null, false)) {
            throw new \RuntimeException('Cast does not currently support bare repositories');
        }

        $this->cast->serializeModel(null, rtrim($directory, '/') . '/' . $this->cast->getOption(Cast::SERIALIZED_MODEL_PATH, null, '.model/'));

        return $this->cast->git->init->run($args);
    }
}

Fix model path for serialization in init command
Fix model path for serialization in init command