Skip to content

Commit b66b67f

Browse files
committed
Update meta stuff. grunt, package, etc.
1 parent 40abcad commit b66b67f

8 files changed

+155
-67
lines changed

Gruntfile.js

Lines changed: 103 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
/*global module:false*/
2+
23
module.exports = function(grunt) {
34

5+
// Path to private settings (used here for user/pwd to rsync to remote site)
6+
7+
8+
// Because I'm lazy
9+
var _ = grunt.util._;
10+
411
// Project configuration.
512
grunt.initConfig({
6-
pkg: grunt.file.readJSON('smooth-scroll.jquery.json'),
713
component: './component.json',
14+
pkg: grunt.file.readJSON('smooth-scroll.jquery.json'),
815
meta: {
9-
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
16+
banner: '/*!<%= "\\n" %>' +
17+
' * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
1018
'<%= grunt.template.today("yyyy-mm-dd") + "\\n" %>' +
11-
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
12-
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
13-
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' +
14-
'<%= "\\n\\n" %>',
15-
version: '\\n \\nvar version = <%= pkg.version %>;\\n'
19+
'<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
20+
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>' +
21+
'<%= "\\n" %>' +
22+
' * Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>' +
23+
' (<%= _.pluck(pkg.licenses, "url").join(", ") %>)' +
24+
'<%= "\\n" %>' + ' */' +
25+
'<%= "\\n\\n" %>'
1626
},
1727
concat: {
1828
all: {
@@ -30,17 +40,30 @@ module.exports = function(grunt) {
3040
'jquery.<%= pkg.name %>.min.js': ['<%= concat.all.dest %>']
3141
},
3242
options: {
33-
preserveComments: false,
34-
banner: '<%= meta.banner %>'
43+
preserveComments: 'some'
3544
}
3645
}
3746
},
3847
watch: {
39-
files: '<config:lint.files>',
40-
tasks: 'lint'
48+
scripts: {
49+
files: '<%= jshint.all %>',
50+
tasks: ['jshint:all']
51+
}
52+
},
53+
shell: {
54+
rsync: {
55+
// command is set by setshell:rsync.
56+
stdout: true
57+
}
58+
},
59+
setshell: {
60+
rsync: {
61+
file: 'gitignore/settings.json',
62+
cmdAppend: '<%= pkg.name %>/'
63+
}
4164
},
4265
jshint: {
43-
files: ['grunt.js', 'src/**/*.js'],
66+
all: ['Gruntfile.js', 'src/**/*.js'],
4467
options: {
4568
curly: true,
4669
// eqeqeq: true,
@@ -57,60 +80,92 @@ module.exports = function(grunt) {
5780
jQuery: true
5881
}
5982
}
83+
},
84+
version: {
85+
patch: {
86+
src: [
87+
'<%= pkg.name %>.jquery.json',
88+
'package.json',
89+
'src/jquery.<%= pkg.name %>.js',
90+
'jquery.<%= pkg.name %>.js'
91+
],
92+
options: {
93+
release: 'patch'
94+
}
95+
},
96+
same: {
97+
src: ['package.json', 'src/jquery.<%= pkg.name %>.js', 'jquery.<%= pkg.name %>.js']
98+
},
99+
bannerPatch: {
100+
src: ['jquery.<%= pkg.name %>.js'],
101+
options: {
102+
prefix: '- v',
103+
release: 'patch'
104+
}
105+
}
60106
}
61107
});
62108

63-
// Default task.
64-
grunt.registerTask('build', ['jshint', 'concat', 'version', 'component', 'uglify']);
109+
grunt.registerMultiTask( 'setshell', 'Set grunt shell commands', function() {
110+
var settings, cmd,
111+
tgt = this.target,
112+
cmdLabel = 'shell.' + tgt + '.command',
113+
file = this.data.file,
114+
append = this.data.cmdAppend || '';
65115

66-
grunt.registerTask( 'component', 'update component.json', function() {
116+
if ( !grunt.file.exists(file) ) {
117+
grunt.warn('File does not exist: ' + file);
118+
}
119+
120+
settings = grunt.file.readJSON(file);
121+
if (!settings[tgt]) {
122+
grunt.warn('No ' + tgt + ' property found in ' + file);
123+
}
124+
125+
cmd = settings[tgt] + append;
126+
grunt.config(cmdLabel, cmd);
127+
grunt.log.writeln( ('Setting ' + cmdLabel + ' to:').cyan );
128+
129+
grunt.log.writeln(cmd);
130+
131+
});
132+
133+
grunt.registerTask( 'deploy', ['setshell:rsync', 'shell:rsync']);
134+
135+
grunt.registerTask( 'component', 'Update component.json', function() {
67136
var comp = grunt.config('component'),
68-
pkg = grunt.config("pkg"),
137+
pkgName = grunt.config('pkg').name,
138+
pkg = grunt.file.readJSON(pkgName + '.jquery.json'),
69139
json = {};
70140

141+
142+
71143
['name', 'version', 'dependencies'].forEach(function(el) {
72144
json[el] = pkg[el];
73145
});
74146

75-
json.main = grunt.config('concat.all.dest');
76-
json.ignore = [
77-
'demo/',
78-
'lib/',
79-
'src/',
80-
'*.json'
81-
];
147+
_.extend(json, {
148+
main: grunt.config('concat.all.dest'),
149+
ignore: [
150+
'demo/',
151+
'lib/',
152+
'src/',
153+
'*.json'
154+
]
155+
});
156+
json.name = 'jquery.' + json.name;
82157

83158
grunt.file.write( comp, JSON.stringify(json, null, 2) );
84-
85159
grunt.log.writeln( "File '" + comp + "' updated." );
86160
});
87161

88-
grunt.registerTask( 'version', 'insert version', function() {
89-
// Concat specified files.
90-
var name = grunt.config('concat.all.dest'),
91-
pkg = grunt.config("pkg"),
92-
compiled = grunt.file.read(name),
93-
version = "version = '" + pkg.version + "'";
94-
95-
// compiled = '/* concatenated files:\n' + this.file.src.join(', ') + '\n*/\n\n' + compiled;
96-
97-
// Embed Version
98-
compiled = compiled.replace( /version = '[^']+'/, version );
99-
// Write concatenated source to file
100-
grunt.file.write( name, compiled );
101-
102-
// Fail task if errors were logged.
103-
if ( this.errorCount ) {
104-
return false;
105-
}
106-
107-
// Otherwise, print a success message.
108-
grunt.log.writeln( "File '" + name + "' created." );
109-
110-
});
162+
grunt.registerTask('build', ['jshint', 'concat', 'version:same', 'component', 'uglify']);
163+
grunt.registerTask('patch', ['jshint', 'concat', 'version:bannerPatch', 'version:patch', 'component', 'uglify']);
164+
grunt.registerTask('default', ['build']);
111165

112166
grunt.loadNpmTasks('grunt-contrib-jshint');
113167
grunt.loadNpmTasks('grunt-contrib-uglify');
114168
grunt.loadNpmTasks('grunt-contrib-concat');
115-
169+
grunt.loadNpmTasks('grunt-version');
170+
grunt.loadNpmTasks('grunt-shell');
116171
};

LICENSE-MIT

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
Copyright (c) 2012 Karl Swedberg
2-
31
Permission is hereby granted, free of charge, to any person
42
obtaining a copy of this software and associated documentation
53
files (the "Software"), to deal in the Software without

component.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
{"name":"smooth-scroll","title":"Smooth Scroll","description":"Easy implementation of smooth scrolling for same-page links","version":"1.4.9","homepage":"https://github.com/kswedberg/jquery-smooth-scroll","author":{"name":"Karl Swedberg","email":"kswedberg@gmail.com","url":"http://www.learningjquery.com/"},"repository":{"type":"git","url":"https://github.com/kswedberg/jquery-smooth-scroll"},"bugs":{"url":"https://github.com/kswedberg/jquery-smooth-scroll/issues"},"licenses":[{"type":"MIT","url":"/blob/master/LICENSE-MIT"}],"dependencies":{"jquery":"~1.3"},"keywords":["scroll","animation"]}
1+
{
2+
"name": "jquery.smooth-scroll",
3+
"version": "1.4.10",
4+
"dependencies": {
5+
"jquery": ">=1.3"
6+
},
7+
"main": "jquery.smooth-scroll.js",
8+
"ignore": [
9+
"demo/",
10+
"lib/",
11+
"src/",
12+
"*.json"
13+
]
14+
}

jquery.smooth-scroll.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
/*! Smooth Scroll - v1.4.9 - 2013-01-21
2-
* https://github.com/kswedberg/jquery-smooth-scroll
3-
* Copyright (c) 2013 Karl Swedberg; Licensed MIT */
1+
/*!
2+
* Smooth Scroll - v1.4.10 - 2013-02-20
3+
* https://github.com/kswedberg/jquery-smooth-scroll
4+
* Copyright (c) 2013 Karl Swedberg
5+
* Licensed MIT (/blob/master/LICENSE-MIT)
6+
*/
47

58
(function($) {
69

7-
var version = '1.4.9',
10+
var version = '1.4.10',
811
defaults = {
912
exclude: [],
1013
excludeWithin:[],

jquery.smooth-scroll.min.js

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "smooth-scroll",
3+
"version": "1.4.10",
4+
"scripts": {
5+
"test": "./node_modules/.bin/grunt"
6+
},
7+
"dependencies": {},
8+
"devDependencies": {
9+
"grunt": "~0.4.0",
10+
"grunt-contrib-jshint": "~0.1.1",
11+
"grunt-contrib-uglify": "~0.1.1",
12+
"grunt-contrib-concat": "~0.1.2",
13+
"grunt-shell": "~0.2",
14+
"grunt-version": "~0.1.1"
15+
}
16+
}

smooth-scroll.jquery.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
22
"name": "smooth-scroll",
3+
"version": "1.4.10",
34
"title": "Smooth Scroll",
45
"description": "Easy implementation of smooth scrolling for same-page links",
5-
"version": "1.4.9",
6-
"homepage": "https://github.com/kswedberg/jquery-smooth-scroll",
76
"author": {
87
"name": "Karl Swedberg",
98
"email": "kswedberg@gmail.com",
@@ -13,17 +12,18 @@
1312
"type": "git",
1413
"url": "https://github.com/kswedberg/jquery-smooth-scroll"
1514
},
16-
"bugs": {
17-
"url": "https://github.com/kswedberg/jquery-smooth-scroll/issues"
18-
},
15+
"homepage": "https://github.com/kswedberg/jquery-smooth-scroll",
16+
"docs": "https://github.com/kswedberg/jquery-smooth-scroll",
17+
"bugs": "https://github.com/kswedberg/jquery-smooth-scroll/issues",
18+
"demo": "http://plugins.learningjquery.com/smooth-scroll/demo/",
1919
"licenses": [
2020
{
2121
"type": "MIT",
22-
"url": "/blob/master/LICENSE-MIT"
22+
"url": "https://github.com/kswedberg/jquery-smooth-scroll/blob/master/LICENSE-MIT"
2323
}
2424
],
2525
"dependencies": {
26-
"jquery": "~1.3"
26+
"jquery": ">=1.3"
2727
},
2828
"keywords": ["scroll", "animation"]
2929
}

src/jquery.smooth-scroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function($) {
22

3-
var version = '@VERSION',
3+
var version = '1.4.10',
44
defaults = {
55
exclude: [],
66
excludeWithin:[],

0 commit comments

Comments
 (0)