1 | /*
|
2 | * Copyright 2019 Adobe. All rights reserved.
|
3 | * This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
4 | * you may not use this file except in compliance with the License. You may obtain a copy
|
5 | * of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6 | *
|
7 | * Unless required by applicable law or agreed to in writing, software distributed under
|
8 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
9 | * OF ANY KIND, either express or implied. See the License for the specific language
|
10 | * governing permissions and limitations under the License.
|
11 | */
|
12 |
|
13 | const chalk = require('chalk');
|
14 | const opn = require('open');
|
15 | const AbstractCommand = require('./abstract.cmd.js');
|
16 |
|
17 | class HackCommand extends AbstractCommand {
|
18 | constructor(logger) {
|
19 | super(logger);
|
20 | this._open = false;
|
21 | this._hackathon = '';
|
22 | }
|
23 |
|
24 | // eslint-disable-next-line class-methods-use-this
|
25 | get requireConfigFile() {
|
26 | return false;
|
27 | }
|
28 |
|
29 | withHackathon(value) {
|
30 | this._hackathon = value || 'README';
|
31 | return this;
|
32 | }
|
33 |
|
34 | withOpen(o) {
|
35 | this._open = !!o;
|
36 | return this;
|
37 | }
|
38 |
|
39 | async run() {
|
40 | await this.init();
|
41 | const url = `https://helix-home-adobe.project-helix.page/hackathons/${this._hackathon}.html`;
|
42 | if (this._open) {
|
43 | opn(url, { url: true });
|
44 | } else {
|
45 | // eslint-disable-next-line no-console
|
46 | this.log.info(chalk`Check out the Helix Hackathon at {blue ${url}}`);
|
47 | }
|
48 | }
|
49 | }
|
50 |
|
51 | module.exports = HackCommand;
|