creates basic build.json if key-value pairs are missing { "ios": { "debug": { "developmentTeam": "FG35JLLMXX4A" }, "release": { "developmentTeam": "FG35JLLMXX4A" } } }
968434
function createDefaultBuildJson(content) {
    if (!content.ios) {
      content.ios = {};
    }
    if (!content.ios.debug) {
      content.ios.debug = {};
    }
    if (!content.ios.release) {
      content.ios.release = {};
    }
  }
763589
def build_helpers_egginfo_json(
        json_field, json_key_registry, json_filename=None):
    

    json_filename = (
        json_field + '.json' if json_filename is None else json_filename)

    # Default calmjs core implementation specific functions, to be used by
    # integrators intended to use this as a distribution.

    def get_extras_json(pkg_names, working_set=None):
        """
        Only extract the extras_json information for the given packages
        'pkg_names'.
        """

        working_set = working_set or default_working_set
        dep_keys = set(get(json_key_registry).iter_records())
        dists = pkg_names_to_dists(pkg_names, working_set=working_set)
        return flatten_dist_egginfo_json(
            dists, filename=json_filename,
            dep_keys=dep_keys, working_set=working_set
        )

    def _flatten_extras_json(pkg_names, find_dists, working_set):
        # registry key must be explicit here as it was designed for this.
        dep_keys = set(get(json_key_registry).iter_records())
        dists = find_dists(pkg_names, working_set=working_set)
        return flatten_dist_egginfo_json(
            dists, filename=json_filename,
            dep_keys=dep_keys, working_set=working_set
        )

    def flatten_extras_json(pkg_names, working_set=None):
        """
        Traverses through the dependency graph of packages 'pkg_names'
        and flattens all the egg_info json information
        """

        working_set = working_set or default_working_set
        return _flatten_extras_json(
            pkg_names, find_packages_requirements_dists, working_set)

    def flatten_parents_extras_json(pkg_names, working_set=None):
        """
        Traverses through the dependency graph of packages 'pkg_names'
        and flattens all the egg_info json information for parents of
        the specified packages.
        """

        working_set = working_set or default_working_set
        return _flatten_extras_json(
            pkg_names, find_packages_parents_requirements_dists, working_set)

    write_extras_json = partial(write_json_file, json_field)

    return (
        get_extras_json,
        flatten_extras_json,
        flatten_parents_extras_json,
        write_extras_json,
    )
773338
protected <T> JsonObjectBase buildSuccess(String key, T value) {
        return JsonObjectUtils.buildObjectSuccess(key, value);
    }
1317675
def check_install_json(self):
        """"""
        if self.install_json_schema is None:
            return

        contents = os.listdir(self.app_path)
        if self.args.install_json is not None:
            contents = [self.args.install_json]

        for install_json in sorted(contents):
            # skip files that are not install.json files
            if 'install.json' not in install_json:
                continue

            error = None
            status = True

            try:
                # loading explicitly here to keep all error catching in this file
                with open(install_json) as fh:
                    data = json.loads(fh.read())
                validate(data, self.install_json_schema)
            except SchemaError as e:
                status = False
                error = e
            except ValidationError as e:
                status = False
                error = e.message
            except ValueError:
                # any JSON decode error will be caught during syntax validation
                return

            if error:
                # update validation data errors
                self.validation_data['errors'].append(
                    'Schema validation failed for {} ({}).'.format(install_json, error)
                )

            # update validation data for module
            self.validation_data['schema'].append({'filename': install_json, 'status': status})
181956
static function packageJson($project_directory, $app_engine_project, $app_engine_service, $package_json_defaults = []) {
        $package_json_location = $project_directory . DIRECTORY_SEPARATOR . "package.json";
        $package_json_content = Files::getJson($package_json_location, []);
        $package_json_content = array_merge([
            "name" => null,
            "project" => null,
            "private" => null,
        ], $package_json_content);
        $project_name = $app_engine_project . '-' . $app_engine_service;
        $package_json_defaults["private"] = true;
        $package_json_content["name"] = $project_name;
        $package_json_content["project"] = $app_engine_project;
        foreach ($package_json_defaults as $key => $val) {
            $package_json_content[$key] = $val;
        }
        if ($app_engine_service == "default") {
            $package_json_content["scripts"]["deploy"] = 'gcloud app deploy app.yaml queue.yaml --project $npm_package_project --promote --quiet';
        } else {
            $package_json_content["scripts"]["deploy"] = 'gcloud app deploy app.yaml --project $npm_package_project --promote --quiet';
        }
        $gaeutil_json = Files::getJson(Conf::getGaeUtilJsonPath($project_directory), []);

        $project_key_name = $gaeutil_json[Secrets::CONF_PROJECT_KEY_NAME];
        $project_key = Secrets::reverseKmsKey($project_key_name);
        $crypt_params = [
            "ciphertext-file" => "config/secrets.cipher",
            "plaintext-file" => "secrets.json",
            "project" => $project_key["project"],
            "location" => $project_key["location"],
            "keyring" => $project_key["keyRing"],
            "key" => $project_key["cryptoKey"]
        ];
        $package_json_content["scripts"]["encrypt"] = self::commandMaker("gcloud kms encrypt", $crypt_params);
        $package_json_content["scripts"]["decrypt"] = self::commandMaker("gcloud kms decrypt", $crypt_params);
        $package_json_content["scripts"]["devserve"] = 'dev_appserver.py --port=5000 . -A $npm_package_project';
        if (Files::putJson($package_json_location, $package_json_content)) {
            Util::cmdline("Updated package.json in $project_name");
        }

    }
14263
def build!(options)
      # Massage JSON
      options.each { |key,value| options[key] = false if options[key] == "false" }

      @id              = options["id"]
      @owner           = options["owner"]
      @status          = options["status"]
      @error           = options["error"]
      @name            = options["name"]
      @browser         = options["browser"]
      @browser_version = options["browser_version"]
      @os              = options["os"]
      @creation_time   = options["creation_time"].to_i
      @start_time      = options["start_time"].to_i
      @end_time        = options["end_time"].to_i
      @video_url       = options["video_url"]
      @log_url         = options["log_url"]
      @public          = options["public"]
      @tags            = options["tags"]
      @passed          = options["passed"]
      @custom_data     = options['custom-data']

      raise NoIDError if @id.nil? or @id.empty?
    end
1072710
def build_inside(input_method, input_args=None, substitutions=None):
    
    def process_keyvals(keyvals):
        """ ["key=val", "x=y"] -> {"key": "val", "x": "y"} """
        keyvals = keyvals or []
        processed_keyvals = {}
        for arg in keyvals:
            key, value = arg.split("=", 1)
            processed_keyvals[key] = value
        return processed_keyvals

    main = __name__.split('.', 1)[0]
    log_encoding = get_logging_encoding(main)
    logger.info("log encoding: %s", log_encoding)

    if not input_method:
        raise RuntimeError("No input method specified!")

    logger.debug("getting build json from input %s", input_method)

    cleaned_input_args = process_keyvals(input_args)
    cleaned_input_args['substitutions'] = process_keyvals(substitutions)

    input_runner = InputPluginsRunner([{'name': input_method,
                                        'args': cleaned_input_args}])
    build_json = input_runner.run()[input_method]

    if isinstance(build_json, Exception):
        raise RuntimeError("Input plugin raised exception: {}".format(build_json))
    logger.debug("build json: %s", build_json)
    if not build_json:
        raise RuntimeError("No valid build json!")
    if not isinstance(build_json, dict):
        raise RuntimeError("Input plugin did not return valid build json: {}".format(build_json))

    dbw = DockerBuildWorkflow(**build_json)
    try:
        build_result = dbw.build_docker_image()
    except Exception as e:
        logger.error('image build failed: %s', e)
        raise
    else:
        if not build_result or build_result.is_failed():
            raise RuntimeError("no image built")
        else:
            logger.info("build has finished successfully \\o/")
579406
function buildLoadKey (blueprintMeta, originalKey, json) {
  const keyParts = [
    blueprintMeta.namespace,
    originalKey
  ]

  if (json.version) {
    keyParts.push(json.version.replace('.', '_'))
  }

  return keyParts.join('_')
}
1235972
function build (instFile) {
  var dir = path.dirname(instFile)
  var inst = JSON.parse(fs.readFileSync(instFile))
  inst.samples = samples(path.join(dir, 'samples'), true)
  return JSON.stringify(inst, null, 2)
}
731081
def _build_filename_from_browserstack_json(j):
    
    filename = ''
    device = j['device'] if j['device'] else 'Desktop'
    if j['state'] == 'done' and j['image_url']:
        detail = [device, j['os'], j['os_version'],
                  j['browser'], j['browser_version'], '.jpg']
        filename = '_'.join(item.replace(" ", "_") for item in detail if item)
    else:
        print 'screenshot timed out, ignoring this result'
    return filename
814785
function writeBuildscriptHookForCrashlytics(enable) {
  var scriptPath = path.join(appRoot, "hooks", "after-prepare", "firebase-crashlytics-buildscript.js");

  if (!enable) {
    if (fs.existsSync(scriptPath)) {
      fs.unlinkSync(scriptPath);
    }
    return
  }

  console.log("Install Crashlytics buildscript hook.");
  try {
    var scriptContent =
        `const fs = require('fs-extra');
const path = require('path');
const xcode = require('xcode');

const pattern1 = /\\n\\s*\\/\\/Crashlytics 1 BEGIN[\\s\\S]*\\/\\/Crashlytics 1 END.*\\n/m;
const pattern2 = /\\n\\s*\\/\\/Crashlytics 2 BEGIN[\\s\\S]*\\/\\/Crashlytics 2 END.*\\n/m;
const pattern3 = /\\n\\s*\\/\\/Crashlytics 3 BEGIN[\\s\\S]*\\/\\/Crashlytics 3 END.*\\n/m;

const string1 = \`
//Crashlytics 1 BEGIN
#else
#import <Crashlytics/CLSLogging.h>
#endif
//Crashlytics 1 END
\`;

const string2 = \`
//Crashlytics 2 BEGIN
#if DEBUG
#else
static int redirect_cls(const char *prefix, const char *buffer, int size) {
  CLSLog(@"%s: %.*s", prefix, size, buffer);
  return size;
}

static int stderr_redirect(void *inFD, const char *buffer, int size) {
  return redirect_cls("stderr", buffer, size);
}

static int stdout_redirect(void *inFD, const char *buffer, int size) {
  return redirect_cls("stdout", buffer, size);
}
#endif
//Crashlytics 2 END
\`;

const string3 = \`
//Crashlytics 3 BEGIN
#if DEBUG
#else
  // Per https://docs.fabric.io/apple/crashlytics/enhanced-reports.html#custom-logs :
  // Crashlytics ensures that all log entries are recorded, even if the very next line of code crashes.
  // This means that logging must incur some IO. Be careful when logging in performance-critical areas.

  // As per the note above, enabling this can affect performance if too much logging is present.
  // stdout->_write = stdout_redirect;

  // stderr usually only occurs during critical failures;
  // so it is usually essential to identifying crashes, especially in JS
  stderr->_write = stderr_redirect;
#endif
//Crashlytics 3 END
\`;

module.exports = function($logger, $projectData, hookArgs) {
  const platform = hookArgs.platform.toLowerCase();
  return new Promise(function(resolve, reject) {
    const isNativeProjectPrepared = !hookArgs.nativePrepare || !hookArgs.nativePrepare.skipNativePrepare;
    if (isNativeProjectPrepared) {
      try {
        if (platform === 'ios') {
          const sanitizedAppName = path.basename($projectData.projectDir).split('').filter((c) => /[a-zA-Z0-9]/.test(c)).join('');

          // write buildscript for dSYM upload
          const xcodeProjectPath = path.join($projectData.platformsDir, 'ios', sanitizedAppName + '.xcodeproj', 'project.pbxproj');
          $logger.trace('Using Xcode project', xcodeProjectPath);
          if (fs.existsSync(xcodeProjectPath)) {
            var xcodeProject = xcode.project(xcodeProjectPath);
            xcodeProject.parseSync();
            var options = { shellPath: '/bin/sh', shellScript: '\"\${PODS_ROOT}/Fabric/run\"' };
            xcodeProject.addBuildPhase(
              [], 'PBXShellScriptBuildPhase', 'Configure Crashlytics', undefined, options
            ).buildPhase;
            fs.writeFileSync(xcodeProjectPath, xcodeProject.writeSync());
            $logger.trace('Xcode project written');
          } else {
            $logger.error(xcodeProjectPath + ' is missing.');
            reject();
            return;
          }

          // Logging from stdout/stderr
          $logger.out('Add iOS crash logging');
          const mainmPath = path.join($projectData.platformsDir, 'ios', 'internal', 'main.m');
          if (fs.existsSync(mainmPath)) {
            let mainmContent = fs.readFileSync(mainmPath).toString();
            // string1
            mainmContent = pattern1.test(mainmContent)
              ? mainmContent.replace(pattern1, string1)
              : mainmContent.replace(/(\\n#endif\\n)/, string1);
            // string2
            mainmContent = pattern2.test(mainmContent)
              ? mainmContent.replace(pattern2, string2)
              : mainmContent.replace(/(\\nint main.*)/, string2 + '$1');
            // string3
            mainmContent = pattern3.test(mainmContent)
              ? mainmContent.replace(pattern3, string3)
              : mainmContent.replace(/(int main.*\\n)/, '$1' + string3 + '\\n');
            fs.writeFileSync(mainmPath, mainmContent);
          } else {
            $logger.error(mainmPath + ' is missing.');
            reject();
            return;
          }

          resolve();
        } else {
          resolve();
        }
      } catch (e) {
        $logger.error('Unknown error during prepare Crashlytics', e);
        reject();
      }
    } else {
      $logger.trace("Native project not prepared.");
      resolve();
    }
  });
};
`;
    var afterPrepareDirPath = path.dirname(scriptPath);
    var hooksDirPath = path.dirname(afterPrepareDirPath);
    if (!fs.existsSync(afterPrepareDirPath)) {
      if (!fs.existsSync(hooksDirPath)) {
        fs.mkdirSync(hooksDirPath);
      }
      fs.mkdirSync(afterPrepareDirPath);
    }
    fs.writeFileSync(scriptPath, scriptContent);
  } catch (e) {
    console.log("Failed to install Crashlytics buildscript hook.");
    console.log(e);
  }
}
655071
function(fileName)
    {
      var configurations = xcodeProject.pbxXCBuildConfigurationSection(),
        INHERITED = '"$(inherited)"',
        config, buildSettings, searchPaths;

      var fileDir = path.dirname(fileName);
      var filePos = '"\\"' + fileDir + '\\""';

      for (config in configurations) {
          buildSettings = configurations[config].buildSettings;

          if(!buildSettings || !buildSettings['PRODUCT_NAME'])
            continue;

          if (!buildSettings['FRAMEWORK_SEARCH_PATHS']
              || buildSettings['FRAMEWORK_SEARCH_PATHS'] === INHERITED) {
              buildSettings['FRAMEWORK_SEARCH_PATHS'] = [INHERITED];
          }

          buildSettings['FRAMEWORK_SEARCH_PATHS'].push(filePos);
      }
    }
444716
function Version(major, minor, micro, build) {

    if (typeof major === "number" && major % 1 === 0)
        this._major = major;
    else
        throw new Error("Invalid major version number '" + major + "'");

    if (typeof minor === "number" && minor % 1 === 0)
        this._minor = minor;
    else
        throw new Error("Invalid minor version number '" + minor + "'");

    if (typeof micro === "number" && micro % 1 === 0)
        this._micro = micro;
    else
        throw new Error("Invalid micro version number '" + micro + "'");

    if (typeof build === "number" && build % 1 === 0)
        this._build = build;
    else
        throw new Error("Invalid build version number '" + build + "'");
}
1192598
function() {
      'use strict';
      var filesToCopy = {
         'widget.json': 'widget.json',
         'gitignore': '.gitignore',
         'spec/spec_runner.html': 'spec/spec_runner.html',
         'spec/spec_runner.js': 'spec/spec_runner.js',
         'spec/widget.spec.js': 'spec/' + this.placeholder.name + '.spec.js'
      };
      var integrationTechnology = this.placeholder.laxarIntegrationTechnology;
      var widget = !this.options.activity;

      if( widget && integrationTechnology !== 'react' ) {
         filesToCopy[ 'default.theme/widget.html' ] = 'default.theme/' + this.placeholder.name + '.html';
      }
      if( widget ) {
         filesToCopy[ 'default.theme/css/widget.css' ] = 'default.theme/css/' + this.placeholder.name + '.css';
      }

      if( integrationTechnology === 'plain' ) {
         if( !widget ) {
            filesToCopy[ 'controller.plain.activity.js' ] = this.placeholder.name + '.js';
         }
         else {
            filesToCopy[ 'controller.plain.widget.js' ] = this.placeholder.name + '.js';
         }
      }
      else if( integrationTechnology === 'angular' ) {
         filesToCopy[ 'controller.angular.js' ] = this.placeholder.name + '.js';
      }
      else if( integrationTechnology === 'react' ) {
         filesToCopy[ 'controller.react.jsx' ] = this.placeholder.name + '.jsx';
      }

      if( this.placeholder.infrastructure ) {
         filesToCopy[ 'README.md' ] = 'README.md';
         if( widget && integrationTechnology !== 'react') {
            filesToCopy[ 'bower.widget.json' ] = 'bower.json';
         }
         else if ( widget && integrationTechnology === 'react' ) {
            filesToCopy[ 'bower.react.widget.json' ] = 'bower.json';
         }
         else {
            filesToCopy[ 'bower.activity.json' ] = 'bower.json';
         }
      }
      for( var file in filesToCopy ) {
         if( filesToCopy.hasOwnProperty( file ) ) {
            this.fs.copyTpl(
               this.templatePath( file ),
               this.destinationPath(
                  path.join( this.widgetDirname, this.placeholder.name, filesToCopy[ file ] )
               ),
               this.placeholder
            );
         }
      }
   }
805063
function(pkg_name, pkg_ver){

    var pkg_info = null;
    var dep_type = null;
    var cmd = BOWER_INFO_CMD.replace("{name}", pkg_name).replace("{ver}", pkg_ver) + ' --json';

    try {
        var response = execSync(cmd, {stdio: [null]});

        pkg_info = JSON.parse(response.toString());

        if(pkg_info && _.size(pkg_info) > 0){
            console.info('      - Fetched info for '.green + pkg_name.bold.green + ' from Bower'.grey);
        }else{
            console.warn('      ^ Could not fetch info for '.grey + pkg_name.red.bold);
        }
    }
    catch (err) {
        console.warn('      ^ Err! Could not fetch info for '.grey + pkg_name.red.bold);
    }

    return pkg_info;
}
571001
private String acceptBuilder(String version) {
        String acceptValue = "application/json";
        if(version == "2.1") acceptValue += ";version=" + version;

        return acceptValue;
    }
572735
def load_json():
    
    try:
        env = configure.get_env()
        configure.export_to_json(env)
    except SystemExit:
        raise BuildError(msg="configure failed!  Could not build targets!",
                         frame=gfi(cf()), errno=errno.ENOSYS)
    json_fl = os.path.dirname(sys.argv[0]) + "/scripts/config.JSON"
    data = _load_json(json_fl)
    return data