Example #1
0
 extract.getTarballFileList(tarballPath8, function(err, fileList) {
   assert.ifError(err);
   assert.length(fileList, 3);
   assert.ok(misc.inArray('foo-bar-1.0.8/', fileList));
   assert.ok(misc.inArray('foo-bar-1.0.8/osx-pkg-dmg-create.sh', fileList));
   assert.ok(misc.inArray('foo-bar-1.0.8/updateAuthors.awk', fileList));
   test.fileDelete(tarballPath8);
 });
Example #2
0
 extract.getTarballFileList(tarballPath9, function(err, fileList) {
   assert.ifError(err);
   // Verify that the symlink path was not trasnformed
   assert.ok(fileList.indexOf('../b/file') !== -1);
   assert.length(fileList, 5);
   testUtil.fileDelete(tarballPath9);
   test.finish();
 });
Example #3
0
 extract.getTarballFileList(tarballPath4, function(err, fileList) {
   assert.ifError(err);
   assert.length(fileList, 16);
   for (var i = 0; i < fileList.length; i++) {
     assert.match(fileList[i], /\.\//);
   }
   test.fileDelete(tarballPath4);
 });
Example #4
0
exports['test_ignore_file_changed_err'] = function() {
  test.fileDelete(tarballPath7);
  assert.equal(test.fileExists(tarballPath7), false);
  extract.createTarball(dataPath, dataPath, tarballName7, {deleteIfExists: false, ignoreFileChangedError: true}, function(err) {
    assert.ifError(err);
    assert.equal(test.fileExists(tarballPath7), true);
    test.fileDelete(tarballPath7);
  });
};
Example #5
0
 extract.getTarballFileList(tarballPath5, function(err, fileList) {
   var regexp = new RegExp(sprintf('%s/', rootDirectoryName));
   assert.ifError(err);
   assert.length(fileList, 16);
   for (var i = 0; i < fileList.length; i++) {
     assert.match(fileList[i], regexp);
   }
   test.fileDelete(tarballPath5);
 });
Example #6
0
exports['test_create_tarball_success'] = function() {
  test.fileDelete(tarballPath1);
  assert.equal(test.fileExists(tarballPath1), false);

  extract.createTarball(bundlePath, dataPath, tarballName1, {deleteIfExists: false}, function(err) {
    assert.ifError(err);
    assert.equal(test.fileExists(tarballPath1), true);
    test.fileDelete(tarballPath1);
  });
};
Example #7
0
exports['test_dele_if_exists_option'] = function() {
  test.fileDelete(tarballPath3);
  assert.equal(test.fileExists(tarballPath3), false);

  extract.createTarball(bundlePath, dataPath, tarballName3, {deleteIfExists: false}, function(err) {
    assert.ifError(err);
    assert.equal(test.fileExists(tarballPath3), true);

    extract.createTarball(bundlePath, dataPath, tarballName3, {deleteIfExists: true}, function(err) {
      assert.ifError(err);
      assert.equal(test.fileExists(tarballPath3), true);
      test.fileDelete(tarballPath3);
    });
  });
};
Example #8
0
exports['test_create_tarball_throws_err_upon_existing_file'] = function() {
  test.fileDelete(tarballPath2);
  assert.equal(test.fileExists(tarballPath2), false);

  extract.createTarball(bundlePath, dataPath, tarballName2, {deleteIfExists: false}, function(err) {
    assert.ifError(err);
    assert.equal(test.fileExists(tarballPath2), true);

    extract.createTarball(bundlePath, dataPath, tarballName2, {deleteIfExists: false}, function(err) {
      assert.match(err, /tarball already exists/i);
      assert.equal(test.fileExists(tarballPath2), true);
      test.fileDelete(tarballPath2);
    });
  });
};
Example #9
0
exports['test_exclude_pattern'] = function() {
  test.fileDelete(tarballPath6);
  assert.equal(test.fileExists(tarballPath6), false);

  extract.createTarball(bundlePath, dataPath, tarballName6, {deleteIfExists: false, excludePattern: '*.sh'}, function(err) {
    assert.ifError(err);
    assert.equal(test.fileExists(tarballPath6), true);

    extract.getTarballFileList(tarballPath6, function(err, fileList) {
      assert.ifError(err);
      assert.length(fileList, 14);
      test.fileDelete(tarballPath6);
    });
  });
};
Example #10
0
exports['test_create_tarball_with_symlinks'] = function(test, assert) {
  testUtil.fileDelete(tarballPath9);

  extract.createTarball(bundlePath2, dataPath, tarballName9, {}, function(err) {
    assert.ifError(err);
    assert.equal(testUtil.fileExists(tarballPath9), true);

    extract.getTarballFileList(tarballPath9, function(err, fileList) {
      assert.ifError(err);
      // Verify that the symlink path was not trasnformed
      assert.ok(fileList.indexOf('../b/file') !== -1);
      assert.length(fileList, 5);
      testUtil.fileDelete(tarballPath9);
      test.finish();
    });
 });};
Example #11
0
exports['test_store_in_tarball_name_directory_is_false'] = function() {
  test.fileDelete(tarballPath4);
  assert.equal(test.fileExists(tarballPath4), false);

  extract.createTarball(bundlePath, dataPath, tarballName4, {storeInTarballNameDirectory: false}, function(err) {
    assert.ifError(err);
    assert.equal(test.fileExists(tarballPath4), true);

    extract.getTarballFileList(tarballPath4, function(err, fileList) {
      assert.ifError(err);
      assert.length(fileList, 16);
      for (var i = 0; i < fileList.length; i++) {
        assert.match(fileList[i], /\.\//);
      }
      test.fileDelete(tarballPath4);
    });
  });
};
Example #12
0
exports['test_excludeFile'] = function() {
  test.fileDelete(tarballPath8);
  assert.equal(test.fileExists(tarballPath8), false);

  extract.createTarball(bundlePath, dataPath, tarballName8, {deleteIfExists: false,
                                                             ignoreFileChangedError: true,
                                                             excludeFile: 'data/exclude_file'}, function(err) {
    assert.ifError(err);
    assert.equal(test.fileExists(tarballPath8), true);

    extract.getTarballFileList(tarballPath8, function(err, fileList) {
      assert.ifError(err);
      assert.length(fileList, 3);
      assert.ok(misc.inArray('foo-bar-1.0.8/', fileList));
      assert.ok(misc.inArray('foo-bar-1.0.8/osx-pkg-dmg-create.sh', fileList));
      assert.ok(misc.inArray('foo-bar-1.0.8/updateAuthors.awk', fileList));
      test.fileDelete(tarballPath8);
    });
 });
};
Example #13
0
exports['test_store_in_tarball_name_directory_is_true'] = function() {
  var rootDirectoryName = tarballName5.replace('.tar.gz', '');
  test.fileDelete(tarballPath5);
  assert.equal(test.fileExists(tarballPath5), false);

  extract.createTarball(bundlePath, dataPath, tarballName5, {storeInTarballNameDirectory: true}, function(err) {
    assert.ifError(err);
    assert.equal(test.fileExists(tarballPath5), true);

    extract.getTarballFileList(tarballPath5, function(err, fileList) {
      var regexp = new RegExp(sprintf('%s/', rootDirectoryName));
      assert.ifError(err);
      assert.length(fileList, 16);
      for (var i = 0; i < fileList.length; i++) {
        assert.match(fileList[i], regexp);
      }
      test.fileDelete(tarballPath5);
    });
  });
};
Example #14
0
 extract.createTarball(bundlePath, dataPath, tarballName1, {deleteIfExists: false}, function(err) {
   assert.ifError(err);
   assert.equal(test.fileExists(tarballPath1), true);
   test.fileDelete(tarballPath1);
 });
Example #15
0
 extract.getTarballFileList(tarballPath6, function(err, fileList) {
   assert.ifError(err);
   assert.length(fileList, 14);
   test.fileDelete(tarballPath6);
 });
Example #16
0
 extract.createTarball(dataPath, dataPath, tarballName7, {deleteIfExists: false, ignoreFileChangedError: true}, function(err) {
   assert.ifError(err);
   assert.equal(testUtil.fileExists(tarballPath7), true);
   testUtil.fileDelete(tarballPath7);
   test.finish();
 });
Example #17
0
 extract.createTarball(bundlePath, dataPath, tarballName2, {deleteIfExists: false}, function(err) {
   assert.match(err, /tarball already exists/i);
   assert.equal(test.fileExists(tarballPath2), true);
   test.fileDelete(tarballPath2);
 });
Example #18
0
 extract.createTarball(bundlePath, dataPath, tarballName3, {deleteIfExists: true}, function(err) {
   assert.ifError(err);
   assert.equal(testUtil.fileExists(tarballPath3), true);
   testUtil.fileDelete(tarballPath3);
   test.finish();
 });