lib/plugins/install/install.js/Install/constructor
class Install:  constructor(serverless, options) {
    this.serverless = serverless;
    this.options = options;

    this.commands = {
      install: {
        usage: 'Install a Serverless service from GitHub',
        lifecycleEvents: [
          'install',
        ],
        options: {
          url: {
            usage: 'URL of the Serverless service on GitHub',
            required: true,
            shortcut: 'u',
          },
          name: {
            usage: 'Name for the service',
            shortcut: 'n',
          },
        },
      },
    };

    this.hooks = {
      'install:install': () => BbPromise.bind(this)
        .then(this.install),
    };

    this.renameService = (name, servicePath) => {
      const serviceFile = path.join(servicePath, 'serverless.yml');
      const packageFile = path.join(servicePath, 'package.json');

      if (!this.serverless.utils.fileExistsSync(serviceFile)) {
        const errorMessage = [
          'serverless.yml not found in',
          ` ${servicePath}`,
        ].join('');
        throw new this.serverless.classes.Error(errorMessage);
      }

      const serverlessYml =
        fse.readFileSync(serviceFile, 'utf-8')
          .replace(/service\s*:.+/gi, (match) => {
            const fractions = match.split('#');
            fractions[0] = `service: ${name}`;
            return fractions.join(' #');
          });

      fse.writeFileSync(serviceFile, serverlessYml);

      if (this.serverless.utils.fileExistsSync(packageFile)) {
        const json = this.serverless.utils.readFileSync(packageFile);
        this.serverless.utils.writeFile(packageFile, Object.assign(json, { name }));
      }
    };
  }