Пример #1
0
                IO.exists(__dirname, function(err, exists) {
                    assert.ok(!err);
                    assert.strictEqual(exists, true);

                    IO.exists(__filename + 'non-existing-file', function(err, exists) {
                        assert.ok(!err);
                        assert.strictEqual(exists, false);

                        return callback();
                    });
                });
Пример #2
0
        IO.exists(__dirname, (err, exists) => {
          assert.ok(!err);
          assert.strictEqual(exists, true);

          // eslint-disable-next-line no-path-concat
          IO.exists(__filename + 'non-existing-file', (err, exists) => {
            assert.ok(!err);
            assert.strictEqual(exists, false);

            return callback();
          });
        });
Пример #3
0
        it('verify files and folder can be checked', function(callback) {
            IO.exists(__filename, function(err, exists) {
                assert.ok(!err);
                assert.strictEqual(exists, true);

                IO.exists(__dirname, function(err, exists) {
                    assert.ok(!err);
                    assert.strictEqual(exists, true);

                    IO.exists(__filename + 'non-existing-file', function(err, exists) {
                        assert.ok(!err);
                        assert.strictEqual(exists, false);

                        return callback();
                    });
                });
            });
        });
Пример #4
0
    it('verify files and folder can be checked', callback => {
      IO.exists(__filename, (err, exists) => {
        assert.ok(!err);
        assert.strictEqual(exists, true);

        IO.exists(__dirname, (err, exists) => {
          assert.ok(!err);
          assert.strictEqual(exists, true);

          // eslint-disable-next-line no-path-concat
          IO.exists(__filename + 'non-existing-file', (err, exists) => {
            assert.ok(!err);
            assert.strictEqual(exists, false);

            return callback();
          });
        });
      });
    });
Пример #5
0
/**
 * Check whether a directory has a build-info.json file. This function
 * will recursively check each parent directory as well.
 *
 * @param  {String}     directory                       The directory to get the version information for
 * @param  {Function}   callback                        Standard callback function
 * @param  {Object}     callback.err                    An error that occurred, if any
 * @param  {String}     [callback.buildInfoPath]        The path to the build-info.json file. `null` if no such file could be found
 * @api private
 */
function _getBuildInfoFile(directory, callback) {
    let buildInfoPath = _getBuildInfoFilePath(directory);
    IO.exists(buildInfoPath, function(err, exists) {
        if (err) {
            log.error({
                'directory': directory,
                'err': err
            }, 'Unable to check if a build info file exists');
            return callback(err);
        } else if (exists) {
            return callback(null, buildInfoPath);
        } else {
            let parent = path.dirname(directory);
            if (parent !== directory) {
                return _getBuildInfoFile(parent, callback);
            } else {
                return callback();
            }
        }
    });
}
Пример #6
0
/**
 * Check whether a directory has a build-info.json file
 *
 * @param  {String}     directory           The directory to get the version information for
 * @param  {Function}   callback            Standard callback function
 * @param  {Object}     callback.err        An error that occurred, if any
 * @param  {Boolean}    callback.exists     Whether the build-info.json file exists
 * @api private
 */
function _hasBuildInfoFile(directory, callback) {
    var buildInfoPath = _getBuildInfoFilePath(directory);
    IO.exists(buildInfoPath, callback);
}