Prepares the paths that are defined from a YAML file.

@param  \Rougin\Blueprint\Blueprint $blueprint
@param  string                      $directory
@param  string|null                 $filename
@return \Rougin\Blueprint\Blueprint
195440
protected static function paths(Blueprint $blueprint, $directory, $filename = null)
    {
        $yaml = file_exists($filename) ? file_get_contents($filename) : '';

        $yaml = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $yaml);

        $yaml = str_replace('%%CURRENT_DIRECTORY%%', $directory, $yaml);

        $result = Yaml::parse($yaml) ?: self::defaults();

        $blueprint->setTemplatePath($result['paths']['templates']);

        $blueprint->setCommandPath($result['paths']['commands']);

        $blueprint->setCommandNamespace($result['namespaces']['commands']);

        return $blueprint;
    }
447779
public function config(Blueprint $blueprint = null, $key = null, $default = null)
    {
        if (is_null($blueprint)) {
            return $this->config;
        }

        return $this->config->get($blueprint, $key, $default);
    }
223706
protected function expandParams(Blueprint $blueprint): Blueprint
    {
        $class = $blueprint->getClassName();
        $params = $blueprint->getParams();

        $variadicParams = [];
        foreach ($this->reflector->getParams($class) as $reflectParam) {
            $paramName = $reflectParam->getName();
            if ($reflectParam->isVariadic() && is_array($params[$paramName])) {
                $variadicParams = array_merge($variadicParams, $params[$paramName]);
                unset($params[$paramName]);
                break; // There can only be one
            }

            if ($params[$paramName] instanceof DefaultValueParam) {
                $params[$paramName] = $params[$paramName]->getValue();
            }
        }

        return $blueprint->replaceParams(array_merge($params, array_values($variadicParams)));
    }
1253157
protected function modifySrid(Blueprint $blueprint, Fluent $column)
    {
        if (! is_null($column->srid) && is_int($column->srid) && $column->srid > 0) {
            return ' srid '.$column->srid;
        }
    }
66028
protected function loadTemplate($directory, $filename)
	{
		$contents = '';

		// Check to see if we have a valid template file
		if (file_exists($directory . DS . $filename))
		{
			// Store the file path
			$this->file = $directory . DS . $filename;

			// Get the file content
			ob_start();
			require_once $directory . DS . $filename;
			$contents = ob_get_contents();
			ob_end_clean();
		}

		return $contents;
	}
1300136
public function compilePrimary(Blueprint $blueprint, Fluent $command)
    {
        $command->name(null);

        return $this->compileKey($blueprint, $command, 'primary key');
    }
218476
public static function findInPath($filename, $path)
    {
        $asset_path = DirectoryHelper::slashDirname($path) . $filename;
        if (file_exists($asset_path)) {
            return self::buildWebPath($asset_path);
        }
        return null;
    }
1343943
public function compileCreate( Blueprint $blueprint, Fluent $command, Connection $connection )
	{
		$columns = implode( ', ', $this->getColumns( $blueprint ) );

		$sql = $blueprint->temporary ? 'create temporary' : 'create';

		$sql .= ' table ' . $this->wrapTable( $blueprint ) . " ($columns)";

		// Once we have the primary SQL, we can add the encoding option to the SQL for
		// the table.  Then, we can check if a storage engine has been supplied for
		// the table. If so, we will add the engine declaration to the SQL query.
		$sql = $this->compileCreateEncoding( $sql, $connection, $blueprint );

		if ( isset( $blueprint->engine ) )
		{
			$sql .= ' engine = ' . $blueprint->engine;
		}
		elseif ( !is_null( $engine = $connection->getConfig( 'engine' ) ) )
		{
			$sql .= ' engine = ' . $engine;
		}

		return $sql;
	}
105913
private function constructExamplePath(string $directory, string $file): string
    {
        return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file;
    }
546908
public function compileCreate(Blueprint $blueprint, Fluent $command)
    {
        $fields = $blueprint->getFields();

        $statement = $this->compileFields($fields);

        return $statement;
    }
1131511
public static function fromBlueprint(Blueprint $blueprint, $title, array $arguments = [], $type = self::TYPE_MAIN, $fillFromToolbar = 'section') {
        if($title instanceof FieldSet) {
            $title = $arguments['model']->getAttribute($title->getTitleFieldName());
        } else {
            if(!is_string($title)) {
                throw new \InvalidArgumentException('$title must be either a string or an instance of \Oxygen\Core\Form\FieldSet');
            }
        }

        $object = new static(
            $title,
            $arguments,
            $type
        );

        // sets a prefix to all the routes in the toolbar
        $object->getToolbar()->setPrefix($blueprint->getRouteName());

        // fills the toolbar with buttons from the blueprint
        $object->getToolbar()->fillFromBlueprint($blueprint, $fillFromToolbar);

        return $object;
    }
505367
public function handle(BlueprintManager $blueprints) {
        $blueprint = $blueprints->get($this->argument('name'));

        $this->heading('General Information');

        $this->table($this->generalHeaders, [$this->getGeneralInformation($blueprint)]);

        $this->heading('Toolbars');

        foreach($blueprint->getToolbarOrders() as $name => $contents) {
            $this->output->writeln($name . ': ' . Formatter::keyedArray($contents));
        }

        $this->heading('Actions');

        $actions = [];
        foreach($blueprint->getActions() as $action) {
            $actions[] = $this->getActionInformation($action);
        }
        $this->table($this->actionHeaders, $actions);
    }
118999
protected function modifyCollate(Blueprint $blueprint, Fluent $column)
    {
        if (! is_null($column->collation)) {
            return ' collate '.$column->collation;
        }
    }
1005934
def blueprint(blueprint_name):
    
    app = os.getcwd().split('/')[-1]
    if app != 'app':
        logger.warning('''\033[31m{Warning}\033[0m
==> your current path is \033[32m%s\033[0m\n
==> please create your blueprint under app folder!''' % os.getcwd())
        exit(1)

    # destination path
    dst_path = os.path.join(os.getcwd(), blueprint_name)
    if os.path.isdir(dst_path):
        logger.warning('''\033[31m{Warning}\033[0m
==> bluprint \033[32m%s\033[0m\n exist
==> please try again !''' % dst_path)
        exit(1)

    # create dst_path
    _mkdir_p(dst_path)

    # change dir
    os.chdir(dst_path)
    # create files
    init_code('__init__.py', _init_blueprint_code %
        (blueprint_name, blueprint_name))
    init_code('views.py', _views_blueprint_code %
        (blueprint_name, blueprint_name))
    init_code('forms.py', _forms_basic_code)

    # register auth in app
    os.chdir(os.path.join(dst_path, '..'))
    with open('__init__.py', 'r+') as f:
        prev = pos = 0
        while f.readline():
            prev, pos = pos, f.tell()
        f.seek(prev)
        f.write(
            '\nfrom %s import %s\napp.register_blueprint(%s, url_prefix="/%s")\n\n'
            % (
                blueprint_name, blueprint_name,
                blueprint_name, blueprint_name
            )
        )

    # create blueprint templates
    templates_path = os.path.join(os.getcwd(), 'templates')
    os.chdir(templates_path)
    blueprint_templates_path = os.path.join(templates_path, blueprint_name)
    _mkdir_p(blueprint_templates_path)

    logger.info('''\033[33m{Info}\033[0m: create blueprint done!''')
313411
protected function prepareDirectory($directory, $name)
    {
        if (!is_dir($directory)) {
            if (!@mkdir($directory, 0777, true) && !is_dir($directory)) {
                throw new RuntimeException(
                    sprintf(
                        "Unable to create the %s directory (%s)\n",
                        $name,
                        $directory
                    )
                );
            }
        } elseif (!is_writable($directory)) {
            throw new RuntimeException(
                sprintf(
                    "Unable to write in the %s directory (%s)\n",
                    $name,
                    $directory
                )
            );
        }
    }
61682
public function compileCreate(Blueprint $blueprint, Fluent $command)
    {
        return sprintf('%s table %s (%s)',
            $blueprint->temporary ? 'create temporary' : 'create',
            $this->wrapTable($blueprint),
            implode(', ', $this->getColumns($blueprint))
        );
    }
337425
public function compileRenameColumn(Blueprint $blueprint, Fluent $command, Connection $connection)
    {
        $schema = $connection->getDoctrineSchemaManager();

        $table = $this->getTablePrefix().$blueprint->getTable();

        $column = $connection->getDoctrineColumn($table, $command->from);

        $tableDiff = $this->getRenamedDiff($blueprint, $command, $column, $schema);

        return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff);
    }