Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit bb48676

Browse files
committed
Merge pull request #25 from douglasduteil/feat-publisher
Feat publisher
2 parents edb4fa1 + 588f6f1 commit bb48676

File tree

11 files changed

+170
-95
lines changed

11 files changed

+170
-95
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
bower_components/
22
node_modules/
3+
dist/
4+
out/

.jshintrc

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
{
2-
"immed": true,
3-
"newcap": true,
4-
"noarg": true,
5-
"noempty": true,
6-
"nonew": true,
7-
"trailing": true,
8-
"maxlen": 200,
92
"boss": true,
3+
"browser": true,
104
"eqnull": true,
115
"expr": true,
126
"globalstrict": true,
7+
"immed": true,
138
"laxbreak": true,
149
"loopfunc": true,
10+
"newcap": true,
11+
"noarg": true,
12+
"noempty": true,
13+
"nonew": true,
14+
"quotmark": true,
15+
"smarttabs": true,
1516
"sub": true,
17+
"trailing": true,
1618
"undef": true,
17-
"browser": true,
18-
"quotmark": true,
19+
"unused": true,
1920
"globals": {
20-
"module" : false,
21-
"angular" : false,
22-
"require" : false,
23-
"process" : false
21+
"angular": false
2422
}
2523
}

.travis.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
---
22
language: node_js
33
node_js:
4-
- '0.8'
4+
- '0.10'
55
before_install:
66
- export DISPLAY=:99.0
77
- sh -e /etc/init.d/xvfb start
8-
- npm install -g bower grunt-cli
9-
- npm install
8+
- npm install -qg bower grunt-cli
9+
- npm install -q
1010
- bower install --force
1111
- bower install --force
12-
before_script: ./bower_components/angular-ui-docs/.travis/before_script.sh
13-
after_success: ./bower_components/angular-ui-docs/.travis/after_success.sh
14-
branches:
15-
only:
16-
- master
12+
after_success:
13+
- "./node_modules/angular-ui-publisher/travis/authentication.sh || exit 0"
14+
- "grunt dist build:gh-pages publish:gh-pages build:bower publish:bower"
1715
script: grunt
1816
env:
1917
global:

bower.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
},
2222
"devDependencies": {
2323
"angular-mocks": "~1.x",
24-
"angular-ui-bootstrap-bower": "~0.5.0",
25-
"angular-ui-docs": "angular-ui/angular-ui-docs"
24+
"angular-ui-bootstrap-bower": "~0.5.0"
2625
}
2726
}

demo/demo.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<section id="aces" ng-app="doc.ui-ace">
22

33
<!-- =Minimal code
4-
----------------------------------------------------------------------------->
4+
--------------------------------------------------------------------------- -->
55
<div class="row">
66
<div class="span12">
77
<div class="page-header">
@@ -51,7 +51,7 @@ <h1>Minimal code</h1>
5151

5252

5353
<!-- =General options demo
54-
----------------------------------------------------------------------------->
54+
--------------------------------------------------------------------------- -->
5555
<div id="demo-general" class="row">
5656
<div class="span12">
5757
<div class="page-header">
@@ -124,7 +124,7 @@ <h1>General options</h1>
124124
</div>
125125

126126
<!-- =Mode-Changing demo
127-
----------------------------------------------------------------------------->
127+
--------------------------------------------------------------------------- -->
128128
<div id="demo-mode-changing" class="row">
129129
<div class="span12" ng-controller="AceCtrl">
130130
<div class="page-header">

gruntFile.js

Lines changed: 96 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,42 @@
22

33
module.exports = function (grunt) {
44

5-
var _ = grunt.util._;
6-
75
require('load-grunt-tasks')(grunt);
86

97
// Default task.
108
grunt.registerTask('default', ['jshint', 'karma:unit']);
11-
grunt.registerTask('serve', ['karma:continuous', 'watch']);
12-
grunt.registerTask('build-doc', ['uglify', 'copy']);
9+
grunt.registerTask('serve', ['karma:continuous', 'dist', 'build:gh-pages', 'connect:continuous', 'watch']);
10+
grunt.registerTask('dist', ['ngmin', 'uglify']);
11+
12+
13+
// HACK TO ACCESS TO THE COMPONENT-PUBLISHER
14+
function fakeTargetTask(prefix){
15+
return function(){
16+
17+
if (this.args.length !== 1) return grunt.log.fail('Just give the name of the ' + prefix + ' you want like :\ngrunt ' + prefix + ':bower');
18+
19+
var done = this.async();
20+
var spawn = require('child_process').spawn;
21+
spawn('./node_modules/.bin/gulp', [ prefix, '--branch='+this.args[0] ].concat(grunt.option.flags()), {
22+
cwd : './node_modules/angular-ui-publisher',
23+
stdio: 'inherit'
24+
}).on('close', done);
25+
};
26+
}
27+
28+
grunt.registerTask('build', fakeTargetTask('build'));
29+
grunt.registerTask('publish', fakeTargetTask('publish'));
30+
//
31+
1332

1433
var testConfig = function (configFile, customOptions) {
1534
var options = { configFile: configFile, singleRun: true };
1635
var travisOptions = process.env.TRAVIS && { browsers: [ 'Firefox', 'PhantomJS'], reporters: ['dots'] };
1736
return grunt.util._.extend(options, customOptions, travisOptions);
1837
};
1938

20-
// Demo dependencies
21-
var js_dependencies = [
22-
'<%= bower %>/angular-ui-bootstrap-bower/ui-bootstrap-tpls.min.js',
23-
'<%= bower %>/ace-builds/src-min-noconflict/ace.js'
24-
];
25-
2639
// Project configuration.
2740
grunt.initConfig({
28-
bower: 'bower_components',
29-
dist : '<%= bower %>/angular-ui-docs',
3041
pkg: grunt.file.readJSON('package.json'),
3142
meta: {
3243
banner: ['/**',
@@ -35,66 +46,95 @@ module.exports = function (grunt) {
3546
' * @link <%= pkg.homepage %>',
3647
' * @license <%= pkg.license %>',
3748
' */',
38-
''].join('\n'),
39-
view : {
40-
humaName : 'UI Ace',
41-
repoName : 'ui-ace',
42-
demoHTML : grunt.file.read('demo/demo.html'),
43-
demoJS : grunt.file.read('demo/demo.js'),
44-
css: ['assets/css/demo.css'],
45-
js: js_dependencies.concat(['build/ui-ace.min.js'])
46-
}
49+
''].join('\n')
4750
},
51+
4852
watch: {
49-
karma: {
50-
files: ['ui-ace.js', 'demo/**/*.js', 'gruntFile.js'],
51-
tasks: ['jshint', 'karma:unit:run'] //NOTE the :run flag
53+
src: {
54+
files: ['src/*'],
55+
tasks: ['jshint:src', 'karma:unit:run', 'dist', 'build:gh-pages']
56+
},
57+
test: {
58+
files: ['test/*.js'],
59+
tasks: ['jshint:test', 'karma:unit:run']
60+
},
61+
demo: {
62+
files: ['demo/*', 'publish.js'],
63+
tasks: ['jshint', 'build:gh-pages']
64+
},
65+
livereload: {
66+
files: ['out/built/gh-pages/**/*'],
67+
options: { livereload: true }
5268
}
5369
},
70+
5471
karma: {
5572
unit: testConfig('test/karma.conf.js'),
56-
start: {configFile: 'test/karma.conf.js'},
57-
continuous: {configFile: 'test/karma.conf.js', background: true }
73+
server: {configFile: 'test/karma.conf.js'},
74+
continuous: {configFile: 'test/karma.conf.js', background: true }
5875
},
59-
jshint:{
60-
files:['ui-ace.js', 'demo/**/*.js', 'gruntFile.js'],
61-
options: { jshintrc: '.jshintrc' }
76+
77+
connect: {
78+
options: {
79+
base : 'out/built/gh-pages',
80+
open: true,
81+
livereload: true
82+
},
83+
server: { options: { keepalive: true } },
84+
continuous: { options: { keepalive: false } }
6285
},
86+
87+
88+
jshint: {
89+
src: {
90+
files:{ src : ['src/*.js', 'demo/**/*.js'] },
91+
options: { jshintrc: '.jshintrc' }
92+
},
93+
test: {
94+
files:{ src : [ 'test/*.spec.js', 'gruntFile.js'] },
95+
options: grunt.util._.extend({}, grunt.file.readJSON('.jshintrc'), {
96+
node: true,
97+
globals: {
98+
angular: false,
99+
inject: false,
100+
jQuery: false,
101+
102+
jasmine: false,
103+
afterEach: false,
104+
beforeEach: false,
105+
ddescribe: false,
106+
describe: false,
107+
expect: false,
108+
iit: false,
109+
it: false,
110+
spyOn: false,
111+
xdescribe: false,
112+
xit: false
113+
}
114+
})
115+
}
116+
},
117+
63118
uglify: {
64119
options: {banner: '<%= meta.banner %>'},
65120
build: {
66-
files: {
67-
'<%= dist %>/build/<%= meta.view.repoName %>.min.js': ['<%= meta.view.repoName %>.js']
68-
}
121+
expand: true,
122+
cwd: 'dist',
123+
src: ['*.js'],
124+
ext: '.min.js',
125+
dest: 'dist'
69126
}
70127
},
71-
copy: {
128+
129+
ngmin: {
72130
main: {
73-
files: [
74-
{src: ['<%= meta.view.repoName %>.js'], dest: '<%= dist %>/build/<%= meta.view.repoName %>.js', filter: 'isFile'},
75-
{src: ['demo/demo.html'], dest: '<%= dist %>/demos.html', filter: 'isFile'},
76-
{src: ['<%= bower %>/ace-builds/src-min-noconflict/ace.js'], dest: '<%= dist %>/<%= bower %>/ace-builds/src-min-noconflict/ace.js', filter: 'isFile'}
77-
]
78-
},
79-
template : {
80-
options : {processContent : function(content){
81-
return grunt.template.process(content);
82-
}},
83-
files: [
84-
{src: ['<%= dist %>/.tmpl/index.tmpl'], dest: '<%= dist %>/index.html'},
85-
{src: ['demo/demo.css'], dest: '<%= dist %>/assets/css/demo.css'}
86-
]
87-
.concat(
88-
_.map(js_dependencies.concat([
89-
'<%= bower %>/ace-builds/src-min-noconflict/theme-twilight.js',
90-
'<%= bower %>/ace-builds/src-min-noconflict/mode-markdown.js',
91-
'<%= bower %>/ace-builds/src-min-noconflict/mode-scheme.js',
92-
'<%= bower %>/ace-builds/src-min-noconflict/worker-javascript.js'
93-
]), function (f) {
94-
return {src: [f], dest: '<%= dist %>/' + f, filter: 'isFile'};
95-
}))
131+
expand: true,
132+
cwd: 'src',
133+
src: ['*.js'],
134+
dest: 'dist'
96135
}
97136
},
137+
98138
changelog: {
99139
options: {
100140
dest: 'CHANGELOG.md'

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"main": "./ui-ace.js",
1010
"dependencies": {},
1111
"devDependencies": {
12+
"angular-ui-publisher": "~1.x",
1213
"grunt": "~0.4.2",
1314
"grunt-contrib-copy": "~0.4.1",
1415
"grunt-contrib-jshint": "~0.7.2",
@@ -26,7 +27,9 @@
2627
"karma-requirejs": "~0.2.0",
2728
"karma-phantomjs-launcher": "~0.1.1",
2829
"karma": "~0.10.8",
29-
"grunt-conventional-changelog": "~1.0.0"
30+
"grunt-conventional-changelog": "~1.0.0",
31+
"grunt-ngmin": "0.0.3",
32+
"grunt-contrib-connect": "~0.5.0"
3033
},
3134
"scripts": {},
3235
"repository": {

publish.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* jshint node:true */
2+
3+
'use strict';
4+
5+
var fs = require('fs');
6+
var path = require('path');
7+
8+
module.exports = function() {
9+
10+
var js_dependencies =[
11+
'bower_components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.min.js',
12+
'bower_components/ace-builds/src-min-noconflict/ace.js',
13+
];
14+
15+
var css_dependencies = [
16+
'bower_components/ace-builds/src-min-noconflict/theme-twilight.js',
17+
'bower_components/ace-builds/src-min-noconflict/mode-markdown.js',
18+
'bower_components/ace-builds/src-min-noconflict/mode-scheme.js',
19+
'bower_components/ace-builds/src-min-noconflict/worker-javascript.js'
20+
];
21+
22+
function putThemInVendorDir (filepath) {
23+
return 'vendor/' + path.basename(filepath);
24+
}
25+
26+
return {
27+
humaName : 'UI.Ace',
28+
repoName : 'ui-ace',
29+
inlineHTML : fs.readFileSync(__dirname + '/demo/demo.html'),
30+
inlineJS : fs.readFileSync(__dirname + '/demo/demo.js'),
31+
css: css_dependencies.map(putThemInVendorDir).concat(['demo/demo.css']),
32+
js : js_dependencies.map(putThemInVendorDir).concat(['dist/ui-ace.min.js']),
33+
tocopy : css_dependencies.concat(js_dependencies)
34+
};
35+
};
File renamed without changes.

0 commit comments

Comments
 (0)