Skip to content

Commit

Permalink
Delete some trailing whitespace.
Browse files Browse the repository at this point in the history
Thanks default editor settings.
  • Loading branch information
jyasskin committed May 18, 2020
1 parent 934261f commit f0f3a05
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 61 deletions.
14 changes: 7 additions & 7 deletions lib/mixins/fetchable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const services = require("../services");

mustache.escape = v => v;

module.exports = (superclass) => class extends superclass {
module.exports = (superclass) => class extends superclass {
getUrl(options) {
if (this.pr.processor == "bikeshed") {
if (this.pr.processor == "bikeshed") {
return this.getBikeshedUrl(options);
}

Expand All @@ -28,7 +28,7 @@ module.exports = (superclass) => class extends superclass {
}

getService() {
if (this.pr.processor == "bikeshed") {
if (this.pr.processor == "bikeshed") {
return services.BIKESHED;
}

Expand Down Expand Up @@ -57,8 +57,8 @@ module.exports = (superclass) => class extends superclass {
return this.cdn_url + query;
}

get file_path() {
return `${ this.owner }/${ this.repo }/${ this.sha }/${ this.pr.config.src_file }`;
get file_path() {
return `${ this.owner }/${ this.repo }/${ this.sha }/${ this.pr.config.src_file }`;
}

get github_url() {
Expand All @@ -68,7 +68,7 @@ module.exports = (superclass) => class extends superclass {
get cdn_url() { // This is necessary to serve content with correct HTTP headers
return `https://rawcdn.githack.com/${ this.file_path }`;
}

getQuery(data, encode) {
let params = this.pr.config.params || {};
return Object.keys(params).map(k => {
Expand Down Expand Up @@ -96,7 +96,7 @@ module.exports = (superclass) => class extends superclass {
url: this.cache_url
};
}

fetch() {
var url = this.getUrl(this.urlOptions());
console.log(`Fetch: ${ url }`);
Expand Down
78 changes: 39 additions & 39 deletions lib/models/pr.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ class PR {
if (typeof id != "string") {
throw new TypeError(`Incorrect Id: ${ JSON.stringify(id, null, 4) }`)
}

if (typeof installation != "object") {
throw new TypeError(`Incorrect Installation object: ${ JSON.stringify(installation, null, 4) }`)
}

this._id = id;
this._installation = installation;
let parts = id.split("/");
this._owner = parts[0];
this._repo = parts[1];
this._number = parts[2];
}

init(options) {
return this.setupApi(options)
.then(_ => this.requestConfig())
.then(_ => this.requestPR())
.then(_ => this.requestMergeBase())
.then(_ => this.getPreviewFiles());
}

request(url, options, body) {
return this._api.request(url, options, body);
}
Expand All @@ -52,36 +52,36 @@ class PR {
}
});
}

setupApi(options) {
this._api = new GithubAPI(this, options);
return this._api.requestAuthHeaders()
.then(headers => this._api.setAuthHeaders(headers));
}

requestConfig() {
return new Config(this).request().then(config => this.config = config);
}

get config() {
if (!("_config" in this)) {
throw new Error("Invalid state, missing _config");
}
return this._config;
return this._config;
}

get postProcessingConfig() {
return this.config.post_processing;
}

set config(config) {
return this._config = config;
}

requestCommits() {
return this.request(GH_API.GET_PR_COMMITS).then(commits => this.commits = commits);
}

requestMergeBase() {
return this.request(GH_API.GET_COMPARE_COMMITS, {
base: this.payload.base.sha,
Expand All @@ -91,18 +91,18 @@ class PR {
this.files = payload.files;
});
}

get commits() {
if (!("_commits" in this)) {
throw new Error("Invalid state, missing _commits");
}
return this._commits;
return this._commits;
}

set commits(commits) {
return this._commits = commits;
}

get head_sha() {
return this.payload.head.sha;
}
Expand All @@ -117,33 +117,33 @@ class PR {
}
return this._merge_base_sha;
}

set merge_base_sha(merge_base_sha) {
return this._merge_base_sha = merge_base_sha;
}

get files() {
if (!("_files" in this)) {
throw new Error("Invalid state, missing _files");
}
return this._files;
return this._files;
}

set files(files) {
return this._files = files;
}

get preview_files() {
if (!("_preview_files" in this)) {
throw new Error("Invalid state, missing _preview_files");
}
return this._preview_files;
return this._preview_files;
}

set preview_files(preview_files) {
return this._preview_files = preview_files;
}

updateBody(content) {
return this.request(GH_API.PATCH_PR, null, {
body: content
Expand All @@ -153,70 +153,70 @@ class PR {
get payload() {
return this._payload;
}

set payload(payload) {
return this._payload = payload;
}

get installation() {
return this._installation;
}

get number() {
return this._number;
}

get owner() {
return this._owner;
}

get repo() {
return this._repo;
}

get id() {
return this._id;
}

get body() {
return this._body = this._body || (this.payload.body || "").replace(/\r\n/g, "\n").trim();
}

get processor() {
return this.config.type.toLowerCase();
}

get aws_s3_bucket() {
if (process.env.ALLOW_MULTIPLE_AWS_BUCKETS == "no") {
return process.env.AWS_BUCKET_NAME;
}
return this.owner == "whatwg" ? process.env.WHATWG_AWS_BUCKET_NAME : process.env.AWS_BUCKET_NAME;
}

get isMultipage() {
return !!this.config.multipage;
}

requiresPreview() {
return !(/<!--\s*no preview\s*-->/.test(this.body));
}

touchesSrcFile() {
let relFiles = this.relevantSrcFiles;
return this.files.some(f => relFiles.indexOf(f.filename) > -1);
}

get relevantSrcFiles() {
return [this.config.src_file];
}

getPreviewFiles() {
if (this.processor == "wattsi") {
this.wattsi = new WattsiClient(this);
return this.wattsi.getFilenames().then(_ => {
this.preview_files = [];
this.unchanged_files = [];

this.wattsi.modifiedFiles.forEach(f => {
this.preview_files.push(new WattsiFile(this, this.wattsi, f));
});
Expand All @@ -235,7 +235,7 @@ class PR {
return Promise.resolve();
}
}

cacheAll() {
function next(files) {
if (files.length) {
Expand All @@ -252,7 +252,7 @@ class PR {
.then(_ => {
if (this.wattsi) { return this.wattsi.cleanup(); }
});
}
}
}

module.exports = PR;
Loading

0 comments on commit f0f3a05

Please sign in to comment.