<commit_before>/*
 * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
 */

import * as fs from 'fs';
import {Github} from '../github/github';
import * as path from 'path';
import {Base} from 'yeoman-generator';
import * as logging from 'plylog';

let logger = logging.getLogger('cli.init');

export interface GithubGeneratorOptions {
  requestApi?;
  githubApi?;
  githubToken?;
  owner: string;
  repo: string;
}

export function createGithubGenerator(githubOptions: GithubGeneratorOptions) {
  let requestApi = githubOptions.requestApi;
  let githubApi = githubOptions.githubApi;
  let githubToken = githubOptions.githubToken;
  let owner = githubOptions.owner;
  let repo = githubOptions.repo;

  return class GithubGenerator extends Base {

    _github: Github;

    constructor(args: string | string[], options: any) {
      super(args, options);
      this._github = new Github({
        owner,
        repo,
        githubToken,
        githubApi,
        requestApi
      });
    }

    writing() {
      let done = this.async();
      logger.info(`Downloading latest release of ${owner}/${repo}`);
      return this._github.extractLatestRelease(this.destinationRoot())
        .then(() => {
          done();
        })
        .catch((error) => {
          logger.error(`Could not download release from ${owner}/${repo}`);
          done(error);
        });
    }

    install() {
      this.installDependencies();
    }
  }
}<commit_msg>Don’t run npm install for github templates<commit_after>/*
 * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
 */

import * as fs from 'fs';
import {Github} from '../github/github';
import * as path from 'path';
import {Base} from 'yeoman-generator';
import * as logging from 'plylog';

let logger = logging.getLogger('cli.init');

export interface GithubGeneratorOptions {
  requestApi?;
  githubApi?;
  githubToken?;
  owner: string;
  repo: string;
}

export function createGithubGenerator(githubOptions: GithubGeneratorOptions) {
  let requestApi = githubOptions.requestApi;
  let githubApi = githubOptions.githubApi;
  let githubToken = githubOptions.githubToken;
  let owner = githubOptions.owner;
  let repo = githubOptions.repo;

  return class GithubGenerator extends Base {

    _github: Github;

    constructor(args: string | string[], options: any) {
      super(args, options);
      this._github = new Github({
        owner,
        repo,
        githubToken,
        githubApi,
        requestApi
      });
    }

    writing() {
      let done = this.async();
      logger.info(`Downloading latest release of ${owner}/${repo}`);
      return this._github.extractLatestRelease(this.destinationRoot())
        .then(() => {
          done();
        })
        .catch((error) => {
          logger.error(`Could not download release from ${owner}/${repo}`);
          done(error);
        });
    }

    install() {
      this.installDependencies({
        npm: false,
      });
    }
  }
}
{'fraction_non_alphanumeric': 0.11274509803921569, 'fraction_numerical': 0.0020639834881320948, 'mean_word_length': 3.0385416666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6230091', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1062, 'n_words': 342}