自动化与Jenkins的coffeescript编译

我在我的一个项目的窗口框中设置了jenkins CI服务器。 有一部分是用Coffeescript编写的。 以前这部分没有循环到构build过程中。 现在需要。

我还没有看到任何jenkins的coffeescript插件,或者在jenkins中构build咖啡标题的主题。

我正在寻找最简单的方法来build立一个jenkins生成包括一个咖啡编译步骤。 最好通过jenkins上的插件,而不是手动在盒子上安装程序。

目前,咖啡脚本是通过像这样的命令编译的

coffee --lint --watch --output "C:\repositories\martha\trunk\bb\app\bin\js/" --compile "C:/repositories/martha/trunk/bb/app/src/" 

在开发框的Node.js命令提示符下

我还注意到,Jenkins有一个node.js插件,您可以在构build步骤中运行脚本。 我不相信我可以使用命令npm install -g coffee-scriptcoffee --compile通过node.js脚本而不是命令行。 虽然我希望我错了。

目前我看到的最好的select是在框中安装node.js,使用npm安装咖啡脚本,然后作为构build步骤运行批处理脚本。 虽然我愿意这样做,但是我想在盒子上less安装手动安装,以便在更多的项目中使用咖啡脚本。

这是我最好的select吗?

值得一提的是,尽pipe我使用node.js来编译coffee-script,node.js本身及其function,对我来说是非常新的。

一种可能的解决scheme是使用extras/coffee-script.js提供的脚本运行编译器。 您必须使用JDK 7或最新的Rhino(JDK 6将不起作用)。 这里是一个简单的Java的CoffeeScript编译器的链接

我会推荐

a)在jenkins上安装nodejs plugin + grunt – > Jenkins与Grunt集成

b)投票最好的指示:)

c)然后用grunt编译咖啡脚本,这也意味着你可以很容易在本地编译咖啡脚本!

咕噜指示 – > http://gruntjs.com/

咕噜咖啡脚本说明 – > https://github.com/gruntjs/grunt-contrib-coffee

基本上你需要一个像这样的Gruntfile.js

 module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg : grunt.file.readJSON('package.json'), coffee: { compile: { files: { 'path/to/result.js': 'path/to/source.coffee', // 1:1 compile 'path/to/another.js': ['path/to/sources/*.coffee', 'path/to/more/*.coffee'] // compile and concat into single file } } } }); grunt.loadNpmTasks('grunt-contrib-coffee'); grunt.registerTask('default', ['grunt-contrib-coffee']); }; 

那么对于jenkinsshell的任务,你只需要这个,运行咕噜,因此咖啡脚本

 npm update grunt