[gnome-ostree/wip/new-model: 2/12] Remove jsutil



commit a95b02202a7b83c001e60098ebd1695380be6922
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jun 19 13:34:30 2013 -0400

    Remove jsutil
    
    String.prototype.endsWith was one of the first ES6 additions, and
    has been implemented in every major engine. We can depend on it.

 Makefile-ostbuild.am                 |    1 -
 src/js/jsutil.js                     |   23 -----------------------
 src/js/tasks/task-builddisks.js      |    3 +--
 src/js/tasks/task-integrationtest.js |    1 -
 src/js/tasks/task-smoketest.js       |    1 -
 src/js/tasks/testbase.js             |    5 ++---
 src/js/vcs.js                        |    9 ++++-----
 7 files changed, 7 insertions(+), 36 deletions(-)
---
diff --git a/Makefile-ostbuild.am b/Makefile-ostbuild.am
index ea03f2b..175e038 100644
--- a/Makefile-ostbuild.am
+++ b/Makefile-ostbuild.am
@@ -47,7 +47,6 @@ jsostbuild_DATA= \
        src/js/task.js \
        src/js/jsondb.js \
        src/js/jsonutil.js \
-       src/js/jsutil.js \
        src/js/main.js \
        src/js/libqa.js \
        src/js/guestfish.js \
diff --git a/src/js/tasks/task-builddisks.js b/src/js/tasks/task-builddisks.js
index 961a07f..beab37d 100644
--- a/src/js/tasks/task-builddisks.js
+++ b/src/js/tasks/task-builddisks.js
@@ -31,7 +31,6 @@ const BuildUtil = imports.buildutil;
 const LibQA = imports.libqa;
 const VersionedDir = imports.versioneddir;
 const JsonUtil = imports.jsonutil;
-const JSUtil = imports.jsutil;
 const GuestFish = imports.guestfish;
 
 const IMAGE_RETAIN_COUNT = 2;
@@ -88,7 +87,7 @@ const TaskBuildDisks = new Lang.Class({
         for (let targetName in targets) {
             let matched = false;
             for (let i = 0; i < this._onlyTreeSuffixes.length; i++) {
-                if (JSUtil.stringEndswith(targetName, this._onlyTreeSuffixes[i])) {
+                if (targetName.endsWith(this._onlyTreeSuffixes[i])) {
                     matched = true;
                     break;
                 }
diff --git a/src/js/tasks/task-integrationtest.js b/src/js/tasks/task-integrationtest.js
index 8a8d9d2..47a2cc3 100644
--- a/src/js/tasks/task-integrationtest.js
+++ b/src/js/tasks/task-integrationtest.js
@@ -29,7 +29,6 @@ const ProcUtil = imports.procutil;
 const Task = imports.task;
 const TestBase = imports.tasks.testbase;
 const LibQA = imports.libqa;
-const JSUtil = imports.jsutil;
 const JSONUtil = imports.jsonutil;
 
 const TaskIntegrationTest = new Lang.Class({
diff --git a/src/js/tasks/task-smoketest.js b/src/js/tasks/task-smoketest.js
index a75c73f..fab17f0 100644
--- a/src/js/tasks/task-smoketest.js
+++ b/src/js/tasks/task-smoketest.js
@@ -29,7 +29,6 @@ const ProcUtil = imports.procutil;
 const Task = imports.task;
 const TestBase = imports.tasks.testbase;
 const LibQA = imports.libqa;
-const JSUtil = imports.jsutil;
 const JSONUtil = imports.jsonutil;
 
 const TaskSmoketest = new Lang.Class({
diff --git a/src/js/tasks/testbase.js b/src/js/tasks/testbase.js
index dd27d4d..113989c 100644
--- a/src/js/tasks/testbase.js
+++ b/src/js/tasks/testbase.js
@@ -28,7 +28,6 @@ const ArgParse = imports.argparse;
 const ProcUtil = imports.procutil;
 const Task = imports.task;
 const LibQA = imports.libqa;
-const JSUtil = imports.jsutil;
 const JSONUtil = imports.jsonutil;
 
 const TIMEOUT_SECONDS = 10 * 60;
@@ -374,11 +373,11 @@ const TestBase = new Lang.Class({
 
         while ((info = e.next_file(cancellable)) != null) {
             let name = info.get_name();
-            if (name.indexOf('build-') == 0 && JSUtil.stringEndswith(name, '.json')) {
+            if (name.indexOf('build-') == 0 && name.endsWith('.json')) {
                 buildJson = e.get_child(info);
                 continue;
             }
-            if (!JSUtil.stringEndswith(name, '.qcow2'))
+            if (!name.endsWith('.qcow2'))
                 continue;
             disksToTest.push(name);
         }
diff --git a/src/js/vcs.js b/src/js/vcs.js
index 702dc4d..a15b8f8 100644
--- a/src/js/vcs.js
+++ b/src/js/vcs.js
@@ -22,7 +22,6 @@ const GSystem = imports.gi.GSystem;
 
 const ProcUtil = imports.procutil;
 const BuildUtil = imports.buildutil;
-const JSUtil = imports.jsutil;
 
 function getMirrordir(mirrordir, keytype, uri, params) {
     params = Params.parse(params, {prefix: ''});
@@ -188,7 +187,7 @@ function _makeAbsoluteUrl(parent, relpath)
 {
     let origParent = parent;
     let origRelpath = relpath;
-    if (JSUtil.stringEndswith(parent, '/'))
+    if (parent.endsWith('/'))
        parent = parent.substr(0, parent.length - 1);
     let methodIndex = parent.indexOf("://");
     if (methodIndex == -1)
@@ -347,11 +346,11 @@ function _ensureVcsMirrorTarball(mirrordir, name, uri, checksum, cancellable, pa
     }
 
     let decompOpt = null;
-    if (JSUtil.stringEndswith(uri, '.xz'))
+    if (uri.endsWith('.xz'))
        decompOpt = '--xz';
-    else if (JSUtil.stringEndswith(uri, '.bz2'))
+    else if (uri.endsWith('.bz2'))
        decompOpt = '--bzip2';
-    else if (JSUtil.stringEndswith(uri, '.gz'))
+    else if (uri.endsWith('.gz'))
        decompOpt = '--gzip';
     
     // Extract the tarball to our checkout


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]