Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Reorganize repo and automate release process #61

Merged
merged 10 commits into from
Mar 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
node_modules
tmp
.idea
*.iml
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js
node_js:
- "0.10"
notifications:
email:
- kodnous@linkedin.com
- tlindvall@linkedin.com
before_install:
- npm install -g grunt-cli
9 changes: 7 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ CSS is compiled using [LESS](http://lesscss.org/).

Compiling
=========
Hopscotch uses Grunt for minification and hinting. Make sure you have [`npm`](https://npmjs.org) installed. Run `npm install` from the hopscotch directory to load in the dev dependencies, then run `grunt`.
Hopscotch uses Grunt for build and testing. You need to have [`npm`](https://npmjs.org) and [Grunt CLI](http://gruntjs.com/getting-started) installed.
* Run `npm install` from the hopscotch directory to load in the dev dependencies
* Install Grunt CLI by running `npm install -g grunt-cli`
* Then run `grunt` or `grunt test` to jshint and test code

Testing
=======
Hopscotch tests are written using the [Mocha testing framework](http://visionmedia.github.io/mocha/). The tests can be run either in the browser or via the command line. To run the tests in the browser, simply open up test/index.html. To run the tests in the command line, you can run `grunt test`.
Hopscotch tests are written using the [Mocha testing framework](http://visionmedia.github.io/mocha/).
The tests can be run either in the browser or via the command line.
To run the tests in the browser, simply open up test/index.html. To run the tests in the command line, you can run `grunt test`.
237 changes: 184 additions & 53 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,99 +1,230 @@
module.exports = function(grunt) {
var bannerComment = ['/**!',
'*',
'* Copyright 2013 LinkedIn Corp. All rights reserved.',
'*',
'* Licensed under the Apache License, Version 2.0 (the "License");',
'* you may not use this file except in compliance with the License.',
'* You may obtain a copy of the License at',
'*',
'* http://www.apache.org/licenses/LICENSE-2.0',
'*',
'* Unless required by applicable law or agreed to in writing, software',
'* distributed under the License is distributed on an "AS IS" BASIS,',
'* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
'* See the License for the specific language governing permissions and',
'* limitations under the License.',
'*/\n'].join('\n');

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner : ['/**! <%=pkg.name%> - v<%=pkg.version%>',
'*',
'* Copyright 2014 LinkedIn Corp. All rights reserved.',
'*',
'* Licensed under the Apache License, Version 2.0 (the "License");',
'* you may not use this file except in compliance with the License.',
'* You may obtain a copy of the License at',
'*',
'* http://www.apache.org/licenses/LICENSE-2.0',
'*',
'* Unless required by applicable law or agreed to in writing, software',
'* distributed under the License is distributed on an "AS IS" BASIS,',
'* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
'* See the License for the specific language governing permissions and',
'* limitations under the License.',
'*/\n'
].join('\n'),
distName: '<%=pkg.name%>-<%=pkg.version%>',
paths : {
archive : 'archives',
dist: 'dist',
source: 'src',
jsSource: '<%=paths.source%>/js/hopscotch.js',
build: 'tmp',
test: 'test'
},
jshint: {
hopscotch: {
src: ['js/hopscotch-<%= pkg.version %>.js'],
lib: {
src: ['<%=paths.jsSource%>']
},
gruntfile: {
src: ['Gruntfile.js'],
src: ['Gruntfile.js']
},
options: {
curly: true,
eqeqeq: true,
eqnull: true,
browser: true,
jquery: true,
yui: true,
yui: true
}
},
uglify: {
options: {
banner: bannerComment
clean : {
build: ['<%=paths.build%>'],
dist: ['<%=paths.dist%>']
},
copy: {
build: {
files: [
{
src: '<%=paths.jsSource%>',
dest: '<%=paths.build%>/js/hopscotch.js'
},
{
expand: true,
cwd: '<%=paths.source%>/',
src: ['img/*'],
dest: '<%=paths.build%>/'
}
]
},
releaseWithBanner : {
files: [
{
expand: true,
cwd: '<%=paths.build%>/',
src: ['js/*', 'css/*'],
dest: '<%=paths.dist%>/'
}
],
options: {
process: function (content, srcpath) {
return grunt.template.process('<%=banner%>') + content;
}
}
},
release : {
files: [
{
src: 'LICENSE',
dest: '<%=paths.dist%>/LICENSE'
},
{
expand: true,
cwd: '<%=paths.build%>/',
src: ['img/*'],
dest: '<%=paths.dist%>/'
}
]
}
},
uglify: {
build: {
src: 'js/hopscotch-<%= pkg.version %>.js',
dest: 'js/hopscotch-<%= pkg.version %>.min.js'
src: '<%=paths.build%>/js/hopscotch.js',
dest: '<%=paths.build%>/js/hopscotch.min.js'
}
},
less: {
development: {
dev: {
options: {
paths: ['less']
paths: ['<%=paths.source%>/less']
},
files: {
'css/hopscotch-<%= pkg.version %>.css': 'less/hopscotch.less'
'<%=paths.build%>/css/hopscotch.css': '<%=paths.source%>/less/hopscotch.less'
}
},
production: {
prod: {
options: {
paths: ['less'],
yuicompress: true,
banner: bannerComment
cleancss: true,
paths: ['<%=paths.source%>/less']
},
files: {
'css/hopscotch-<%= pkg.version %>.min.css': 'less/hopscotch.less'
'<%=paths.build%>/css/hopscotch.min.css': '<%=paths.source%>/less/hopscotch.less'
}
}
},
watch: {
jsFiles: {
files: ['<%=paths.source%>/**/*', '<%=paths.test%>/**/*'],
tasks: ['test']
}
},
compress: {
distTarBall: {
options: {
archive: '<%=paths.archive%>/<%=distName%>.tar.gz',
mode: 'tgz',
pretty: true
},
files: [
{
expand: true,
cwd: '<%=paths.dist%>',
src: ['**/*'],
dest: '<%=distName%>/'
}
]
},
distZip: {
options: {
archive: '<%=paths.archive%>/<%=distName%>.zip',
mode: 'zip',
pretty: true
},
files: [
{
expand: true,
cwd: '<%=paths.dist%>',
src: ['**/*'],
dest: '<%=distName%>/'
}
]
}
},
mocha : {
test : {
src:['<%=paths.test%>/index.html']
}
},
shell: {
'mocha-phantomjs': {
command: 'mocha-phantomjs test/index.html',
gitAddArchive: {
command: 'git add <%= paths.archive %>',
options: {
stdout: true,
stderr: true
stdout: true
}
}
},
watch: {
jsFiles: {
files: ['js/*.js'],
tasks: ['shell:mocha-phantomjs', 'jshint:hopscotch']
bump: {
options: {
files: ['package.json'],
updateConfigs: ['pkg'],
push: false,
commit: true,
commitFiles: ['-a'],
createTag: true
}
}
});

//external tasks
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-shell');

// Default task(s).
grunt.registerTask('default', ['jshint', 'uglify', 'less', 'shell']);
// Aliasing 'test' task to run Mocha tests
grunt.registerTask('test', 'run mocha-phantomjs', function() {
var done = this.async();
require('child_process').exec('mocha-phantomjs ./test/index.html', function (err, stdout) {
grunt.log.write(stdout);
done(err);
});
});
};
//grunt task aliases
grunt.registerTask(
'build',
'Build hopscotch for testing (jshint, minify js, process less to css)',
['jshint:lib', 'clean:build', 'copy:build', 'uglify:build', 'less']
);
grunt.registerTask(
'test',
'Build hopscotch and run unit tests',
['build','mocha']
);

//release tasks
grunt.registerTask(
'buildRelease',
'Build hopscotch for release (update files in dist directory and create tar.gz and zip archives of the release)',
['test', 'clean:dist', 'copy:releaseWithBanner', 'copy:release', 'compress']
);
grunt.registerTask(
'releasePatch',
'Release patch update to hopscotch (bump patch version, update dist and archives folders, tag release and commit)',
['bump-only:patch', 'buildRelease', 'shell:gitAddArchive', 'bump-commit']
);
grunt.registerTask(
'releaseMinor',
'Release minor update to hopscotch (bump minor version, update dist and archives folders, tag release and commit)',
['bump-only:minor', 'buildRelease', 'shell:gitAddArchive', 'bump-commit']
);

// Default task.
grunt.registerTask(
'default',
'Build hopscotch and run unit tests',
['test']
);
};
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Example Hopscotch tour](/demo/img/screenshot.png)

Hopscotch
Hopscotch [![Build Status](https://api.travis-ci.org/linkedin/hopscotch.png)](http://travis-ci.org/linkedin/hopscotch)
=========
Hopscotch is a framework to make it easy for developers to add product tours to their pages. Hopscotch accepts a tour JSON object as input and provides an API for the developer to control rendering the tour display and managing the tour progress. Seeing is believing, so why not check out a [demo](http://linkedin.github.io/hopscotch)!

Expand Down
Binary file added archives/hopscotch-0.1.3.tar.gz
Binary file not shown.
Binary file added archives/hopscotch-0.1.3.zip
Binary file not shown.
Loading