Generate files from framework.

Contains the outer design like navigation.

@return void
166674
public function build()
    {
        $view = new View\AtomicKitten;
        $resultFile = new SplFileObject($this->buildSettings['target'] . 'index.html', 'w');
        $resultFile->fwrite($view->render('Generator/Index'));
    }
936301
public function createDirs()
    {
        if (!is_dir($this->getMediaPath())) {
            mkdir($this->getMediaPath());
        }

        if (!is_dir($this->getThumbnailPath())) {
            mkdir($this->getThumbnailPath());
        }
    }
1251231
protected function getFiles()
    {
        if ($this->isSiteDeployment) {
            if ($this->deviceView != 'main' && !is_dir("{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->deviceView}")) {
                $this->deviceView = 'main';
            }

            if ($this->design != 'default' && !is_dir("{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->deviceView}/{$this->design}")) {
                $this->design = 'default';
            }
        }

        $list = array();
        if (!empty($this->viewDirectory))
            $list[] = $this->viewDirectory;

        $files = array();

        $list = array_merge($this->ApplicationContext->getEnabledPluginDirectories(), $list);

        if (count($list) > 0) {
            krsort($list);
            $pattern = $this->subject.'.php';

            foreach ($list as $tp) {
                if (is_dir($tp)) {
                    $paths = $this->getPathsToCheck($tp, $pattern);
                    krsort($paths);

                    foreach ($paths as $path) {
                        $this->Logger->debug('Checking ['.$path.']...');
                        if (file_exists($path)) {
                            $this->Logger->debug('Found ['.$path.']');
                            $files[] = $path;
                            break;
                        }
                    }
                } else {
                    $this->Logger->warn('Directory does not exist: '.$tp);
                }
            }

            /*
             * special case handling for routes and redirects.  the domain, device and design
             * specific routes should be included last.  this is so the design can set routes
             * but still inherit the routes from the domain.
             *
             * this SEEMS wrong but the route patterns are the ID in the array so the last
             * route definition wins for a given pattern.
             *
             * order of includes
             * - all routes|redirects from enabled plugins
             * - app/view/context/domain/routes|redirects.php
             * - app/view/context/domain/deviceView/default/routes|redirects.php
             * - app/view/context/domain/deviceView/design/routes|redirects.php
             *
             * the array key is the ID and that IS the pattern, so last key wins.
             * This is not "great" but changing the router is a much bigger problem
             * and this is a little better than what exists now.
             *
             */
            if ('routes' === $this->subject || 'redirects' === $this->subject) {
                $path = "{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->subject}.php";
                if (file_exists($path)) {
                    $this->Logger->debug('Found ['.$path.']');
                    $files[] = $path;
                }

                if ($this->design != 'default') {
                    $path = "{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->deviceView}/default/{$this->subject}.php";
                    if (file_exists($path)) {
                        $this->Logger->debug('Found ['.$path.']');
                        $files[] = $path;
                    }
                }

                $path = "{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->deviceView}/{$this->design}/{$this->subject}.php";
                if (file_exists($path)) {
                    $this->Logger->debug('Found ['.$path.']');
                    $files[] = $path;
                }
            }

            if (empty($files))
                return array(array(), null);

            $timestamps = array();
            foreach ($files as $filename)
                $timestamps[] = filemtime($filename);

            $md5 = md5(serialize(array($files, $timestamps, filemtime(__FILE__))));

            return array($files, $md5);
        }

        throw new Exception('No active themes or plugins.');
    }
78470
protected function makeFeatureDirectories()
    {
        File::makeDirectories([$this->basePath,
                               $this->basePath.'/Twinkles',
                               $this->basePath.'/Panels',
                               $this->basePath.'/Controllers', ]);
    }
157075
public function content()
    {
        $path = '../App/' . $this->viewsDir . $this->view . '.phtml';
        if (file_exists($path)) {
            require $path;

        } else {
            die('No view file ' . $this->view . ' present in view directory.');
        }
    }
1073764
protected function createDirectories()
    {
        if (! $this->files->isDirectory($directory = app_path('Forms/Auth/Passwords'))) {
            $this->files->makeDirectory($directory, 0755, true);
        }

        if (! $this->files->isDirectory($directory = app_path('Http/Controllers/Auth'))) {
            $this->files->makeDirectory($directory, 0755, true);
        }

        if (! $this->files->isDirectory($directory = resource_path('views/auth/passwords'))) {
            $this->files->makeDirectory($directory, 0755, true);
        }

        if (! $this->files->isDirectory($directory = resource_path('views/settings'))) {
            $this->files->makeDirectory($directory, 0755, true);
        }
    }
1157502
protected function _buildFiles()
    {
        $paths = $this->_paths;
        $paths[] = realpath(APP) . DIRECTORY_SEPARATOR;

        usort($paths, function ($a, $b) {
            return strlen($a) - strlen($b);
        });

        foreach ($this->_translations as $domain => $translations) {
            foreach ($translations as $msgid => $contexts) {
                foreach ($contexts as $context => $details) {
                    $plural = $details['msgid_plural'];
                    $files = $details['references'];
                    $occurrences = [];
                    foreach ($files as $file => $lines) {
                        $lines = array_unique($lines);
                        $occurrences[] = $file . ':' . implode(';', $lines);
                    }
                    $occurrences = implode("\n#: ", $occurrences);
                    $header = '';
                    if (!$this->param('no-location')) {
                        $header = '#: ' . str_replace(DIRECTORY_SEPARATOR, '/', str_replace($paths, '', $occurrences)) . "\n";
                    }

                    $sentence = '';
                    if ($context !== '') {
                        $sentence .= "msgctxt \"{$context}\"\n";
                    }
                    if ($plural === false) {
                        $sentence .= "msgid \"{$msgid}\"\n";
                        $sentence .= "msgstr \"\"\n\n";
                    } else {
                        $sentence .= "msgid \"{$msgid}\"\n";
                        $sentence .= "msgid_plural \"{$plural}\"\n";
                        $sentence .= "msgstr[0] \"\"\n";
                        $sentence .= "msgstr[1] \"\"\n\n";
                    }

                    if ($domain !== 'default' && $this->_merge) {
                        $this->_store('default', $header, $sentence);
                    } else {
                        $this->_store($domain, $header, $sentence);
                    }
                }
            }
        }
    }
918490
public function generateFolders()
    {
        foreach ($this->getFolders() as $folder) {
            $path = $this->module->getModulePath($this->getName()).'/'.$folder;

            $this->filesystem->makeDirectory($path, 0755, true);

            $this->generateGitKeep($path);
        }
    }
1154874
def generate_files!
      # iterate through the templates in reverse, so files in the templates
      # loaded last override the previously templates.
      @templates.reverse_each do |template|
        # copy in the static files first
        template.each_file(@markup) do |dest,file|
          generate_file dest, file
        end

        # then render the templates
        template.each_template(@markup) do |dest,file|
          generate_file dest, file, template: true
        end
      end

      @generated_files.each_value do |path|
        dir = path.split(File::SEPARATOR,2).first

        if dir == 'bin'
          chmod path, 0755
        end
      end
    end
333717
public function generateFolders()
    {
        foreach ($this->getFolders() as $folder) {
            $path = $this->component->getComponentPath($this->getName()) . '/' . $folder;

            $this->filesystem->makeDirectory($path, 0755, true);

            $this->generateGitKeep($path);
        }
    }
64603
protected function getFiles()
    {
        if ($this->isSiteDeployment) {
            if ($this->deviceView != 'main' && !is_dir("{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->deviceView}")) {
                $this->deviceView = 'main';
            }

            if ($this->design != 'default' && !is_dir("{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->deviceView}/{$this->design}")) {
                $this->design = 'default';
            }
        }

        $list = array();
        if (!empty($this->viewDirectory))
            $list[] = $this->viewDirectory;

        // Build the list from all the plugin directorys, and the theme directory
        $list = array_merge($this->ApplicationContext->getEnabledPluginDirectories(),$list);

        if (count($list) > 0) {
            $files = array();
            foreach ($list as $tp) {
                if (is_dir($tp)) {
                    $paths = $this->getPathsToCheck($tp, $this->subject);
                    foreach ($paths as $basepath) {
                        if(!is_dir($basepath))
                            continue;

                        $cutoffDepth = null;
                        $objects     = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basepath),
                                                                     RecursiveIteratorIterator::SELF_FIRST);

                        foreach ($objects as $name => $object) {
                            if($cutoffDepth !== null && $objects->getDepth() > $cutoffDepth)
                                continue;
                            else
                                $cutoffDepth = null;

                            if ($cutoffDepth === null && $object->isDir() && substr($object->getBasename(), 0, 1) == '.') {
                                $cutoffDepth = $objects->getDepth();
                                continue;
                            }

                            if (!$object->isFile() || substr($object->getBasename(), 0, 1) == '.')
                                continue;

                            $files[substr($name, strlen($basepath))] = $name;
                        }
                    }

                } else {
                    $this->Logger->warn('Directory does not exist: '.$tp);
                }
            }

            if(empty($files))
                return array(array(),null);

            $timestamps = array();
            foreach ($files as $relpath => $filename) {
                $timestamps[] = filemtime($filename);
            }

            $md5 = md5(serialize(array($files,$timestamps/*, $this->VersionService->getSystemVersion(), $this->VersionService->getDeploymentRevision()*/)));

            return array($files, $md5);
        }

        throw new Exception('No active themes or plugins.');
    }
283745
protected function _generateFiles() {
        foreach ($this->selectedArtifacts as $artifact) {
            $settings = $artifact->getGeneratorSettings(static::getKey());

            foreach ($this->getFileOrDirectorySettings($settings, "files") as $file)
                $this->_processFileSpecification(
                    $artifact, fphp\Specification\FileSpecification::fromArrayAndSettings($file, $settings));

            foreach ($this->getFileOrDirectorySettings($settings, "directories") as $directory) {
                $directorySpecification = fphp\Specification\DirectorySpecification::fromArrayAndSettings($directory, $settings);
                
                foreach ($directorySpecification->getFileSpecifications() as $fileSpecification)
                    $this->_processFileSpecification($artifact, $fileSpecification);
            }
        }
    }
393287
private function _initModelDirectory ()
    {
        $model_dir  = LIB.'/'.APP.'/Model';

        if (! is_dir($model_dir)) {
            mkdir($model_dir);
        }

        if (! is_dir($model_dir.'/Query')) {
            mkdir($model_dir.'/Query');
        }

        if (! is_dir($model_dir.'/Column')) {
            mkdir($model_dir.'/Column');
        }

        if (! is_dir(LIB.'/'.APP.'/Factory')) {
            mkdir(LIB.'/'.APP.'/Factory');
        }

        if (! file_exists(LIB.'/'.APP.'/Factory/ModelFactory.php')) {
            $this->_generateModelFactoryFile();
        }
    }
201680
private function _generateJSFile()
    {
        $this->_loadLanguageItems();

        $data = [];
        foreach ($this->_languageItems as $language_item) {
            $data[md5($language_item->message)] = $language_item->languageTranslate->translation;
        }

        $filename = $this->_basePath . '/' . $this->_languageId . '.js';

        file_put_contents($filename, str_replace('{language_items}', Json::encode($data), $this->_template));
    }
1250573
private function generateViews()
    {
        $viewInstance = View::instance($this);
        $viewInstance->setLayoutType($this->viewType);
        $viewTemplateDir = dirname(dirname(__FILE__)).DS.'src'.DS.'Apps'.DS.'Views'.DS;
        $viewInstance->setTableColumns($this->columns);
        $viewInstance->setViewTemplatePath($viewTemplateDir);

        // generate twig template layout if type has set via user
        if ($this->viewType == 'php') {
            // Type not set then we will generate php layout
            $viewInstance->generateLayout('layouts');
        } else {
            $viewInstance->generateLayout('layouts.main');
        }

        $viewInstance->generateViews();

        $this->info(
            'Views Generated In '.str_replace('Controller', '', $this->controller).' Directory..'
        );
    }
1031481
public function createStubs()
    {
        foreach ($this->options() as $stubKey => $fileName) {
            if(!blank($fileName) && $fileName) {
                $this->resourceName = $fileName;
                $this->stubKey = $stubKey;
                if($stubKey == 'key') {
                    $this->stubKey = $fileName;
                    $this->resourceName = strtolower($this->ask('Enter your file name'));
                }
                $configuration = $this->config->get('tie.stubs.structure.' . $this->stubKey);
                $this->createStubFiles($configuration);
            }
        }
    }
38404
public function generateFiles()
    {
        foreach ($this->getFiles() as $stub => $file) {
            $path = $this->module->getModulePath($this->getName()) . $file;

            if (!$this->filesystem->isDirectory($dir = dirname($path))) {
                $this->filesystem->makeDirectory($dir, 0775, true);
            }

            $this->filesystem->put($path, $this->getStubContents($stub));
        }
    }