コード例 #1
0
ファイル: blueprint.js プロジェクト: GreatWizard/ember-cli
  files: function() {
    if (this._files) { return this._files; }

    var filesPath = this.filesPath(this.options);
    if (existsSync(filesPath)) {
      this._files = walkSync(filesPath);
    } else {
      this._files = [];
    }

    return this._files;
  },
コード例 #2
0
ファイル: blueprint.js プロジェクト: YanlongLai/redux-cli
  files() {
    if (this._files) { return this._files; }

    let filesPath = this.filesPath();

    if (fileExists(filesPath)) {
      this._files = walkSync(filesPath);
    } else {
      this._files = [];
    }
    return this._files;
  }
コード例 #3
0
ファイル: index.js プロジェクト: brainshave/broccoli-zetzer
  function init (roots) {
    var partials  = { root: roots.partials, paths: walk_sync(roots.partials) };
    var templates = { root: roots.templates, paths: walk_sync(roots.templates) };

    var process_file = process_file_setup({
      compile:            compile,
      read_header:        _.compose(parse.header, read_file),
      find_closest_match: find_closest_match,
      options: {
        env:       env,
        partials:  partials,
        templates: templates
      }
    });

    return run;

    function run (path) {
      return process_file(path).toString();
    }
  }
コード例 #4
0
ファイル: blueprint.js プロジェクト: 29ddbe4/ember-cli
Blueprint.prototype.files = function() {
  if (this._files) { return this._files; }

  var filesPath = path.join(this.path, 'files');
  if (fs.existsSync(filesPath)) {
    this._files = walkSync(path.join(this.path, 'files'));
  } else {
    this._files = [];
  }

  return this._files;
};
コード例 #5
0
function assertTmpEmpty() {
  if (!fs.existsSync('tmp')) {
    return;
  }

  var paths = walkSync('tmp')
    .filter(function(path) {
      return !path.match(/output\//);
    });

  assert(paths.length === 0, 'tmp/ should be empty after `ember` tasks. Contained: ' + paths.join(EOL));
}
コード例 #6
0
ファイル: addon.js プロジェクト: rodyhaddad/ember-cli
Addon.prototype.shouldCompileTemplates = function() {
  var templateExtensions = this.registry.extensionsForType('template');
  var addonTreePath = path.join(this.root, this.treePaths['addon']);
  var addonTemplatesTreePath = path.join(this.root, this.treePaths['addon-templates']);

  var files = [];

  if (existsSync(addonTreePath)) {
    files = files.concat(walkSync(addonTreePath));
  }

  if (existsSync(addonTemplatesTreePath)) {
    files = files.concat(walkSync(addonTemplatesTreePath));
  }

  var extensionMatcher = new RegExp('(' + templateExtensions.join('|') + ')$');

  return files.some(function(file) {
    return file.match(extensionMatcher);
  });
};
コード例 #7
0
ファイル: blueprint.js プロジェクト: kamalaknn/ember-cli
Blueprint.prototype.files = function() {
  if (this._files) { return this._files; }

  var filesPath = this.filesPath(this.options);
  if (existsSync(filesPath)) {
    this._files = walkSync(filesPath);
  } else {
    this._files = [];
  }

  return this._files;
};
コード例 #8
0
 return assemble(fixturePath('project-simple')).then(({ directory }) => {
   let files = walkSync(directory, { directories: false });
   expect(files).to.deep.equal([
     '.compilerc',
     'ember-electron/electron-forge-config.js',
     'ember-electron/main.js',
     'ember/assets/app.css',
     'ember/assets/app.js',
     'ember/index.html',
     'package.json',
   ]);
 });
コード例 #9
0
ファイル: blueprint-test.js プロジェクト: blia/ember-cli
        .then(function() {
          var actualFiles = walkSync(tmpdir).sort();
          var output = ui.output.trim().split(EOL);

          assert.match(output.shift(), /^installing/);
          assert.match(output.shift(), /identical.* \.ember-cli/);
          assert.match(output.shift(), /identical.* \.gitignore/);
          assert.match(output.shift(), /identical.* foo.txt/);
          assert.match(output.shift(), /identical.* test.txt/);
          assert.equal(output.length, 0);

          assert.deepEqual(actualFiles, basicBlueprintFiles);
        });
コード例 #10
0
ファイル: blueprint-test.js プロジェクト: cleaver/ember-cli
        .then(function() {
          var actualFiles = walkSync('.').sort();
          var output = ui.output.trim().split('\n');

          assert.match(output.shift(), /^installing/);
          assert.match(output.shift(), /create.* .ember-cli/);
          assert.match(output.shift(), /create.* .gitignore/);
          assert.match(output.shift(), /create.* foo.txt/);
          assert.match(output.shift(), /create.* test.txt/);
          assert.equal(output.length, 0);

          assert.deepEqual(actualFiles, basicBlueprintFiles);
        });
コード例 #11
0
 return build.build().then(function(results) {
   var files = walkSync(results.directory);
   var expectactions = [
     'ember-cli-ember-tests/',
     'ember-cli-ember-tests/dep-graph.json',
     'ember-cli-ember-tests/unit/',
     'ember-cli-ember-tests/ember-test.js'
   ];
   expect(builder.env).to.eql('development');
   expectactions.forEach(function(file) {
     expect(files.indexOf(file) > -1).to.eql(false);
   });
 });
コード例 #12
0
  files: function() {
    if (this._files) { return this._files; }

    this._appBlueprint   = this.lookupBlueprint('app');
    var appFiles       = this._appBlueprint.files();

    this.generatePackageJson();
    this.generateBowerJson();

    var addonFiles   = walkSync(path.join(this.path, 'files'));

    return this._files = uniq(appFiles.concat(addonFiles));
  },
コード例 #13
0
ファイル: blueprint-test.js プロジェクト: Hydrog3n/ember-cli
          .then(function() {
            var actualFiles = walkSync(tmpdir).sort();
            var output = ui.output.trim().split('\n');
            assert.match(output.shift(), /^installing/);
            assert.match(output.shift(), /Overwrite.*test.*\?/); // Prompt
            assert.match(output.shift(), /Overwrite.*test.*No, skip/);
            assert.match(output.shift(), /identical.* \.ember-cli/);
            assert.match(output.shift(), /identical.* \.gitignore/);
            assert.match(output.shift(), /skip.* test.txt/);
            assert.equal(output.length, 0);

            assert.deepEqual(actualFiles, basicBlueprintFiles);
          });
コード例 #14
0
        .then(function(results) {
          var outputPath = results.directory;

          var expected = [
            'subdir1/',
            'subdir1/subsubdir1/',
            'subdir1/subsubdir1/foo.png',
            'subdir2/',
            'subdir2/bar.css'
          ];

          expect(walkSync(outputPath)).to.eql(expected);
        });
コード例 #15
0
        .then(function() {
          var actualFiles = walkSync(tmpdir).sort();
          var output = ui.output.trim().split(EOL);

          expect(output.shift()).to.match(/^installing/);
          expect(output.shift()).to.match(/identical.* .ember-cli/);
          expect(output.shift()).to.match(/identical.* .gitignore/);
          expect(output.shift()).to.match(/identical.* bar/);
          expect(output.shift()).to.match(/identical.* foo.txt/);
          expect(output.shift()).to.match(/identical.* test.txt/);
          expect(output.length).to.equal(0);

          expect(actualFiles).to.deep.equal(basicBlueprintFiles);
        });
コード例 #16
0
  _getIncludesForDir: function(dir, prefix) {
    if (fs.existsSync(dir)) {
      let dirname = path.relative(this.project.root, dir);
      let globs = this.parentRegistry.extensionsForType('js').map((extension) => `**/*.${extension}`);

      return walkSync(dir, { directories: false, globs }).map(file => {
        let module = prefix + '/' + file.replace(EXT_RE, '.js');
        this.fileLookup[module] = path.join(dirname, file);
        return module;
      });
    } else {
      return [];
    }
  },
コード例 #17
0
ファイル: rules-test.js プロジェクト: sajt/ember-suave
      .then(function(result) {
        var outputPath = result.directory;

        var files = walkSync(outputPath)
          .filter(function(file) {
            return /jscs-test.js$/.test(file);
          });

        files.forEach(function(file) {
          var contents = fs.readFileSync(path.join(outputPath, file), { encoding: 'utf8' });

          callback(contents);
        });
      });
コード例 #18
0
 return build.build().then(function(results) {
   var files = walkSync(results.directory);
   var expectactions = [
     'dummy/tests/',
     'dummy/tests/dep-graph.json',
     'dummy/tests/unit/',
     'dummy/tests/unit/components/',
     'dummy/tests/unit/components/foo-bar-test.js'
   ];
   expect(builder.env).to.eql('development');
   expectactions.forEach(function(file) {
     expect(files.indexOf(file) > -1).to.eql(true);
   });
 });
コード例 #19
0
ファイル: blueprint-test.js プロジェクト: apkiernan/ember-cli
        .then(function() {

          let actualFiles = walkSync(tmpdir).sort();
          // Prompts contain \n EOL
          // Split output on \n since it will have the same affect as spliting on OS specific EOL
          let output = ui.output.trim().split('\n');
          expect(output.shift()).to.match(/^installing/);
          expect(output.shift()).to.match(/identical.* \.ember-cli/);
          expect(output.shift()).to.match(/identical.* \.gitignore/);
          expect(output.shift()).to.match(/skip.* test.txt/);
          expect(output.length).to.equal(0);

          expect(actualFiles).to.deep.equal(basicBlueprintFiles);
        });
コード例 #20
0
        .then(function(results) {
          var outputPath = results.directory;

          var expected = [
            'subdir1/',
            'subdir1/subsubdir1/',
            'subdir1/subsubdir1/foo.png',
          ];

          expect(walkSync(outputPath)).to.eql(expected);

          // Build again
          return builder.build();
        })
コード例 #21
0
ファイル: index.js プロジェクト: frekw/broccoli-merge-trees
  return mapSeries(this.inputTrees, readTree).then(function (treePaths) {
    for (var i = treePaths.length - 1; i >= 0; i--) {
      var treeContents = walkSync(treePaths[i])
      treeContents = treeContents.map(toLowerCase)

      var fileIndex
      for (var j = 0; j < treeContents.length; j++) {
        var relativePath = treeContents[j]
        var destPath = destDir + '/' + relativePath
        if (relativePath.slice(-1) === '/') { // is directory
          relativePath = relativePath.slice(0, -1) // chomp "/"
          fileIndex = files[relativePath]
          if (fileIndex != null) {
            throwFileAndDirectoryCollision(relativePath, fileIndex, i)
          }
          if (directories[relativePath] == null) {
            fs.mkdirSync(destPath)
            directories[relativePath] = i
          }
        } else { // is file
          var directoryIndex = directories[relativePath]
          if (directoryIndex != null) {
            throwFileAndDirectoryCollision(relativePath, i, directoryIndex)
          }
          fileIndex = files[relativePath]
          if (fileIndex != null) {
            if (!self.options.overwrite) {
              throw new Error('Merge error: ' +
                'file "' + relativePath + '" exists in ' +
                treePaths[i] + ' and ' + treePaths[fileIndex] + ' - ' +
                'pass option { overwrite: true } to mergeTrees in order ' +
                'to have the latter file win')
            }
            // Else, ignore this file. It is "overwritten" by a file we copied
            // earlier, thanks to reverse iteration over trees
          } else {
            helpers.copyPreserveSync(
              treePaths[i] + '/' + relativePath, destPath)
            files[relativePath] = i
          }
        }
      }
    }

    function throwFileAndDirectoryCollision (relativePath, fileIndex, directoryIndex) {
      throw new Error('Merge error: "' + relativePath +
        '" exists as a file in ' + treePaths[fileIndex] +
        ' but as a directory in ' + treePaths[directoryIndex])
    }
  })
コード例 #22
0
ファイル: init.spec.js プロジェクト: DrMabuse23/angular-cli
  function confirmBlueprinted() {
    var blueprintPath = path.join(root, 'addon', 'ng2', 'blueprints', 'ng2', 'files');
    var expected = walkSync(blueprintPath).sort();
    var actual = walkSync('.').sort();

    forEach(Blueprint.renamedFiles, function (destFile, srcFile) {
      expected[expected.indexOf(srcFile)] = destFile;
    });

    expected.forEach(function (file, index) {
      expected[index] = file.replace(/__name__/g, 'tmp');
      expected[index] = expected[index].replace(/__styleext__/g, 'css');
    });

    removeIgnored(expected);
    removeIgnored(actual);

    expected.sort();

    expect(expected).to.deep.equal(
      actual,
      EOL + ' expected: ' + util.inspect(expected) + EOL + ' but got: ' + util.inspect(actual));
  }
コード例 #23
0
ファイル: index.js プロジェクト: Turbo87/ember-cli-eslint
    return new RSVP.Promise(function(resolve) {
      var files = walkSync(projectRoot, {
        globs: ['**/.jshintrc'],
        ignore: [
          '**/bower_components',
          '**/dist',
          '**/node_modules',
          '**/tmp'
        ]
      });

      ui.stopProgress();
      resolve(files);
    });
コード例 #24
0
ファイル: blueprint-test.js プロジェクト: blia/ember-cli
          .then(function() {
            var actualFiles = walkSync(tmpdir).sort();
            // Prompts contain \n EOL
            // Split output on \n since it will have the same affect as spliting on OS specific EOL
            var output = ui.output.trim().split('\n');
            assert.match(output.shift(), /^installing/);
            assert.match(output.shift(), /Overwrite.*test.*\?/); // Prompt
            assert.match(output.shift(), /Overwrite.*test.*No, skip/);
            assert.match(output.shift(), /identical.* \.ember-cli/);
            assert.match(output.shift(), /identical.* \.gitignore/);
            assert.match(output.shift(), /skip.* test.txt/);
            assert.equal(output.length, 0);

            assert.deepEqual(actualFiles, basicBlueprintFiles);
          });
コード例 #25
0
ファイル: index.js プロジェクト: Turbo87/broccoli-es6modules
  _updateEachFile: function(inDir, outDir){
    // this object is passed through the caching process
    // and populated with newly generated or previously cached
    // values. It becomes the new cache;
    var _newTranspilerCache = {};

    walkSync(inDir)
      .forEach(function(relativePath) {
        if (this._shouldProcessFile(relativePath)) {
          this._handleFile(inDir, outDir, relativePath, _newTranspilerCache);
        }
      }, this);

    this._transpilerCache = _newTranspilerCache;
  },
コード例 #26
0
 return readTree(this.inputTrees[0]).then(function(srcDir){
   var paths = walkSync(srcDir);
   var stubs = {};
   var updateCacheResult;
   paths.forEach(function (relativePath) {
     if (relativePath.slice(-3) === '.js') {
       gatherStubs(srcDir, relativePath, stubs, self.importsCache);
     }
   });
   if (!sameStubs(stubs, self.stubsCache)) {
     self.stubsCache = stubs;
     updateCacheResult = self.updateCache(srcDir, self.getCleanCacheDir());
   }
   return updateCacheResult;
 }).then(function(){
コード例 #27
0
ファイル: index.js プロジェクト: vire/broccoli-filter
  return readTree(this.inputTree).then(function (srcDir) {
    var paths = walkSync(srcDir)

    return mapSeries(paths, function (relativePath) {
      if (relativePath.slice(-1) === '/') {
        mkdirp.sync(destDir + '/' + relativePath)
      } else {
        if (self.canProcessFile(relativePath)) {
          return self.processAndCacheFile(srcDir, destDir, relativePath)
        } else {
          helpers.copyPreserveSync(
            srcDir + '/' + relativePath, destDir + '/' + relativePath)
        }
      }
    })
  })
コード例 #28
0
ファイル: profile.js プロジェクト: vinchu/rxdb
const run = async () => {
    const configPath = path.join(__dirname, '../config');
    const files = walkSync(configPath);
    const isolateFile = files.find(name => name.startsWith('isolate-'));
    if (!isolateFile) throw new Error('no isolate-* file found');
    const isolatePath = configPath + '/' + isolateFile;
    const cmd = 'node --prof-process ' + isolatePath + ' > processed.txt';
    if (shell.exec(cmd).code !== 0) {
        console.error('processing ' + isolatePath + ' failed');
        process.exit(1);
    }

    await del.promise([isolatePath]);

    console.log('DONE - open processed.txt');
};
コード例 #29
0
  findFiles() {
    let outputPath = this.outputPath;

    try {
      return walkSync(outputPath, {
        directories: false,
      }).filter(x => x.endsWith('.css') || x.endsWith('.js'))
        .map(x => `${outputPath}/${x}`);
    } catch (e) {
      if (e !== null && typeof e === 'object' && e.code === 'ENOENT') {
        throw new Error(`No asset files found in the path provided: ${outputPath}`);
      } else {
        throw e;
      }
    }
  }
コード例 #30
0
        .then(function() {
          var actualFiles = walkSync(tmpdir).sort();
          var globFiles = glob.sync(path.join('**', 'foo.txt'), {
              cwd: tmpdir,
              dot: true,
              mark: true,
              strict: true
            }).sort();
          var output = ui.output.trim().split(EOL);

          expect(output.shift()).to.match(/^installing/);
          expect(output.shift()).to.match(/create.* foo.txt/);
          expect(output.length).to.equal(0);

          expect(actualFiles).to.deep.equal(globFiles);
        });