Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Changes due to new web site html #66

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/versions-fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ var validate = function (data) {
return dfd.promise;
};

var parentDirRegex = /Parent Directory/i;
var lineRegEx = /<img.*> <a href=\"(.+)\">(.+)<\/a>\s+(\d{2}-\w{3}-\d{4} \d{2}:\d{2})/;
// match lines with [DIR] images, and extract name, href and date/time
var lineRegEx = /<img[^>]* alt=\"\[DIR\]\">[^<]*<a\s+href=\"(.+)\">([^<]+)<\/a>\s*(\d{4}-\d{2}-\d{2} \d{2}:\d{2})/;
var crosswalkPackageNameRegex = /^(\d+\.\d+\.\d+\.\d+)\/$/;

// get all the files after the "Parent Directory" link in a standard
Expand All @@ -85,17 +85,15 @@ var crosswalkPackageNameRegex = /^(\d+\.\d+\.\d+\.\d+)\/$/;
var parseApacheIndex = function (url, content) {
content = content.toString();

// ignore all lines until we get to the first one after
// "Parent Directory"
// go through all lines, and push lineRegEx matches into
// an array
var lines = content.split('\n');
var files = [];

for (var i = 0; i < lines.length; i += 1) {
if (parentDirRegex.test(lines[i])) {
continue;
}
var thisLine = lines[i];

var matches = lines[i].match(lineRegEx);
var matches = thisLine.match(lineRegEx);

if (matches) {
files.push({
Expand Down Expand Up @@ -176,7 +174,7 @@ VersionsFetcher.prototype.getDownloads = function (channel) {
entries = _.select(entries, function (entry) {
entry.version = getVersionString(entry.name);
if (entry.version) {
entry.url = entry.url+"crosswalk-"+entry.version+".zip";
entry.url = entry.url+'crosswalk-'+entry.version+'.zip';
}

// if no version string, don't include this entry
Expand Down