Gruntjs 如何使用grunt svninfo配置多个svninfo对象?

Gruntjs 如何使用grunt svninfo配置多个svninfo对象?,gruntjs,Gruntjs,我需要两个不同svn存储库的svninfo对象。应用程序的svn信息应存储在对象svninfo_应用程序中,elstr存储库(外部)的svn信息应存储在svninfo_elstr中: 回购应用程序信息->svninfo_应用程序 回购elstr信息->svninfo_elstr 我的Grunfile.js module.exports = function(grunt) { grunt.initConfig({ svninfo: { options: {

我需要两个不同svn存储库的svninfo对象。应用程序的svn信息应存储在对象svninfo_应用程序中,elstr存储库(外部)的svn信息应存储在svninfo_elstr中:

  • 回购应用程序信息->svninfo_应用程序
  • 回购elstr信息->svninfo_elstr
我的Grunfile.js

module.exports = function(grunt) {
  grunt.initConfig({
    svninfo: {
      options: {
        output: 'svninfo_app',
        cwd: '.'
      },
      elstr: {
        options: {
          output: 'svninfo_elstr',
          cwd: './public/jslib/elstr/2.0.dev'
        }
      }
    },
    svn_export: {
      dev: {
        options: {
          repository: '<%= svninfo_elstr.url %>',
          output: 'deploy/'
        }
      }
    }
  });
  // https://npmjs.org/package/grunt-svninfo
  grunt.loadNpmTasks('grunt-svninfo');
  grunt.loadNpmTasks('grunt-svn-export');      
  // Default task.
  grunt.registerTask('default', ['svninfo','svn_export']);   
};
module.exports = function(grunt) {
  grunt.initConfig({
    svninfo: {
      options: {
        output: 'svninfo_app',
        cwd: '.',
        elstrCwd: './public/jslib/elstr/2.0.dev'
      }
    }
  });

  // https://npmjs.org/package/grunt-svninfo
  grunt.loadNpmTasks('grunt-svninfo');
  // Default task.
  grunt.registerTask('default', ['svninfo','svninfo:svninfo_elstr:elstrCwd']);
};
对象svninfo_elstr未定义。为什么会这样?
如何使用grunt svninfo配置多个svninfo对象?

正如错误消息所说,没有名为
svninfo_elstr
的属性。您的Grunt配置没有任何
svninfo\u elstr
属性

如何使用grunt svninfo配置多个svninfo对象


也许这会有助于更详细地更新你想要完成的内容?例如,没有
的东西会是什么样子?

现在我找到了一个可行的解决方案。下面是Gruntfile.js

module.exports = function(grunt) {
  grunt.initConfig({
    svninfo: {
      options: {
        output: 'svninfo_app',
        cwd: '.'
      },
      elstr: {
        options: {
          output: 'svninfo_elstr',
          cwd: './public/jslib/elstr/2.0.dev'
        }
      }
    },
    svn_export: {
      dev: {
        options: {
          repository: '<%= svninfo_elstr.url %>',
          output: 'deploy/'
        }
      }
    }
  });
  // https://npmjs.org/package/grunt-svninfo
  grunt.loadNpmTasks('grunt-svninfo');
  grunt.loadNpmTasks('grunt-svn-export');      
  // Default task.
  grunt.registerTask('default', ['svninfo','svn_export']);   
};
module.exports = function(grunt) {
  grunt.initConfig({
    svninfo: {
      options: {
        output: 'svninfo_app',
        cwd: '.',
        elstrCwd: './public/jslib/elstr/2.0.dev'
      }
    }
  });

  // https://npmjs.org/package/grunt-svninfo
  grunt.loadNpmTasks('grunt-svninfo');
  // Default task.
  grunt.registerTask('default', ['svninfo','svninfo:svninfo_elstr:elstrCwd']);
};
返回

Running "svninfo" task
SVN info fetched (rev: 5)

Running "svninfo:svninfo_elstr:elstrCwd" (svninfo) task
SVN info fetched (rev: 305)

Done, without errors.
需要注册两个任务:

  • 'svninfo'
    ->使用默认选项将信息返回到对象svninfo_应用程序中
  • 'svninfo:svninfo_elstr:elstrCwd'
    ->使用选项elstrCwd将信息返回到对象svninfo_elstr中
  • 任务svninfo()应创建属性svninfo_elstr。它确实创建了一个属性svninfo_应用程序。但我需要第二个属性,其中包含第二个svn存储库的信息。