Runs SPAC to generate code.
@param {string} schemaFilePath
@param {string} namespace
@param {string} outputDir
@return {!IThenable}
502305
function runSpac(schemaFilePath, namespace, outputDir) {
  var spacPath = pathMod.resolve(pathMod.join(__dirname, '../spac/spac.js'));
  var spac = childProcess.fork(
      spacPath,
      [
        '--schema=' + schemaFilePath,
        '--namespace=' + namespace,
        '--outputdir=' + outputDir,
        '--nocombine=true'
      ]);

  return new Promise(function(resolve, reject) {
    spac.on('close', function(code) {
      if (code == 0) {
        resolve();
      } else {
        var error = new Error(
            'ERROR: unable to generate code from ' + schemaFilePath + '\r\n');
        log(error);
        reject(error);
      }
    });
  });
}
1258538
def define_task
      namespace(@namespace) do
        namespace("schema") do
          desc("Dump the schema to IDL in #{idl_path}")
          task :idl => @dependencies do
            write_outfile(:to_definition, idl_path)
            puts "Schema IDL dumped into #{idl_path}"
          end

          desc("Dump the schema to JSON in #{json_path}")
          task :json => @dependencies do
            write_outfile(:to_json, json_path)
            puts "Schema JSON dumped into #{json_path}"
          end

          desc("Dump the schema to JSON and IDL")
          task :dump => [:idl, :json]
        end
      end
    end
659395
function(inDir, outDir){
    var name = this.bundleOptions.name;
    var opts = this._generateEsperantoOptions(name);
    var transpilerName = formatToFunctionName[this.format];
    var targetExtension = this.targetExtension;

    return esperanto.bundle({
      base: inDir,
      entry: this.bundleOptions.entry
    }).then(function(bundle) {
      var compiledModule = bundle[transpilerName](opts);
      var fullOutputPath = path.join(outDir, name + '.' + targetExtension);

      return writeFile(fullOutputPath, compiledModule.code);
    });
  }
315597
function writeOutput(filePath, content, failOnError, cb) {
    var outStream;
    if (!filePath) {
        if (content) {
            console.log(content);
        }
        if (failOnError) {
            return cb(new gutil.PluginError('gulp-jscs-custom', 'JSCS validation failed', {
                showStack: false
            }));
        } else {
            return cb();
        }
    }
    outStream = fs.createWriteStream(filePath);
    outStream.write(content, null, cb);
}
123807
def _createSchemaFiles(self, destPath, schemasPath):
        
        # Create the target directory hierarchy, if neccessary
        ga4ghPath = os.path.join(destPath, 'ga4gh')
        if not os.path.exists(ga4ghPath):
            os.mkdir(ga4ghPath)
        ga4ghSchemasPath = os.path.join(ga4ghPath, 'schemas')
        if not os.path.exists(ga4ghSchemasPath):
            os.mkdir(ga4ghSchemasPath)
        ga4ghSchemasGa4ghPath = os.path.join(ga4ghSchemasPath, 'ga4gh')
        if not os.path.exists(ga4ghSchemasGa4ghPath):
            os.mkdir(ga4ghSchemasGa4ghPath)
        ga4ghSchemasGooglePath = os.path.join(ga4ghSchemasPath, 'google')
        if not os.path.exists(ga4ghSchemasGooglePath):
            os.mkdir(ga4ghSchemasGooglePath)
        ga4ghSchemasGoogleApiPath = os.path.join(
            ga4ghSchemasGooglePath, 'api')
        if not os.path.exists(ga4ghSchemasGoogleApiPath):
            os.mkdir(ga4ghSchemasGoogleApiPath)

        # rewrite the proto files to the destination
        for root, dirs, files in os.walk(schemasPath):
            for protoFilePath in fnmatch.filter(files, '*.proto'):
                src = os.path.join(root, protoFilePath)
                dst = os.path.join(
                    ga4ghSchemasPath,
                    os.path.relpath(root, schemasPath), protoFilePath)
                self._copySchemaFile(src, dst)
1369299
function createDestReadme(srcReadmePath) {
 
    const destReadmePath = srcReadmePath.replace(/(\bpackages\b)(?!.*\1)/, destDir);
    const destDirPath = path.dirname(destReadmePath);
    const srcDirPath = path.dirname(srcReadmePath);
    const srcReadmeText = fs.readFileSync(srcReadmePath).toString();

    var folderName = srcDirPath
        .split(path.sep)
        .pop();

    var lines = fs.readFileSync(srcReadmePath, 'utf-8')
        .split('\n')
        .filter(Boolean);

    var title = lines[0]
        .replace(/#/g, '')
        .replace(/FAST/g, '')
        .trim();
            
    var docusaurusHeader = 
        `---\n` + 
        `id: index\n` + 
        `title: FAST ${title}\n` + 
        `sidebar_label: ${title}\n` +
        `---\n\n`;

    createDirectory(destDirPath);

    if (dryRun) {
        if (fs.existsSync(destReadmePath)) {
            console.log(`...REPLACE readme.md in the '${folderName}' folder`);
        } else {
            console.log(`...ADD readme.md to the '${folderName}' folder`);
        }
    } else {
        try {
            fs.writeFileSync(destReadmePath, docusaurusHeader);
            fs.appendFileSync(destReadmePath, srcReadmeText);
            updatedDocsCount++;
            console.log(`...${folderName} was succesfully updated`);
        } catch (err) {
            console.log(chalk.red(err));
        }
    }

}
1183871
def register_schema(self, directory, path):
        
        self.schemas[path] = os.path.abspath(directory)
1027202
function(src, output, filename) {
    return new Elixir.GulpPaths()
        .src(src, config.bower.folder)
        .output(output, filename);
}
639974
void generateMbeanXml(Definition def, String outputDir)
   {
      String mbeanName = def.getDefaultValue().toLowerCase(Locale.US);
      if (def.getRaPackage() != null && !def.getRaPackage().equals(""))
      {
         if (def.getRaPackage().indexOf('.') >= 0)
         {
            mbeanName = def.getRaPackage().substring(def.getRaPackage().lastIndexOf('.') + 1);
         }
         else
            mbeanName = def.getRaPackage();
      }

      try
      {
         outputDir = outputDir + File.separatorChar + "src" + File.separatorChar +
               "main" + File.separatorChar + "resources" + File.separatorChar + "jca";
         FileWriter mbfw = Utils.createFile(mbeanName + ".xml", outputDir);
         MbeanXmlGen mbGen = new MbeanXmlGen();
         mbGen.generate(def, mbfw);
         mbfw.close();
      }
      catch (IOException ioe)
      {
         ioe.printStackTrace();
      }
   }
93223
public static void generateSource(String data, File sourceOutputPath) {
        ProtoFile protoFile = ProtoParser.parse(DEFAULT_FILE_NAME, data);
        List<CodeDependent> cds = new ArrayList<CodeDependent>();
        try {
            doCreate(protoFile, true, false, null, true, sourceOutputPath, cds, new HashMap<String, String>(), false);
        } catch (IOException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
281391
public function setNamespaceFromPath(string $filePath, string $srcSubFolderName, string $projectRootNamespace): self
    {
        $pathForNamespace = substr(
            $filePath,
            \ts\strpos(
                $filePath,
                $srcSubFolderName
            )
            + \strlen($srcSubFolderName)
            + 1
        );
        $pathForNamespace = substr($pathForNamespace, 0, strrpos($pathForNamespace, '/'));
        $namespaceToSet   = $projectRootNamespace
                            . '\\' . implode(
                                '\\',
                                explode(
                                    '/',
                                    $pathForNamespace
                                )
                            );
        $contents         = \ts\file_get_contents($filePath);
        $contents         = preg_replace(
            '%namespace[^:]+?;%',
            "namespace $namespaceToSet;",
            $contents,
            1,
            $count
        );
        if ($count !== 1) {
            throw new DoctrineStaticMetaException(
                'Namespace replace count is ' . $count . ', should be 1 when updating file: ' . $filePath
            );
        }
        file_put_contents($filePath, $contents);

        return $this;
    }
872715
def document(schema_file):
    ''''''
    schema = load_schema_file(open(schema_file, 'r'))
    documentation = generate_documentation(schema)
    sys.stdout.write(documentation)
1126340
function processFile(argv, inputPath, opt_outputPath) {
  // Setup output path.
  var outputPath = opt_outputPath;
  if (!opt_outputPath) {
    var ext = path.extname(inputPath);
    if (ext.length) {
      outputPath = inputPath.substr(0, inputPath.length - ext.length) +
          '.instrumented' + ext;
    } else {
      outputPath = inputPath + '.instrumented.js';
    }
  }

  var sourceCode = fs.readFileSync(inputPath).toString();

  // TODO(benvanik): support setting the module ID?
  var targetCode = transformCode(0, inputPath, sourceCode, argv);

  console.log('Writing ' + outputPath + '...');
  fs.writeFileSync(outputPath, targetCode);
  fs.chmodSync(outputPath, fs.statSync(inputPath).mode);
}
280892
function (namespace, schemaUrl, cb) {
    var self = this;

    if (multivalue.hasValue(self.downloadedSchemas, namespace, schemaUrl)) {
      cb(null, {});
      return;
    }

    request(schemaUrl, function (err, response, body) {
      if (err) {
        cb("Error downloading " + namespace + " schema (" + schemaUrl + "): " + err);
        return;
      }
      else if (response.statusCode !== 200) {
        cb("Error downloading " + namespace + " schema (" + schemaUrl + "): HTTP status code " + response.statusCode);
        return;
      }

      self.addSchema(namespace, body, function (err, importsAndIncludes) {
        if (err) {
          cb(err);
          return;
        }

        multivalue.addValue(self.downloadedSchemas, namespace, schemaUrl);

        cb(null, importsAndIncludes);
      });
    });
  }
935226
private static File makeOutputFile(String outputDir, String packageName, String className)
        throws IOException {
        
        // Convert the package name to a path
        Pattern pattern=Pattern.compile("\\.");
        Matcher matcher=pattern.matcher(packageName);
        String sepToUse=File.separator;
        if (sepToUse.equals("\\")) {
            sepToUse="\\\\";
        }

        // Try to create the necessary directories
        String directoryPath=outputDir+File.separator+matcher.replaceAll(sepToUse);
        File directory=new File(directoryPath);
        File outputFile=new File(directory, className+".java");
        
        LOG.debug(String.format("Attempting to create output file at %1$s", outputFile.getAbsolutePath()));
        
        try {
            directory.mkdirs();
            outputFile.createNewFile();
        } catch (SecurityException se) {
            throw new IOException(String.format("Can't write to output file %1$s", outputFile.getAbsoluteFile()), se);
        } catch (IOException ioe) {
            throw new IOException(String.format("Can't write to output file %1$s", outputFile.getAbsoluteFile()), ioe);
        }
        
        return outputFile;
    }
907261
function writeFile(output, filePath, content) {
    var rootFolder = output.getRoot();
    filePath = path.join(rootFolder, filePath);

    return fs.ensureFile(filePath)
    .then(function() {
        return fs.writeFile(filePath, content);
    })
    .thenResolve(output);
}
70034
public function addingNamespaceInComposer($namespace, $path, $output = 'composer.json')
    {
        $file = base_path('composer.json');
        $data = json_decode($this->filesystem->get($file), true);
        
        $rootStub = $this->config->get('tie.stubs.root');
        if(is_array($rootStub)) {
            $rootStub = data_get($this->config->get($rootStub), 'path',  '');
        }

        $path = str_replace(base_path().'/', '', $path) . '/' . $rootStub;

        $data["autoload"]["psr-4"] = array_merge($data["autoload"]["psr-4"], [ $namespace => $path ]);
        $this->filesystem->put(base_path($output), json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
    }