我正在开发一个现有项目来替换bower
和yarn
升级angularjs
到1.2.9
1.3.0
我已经让它在我的本地系统上运行,但是jenkins
在运行deploy
grunt 任务时出现文件路径问题时失败,奇怪的是在 jenkins 上它抱怨我的本地路径
Errno::ENOENT on line ["33"] of /var/lib/jenkins/.rvm/gems/ruby-2.3.3/gems/compass-1.0.3/lib/compass/exec/global_options_parser.rb: No such file or directory @ realpath_rec - /home/leonidas
/home/leonidas
是我的本地路径
这是我Gruntfile.js
的
'use strict';
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
var serveStatic = require('serve-static');
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var yeomanConfig = {
app: 'app',
dist: '../public'
};
try {
yeomanConfig.app = require('./package.json').appPath || yeomanConfig.app;
} catch (e) {}
grunt.initConfig({
ngtemplates: {
myApp: {
options: {
base: 'app',
concat: '<%= yeoman.dist %>/scripts/scripts.js'
},
src: ['app/views/**/*.html'],
dest: '.tmp/template.js'
}
},
yeoman: yeomanConfig,
watch: {
all : {
options : { livereload: true },
files: [
'<%= yeoman.app %>/{,*/}*.html',
'{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
'{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
],
tasks: ['jshint']
}
},
connect: {
proxies: [{
context: '/api',
host: '127.0.0.1',
port: 5000,
https: false,
changeOrigin: false
}, {
context: '/public/api',
host: '127.0.0.1',
port: 5000,
https: false,
changeOrigin: false
}, {
context: '/print',
host: '127.0.0.1',
port: 5000,
https: false,
changeOrigin: false
}, {
context: '/users',
host: '127.0.0.1',
port: 5000,
https: false,
changeOrigin: false
}],
livereload: {
options: {
port: 9000,
hostname: '0.0.0.0',
middleware: function () {
return [
require('connect-livereload')(),
proxySnippet,
serveStatic('.tmp'),
serveStatic('test'),
serveStatic(yeomanConfig.app)
];
}
}
},
test: {
options: {
port: 9001,
middleware: function () {
return [
serveStatic('.tmp'),
serveStatic('test')
];
}
}
},
teste2e: {
options: {
port: 9002,
hostname: 'localhost',
middleware: function () {
return [
proxySnippet,
serveStatic('.tmp'),
serveStatic('test'),
serveStatic(yeomanConfig.app)
];
}
}
}
},
open: {
server: {
url: 'http://localhost:<%= connect.livereload.options.port %>'
}
},
clean: {
options: {
force: true
},
dist: ['.tmp', '<%= yeoman.dist %>/*'],
server: '.tmp'
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true
},
dev: {
configFile: 'karma.conf.js',
singleRun: false
},
e2e: {
configFile: 'karma-e2e.conf.js',
singleRun: true
}
},
coffee: {
dist: {
files: {
'.tmp/scripts/coffee.js': '<%= yeoman.app %>/scripts/*.coffee'
}
},
test: {
files: [{
expand: true,
cwd: '.tmp/spec',
src: '*.coffee',
dest: 'test/spec'
}]
}
},
compass: {
dist: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/styles/fonts',
importPath: '<%= yeoman.app %>/components',
relativeAssets: true
}
},
server: {
options: {
debugInfo: true
}
}
},
concat: {
dist: {
files: {
'<%= yeoman.dist %>/scripts/scripts.js': [
'.tmp/scripts/{,*/}*.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
}
}
},
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>'
}
},
rev: {
files: {
src: ['<%= yeoman.dist %>/lib/components.js', '<%= yeoman.dist %>/lib/components-ie8.js', '<%= yeoman.dist %>/lib/components-ie.js', '<%= yeoman.dist %>/scripts/scripts.js', '<%= yeoman.dist %>/styles/main.css']
}
},
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
options: {
dirs: ['<%= yeoman.dist %>']
}
},
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
cssmin: {
dist: {
files: {
'<%= yeoman.dist %>/styles/main.css': [
'.tmp/styles/{,*/}*.css',
'<%= yeoman.app %>/styles/{,*/}*.css'
]
}
}
},
htmlmin: {
dist: {
options: { },
files: [{
expand: true,
cwd: '<%= yeoman.app %>',
src: ['*.html', 'views/*.html'],
dest: '<%= yeoman.dist %>'
}]
}
},
ngmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.dist %>/scripts',
src: '*.js',
dest: '<%= yeoman.dist %>/scripts'
}]
}
},
uglify: {
dist: {
files: {
'<%= yeoman.dist %>/scripts/scripts.js': ['<%= yeoman.dist %>/scripts/*.js']
}
}
},
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,txt}',
'.htaccess',
'fonts/**/*',
'scriptx/**/*',
'lib/**/*',
'images/{,*/}*.{gif,webp,svg}'
]
}]
}
}
});
grunt.registerTask('server', [
'clean:server',
'coffee:dist',
'compass:server',
'configureProxies',
'connect:livereload',
'open',
'watch'
]);
grunt.registerTask('test', [
'clean:server',
'coffee',
'compass',
'connect:test',
'karma:unit'
]);
grunt.registerTask('test-e2e', [
'clean:server',
'coffee',
'compass',
'configureProxies',
'connect:teste2e',
'karma:e2e'
]);
grunt.registerTask('deploy', [
'clean:dist',
'coffee',
'compass:dist',
'useminPrepare',
'imagemin',
'cssmin',
'htmlmin',
'ngtemplates',
'concat',
'ngmin',
'uglify',
'copy',
'rev',
'usemin'
]);
grunt.registerTask('build', [
'clean:dist',
'jshint',
'karma:unit',
'compass:dist',
'useminPrepare',
'imagemin',
'cssmin',
'htmlmin',
'ngtemplates',
'concat',
'ngmin',
'uglify',
'copy',
'rev',
'usemin'
]);
grunt.registerTask('default', ['build']);
};
只是为了澄清我不是前端开发人员,我在做事时正在学习。