diff --git a/.gitignore b/.gitignore index 6686c4c..383201e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ -build/fullcalendar -build/fullcalendar-* +build/out +build/component dist + +# for npm +node_modules + +# for bower +components \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..0561f34 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,320 @@ + +var _ = require('underscore'); + +module.exports = function(grunt) { + + // Load required NPM tasks. + // You must first run `npm install` in the project's root directory to get these dependencies. + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-compress'); + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-watch'); // Very useful for development. See README. + + + // read config files, and combine into one "meta" object + var packageConfig = grunt.file.readJSON('package.json'); + var componentConfig = grunt.file.readJSON('component.json'); + var pluginConfig = grunt.file.readJSON('fullcalendar.jquery.json'); + var meta = _.extend({}, packageConfig, componentConfig, pluginConfig); + + + var config = { // this will eventually get passed to grunt.initConfig + meta: meta, // do this primarily for templating (<%= %>) + + // initialize multitasks + concat: {}, + uglify: {}, + copy: {}, + compress: {}, + clean: {}, + watch: {} // we will add watch tasks whenever we do concats, so files get re-concatenated upon save + }; + + + // files that the demos might need in the distributable + var depFiles = require('./build/deps.js'); + + + /* Important Top-Level Tasks + ----------------------------------------------------------------------------------------------------*/ + + grunt.registerTask('default', 'dist'); // what will be run with a plain old "grunt" command + + grunt.registerTask('dist', 'Create a distributable ZIP file', [ + 'clean:build', + 'submodules', + 'uglify', + 'copy:deps', + 'copy:demos', + 'copy:misc', + 'compress' + ]); + + grunt.registerTask('dev', 'Build necessary files for developing and debugging', 'submodules'); + + grunt.registerTask('submodules', 'Build all FullCalendar submodules', [ + 'main', + 'gcal' + ]); + + + /* Main FullCalendar Submodule + ----------------------------------------------------------------------------------------------------*/ + + grunt.registerTask('main', 'Build the main FullCalendar submodule', [ + 'concat:mainJs', + 'concat:mainCss', + 'concat:mainPrintCss' + ]); + + // JavaScript + + config.concat.mainJs = { + options: { + process: true // replace template variables + }, + src: [ + 'src/intro.js', + 'src/defaults.js', + 'src/main.js', + 'src/Calendar.js', + 'src/Header.js', + 'src/EventManager.js', + 'src/date_util.js', + 'src/util.js', + 'src/basic/MonthView.js', + 'src/basic/BasicWeekView.js', + 'src/basic/BasicDayView.js', + 'src/basic/BasicView.js', + 'src/basic/BasicEventRenderer.js', + 'src/agenda/AgendaWeekView.js', + 'src/agenda/AgendaDayView.js', + 'src/agenda/AgendaView.js', + 'src/agenda/AgendaEventRenderer.js', + 'src/common/View.js', + 'src/common/DayEventRenderer.js', + 'src/common/SelectionManager.js', + 'src/common/OverlayManager.js', + 'src/common/CoordinateGrid.js', + 'src/common/HoverListener.js', + 'src/common/HorizontalPositionCache.js', + 'src/outro.js' + ], + dest: 'build/out/fullcalendar/fullcalendar.js' + }; + + config.watch.mainJs = { + files: config.concat.mainJs.src, + tasks: 'concat:mainJs' + }; + + // CSS + + config.concat.mainCss = { + options: { + process: true // replace template variables + }, + src: [ + 'src/main.css', + 'src/common/common.css', + 'src/basic/basic.css', + 'src/agenda/agenda.css' + ], + dest: 'build/out/fullcalendar/fullcalendar.css' + }; + + config.watch.mainCss = { + files: config.concat.mainCss.src, + tasks: 'concat:mainCss' + }; + + // CSS (for printing) + + config.concat.mainPrintCss = { + options: { + process: true // replace template variables + }, + src: 'src/common/print.css', + dest: 'build/out/fullcalendar/fullcalendar.print.css' + }; + + config.watch.mainPrintCss = { + files: config.concat.mainPrintCss.src, + tasks: 'concat:mainPrintCss' + }; + + + /* Google Calendar Submodule + ----------------------------------------------------------------------------------------------------*/ + + grunt.registerTask('gcal', 'Build the Google Calendar submodule', 'concat:gcalJs'); + + config.concat.gcalJs = { + options: { + process: true // replace template variables + }, + src: 'src/gcal/gcal.js', + dest: 'build/out/fullcalendar/gcal.js' + }; + + config.watch.gcalJs = { + files: config.concat.gcalJs.src, + tasks: 'concat:gcalJs' + }; + + + /* Minify the JavaScript + ----------------------------------------------------------------------------------------------------*/ + + config.uglify.all = { + options: { + preserveComments: 'some' // keep comments starting with /*! + }, + expand: true, + src: 'build/out/fullcalendar/fullcalendar.js', + ext: '.min.js' + } + + + /* Copy Dependencies + ----------------------------------------------------------------------------------------------------*/ + + config.copy.deps = { + expand: true, + flatten: true, + src: depFiles, + dest: 'build/out/jquery/' // all depenencies will go in the jquery/ directory for now + // (because we only have jquery and jquery-ui) + }; + + + /* Demos + ----------------------------------------------------------------------------------------------------*/ + + config.copy.demos = { + options: { + // while copying demo files over, rewrite "); // all dependencies are in jquery/ for now + } + return tags.join("\n"); + } + + + /* Copy Misc Files + ----------------------------------------------------------------------------------------------------*/ + + config.copy.misc = { + src: "*.txt", // licenses and changelog + dest: 'build/out/' + }; + + + /* Create ZIP file + ----------------------------------------------------------------------------------------------------*/ + + config.compress.all = { + options: { + archive: 'dist/<%= meta.name %>-<%= meta.version %>.zip' + }, + expand: true, + cwd: 'build/out/', + src: '**', + dest: '<%= meta.name %>-<%= meta.version %>/' // have a top-level directory in the ZIP file + }; + + + /* Bower Component + ----------------------------------------------------------------------------------------------------*/ + // http://twitter.github.com/bower/ + + grunt.registerTask('component', 'Build the FullCalendar component for the Bower package manager', [ + 'clean:build', + 'submodules', + 'uglify', // we want the minified JS in there + 'copy:component', + 'copy:componentReadme', + 'componentConfig' + ]); + + config.copy.component = { + expand: true, + cwd: 'build/out/fullcalendar/', + src: '**', + dest: 'build/component/', + }; + + config.copy.componentReadme = { + src: 'build/component-readme.md', + dest: 'build/component/readme.md' + }; + + grunt.registerTask('componentConfig', function() { + grunt.file.write( + 'build/component/component.json', + JSON.stringify( + _.extend({}, pluginConfig, componentConfig), // combine the 2 configs + null, // replacer + 2 // indent + ) + ); + }); + + + /* Clean Up Files + ----------------------------------------------------------------------------------------------------*/ + + config.clean.build = [ + 'build/out/*', + 'build/component/*' + ]; + + config.clean.dist = 'dist/*'; + + + + // finally, give grunt the config object... + grunt.initConfig(config); +}; diff --git a/Makefile b/Makefile deleted file mode 100644 index dd96b17..0000000 --- a/Makefile +++ /dev/null @@ -1,112 +0,0 @@ - -SRC_DIR = src -BUILD_DIR = build -DIST_DIR = dist -DEMOS_DIR = demos -OTHER_FILES = \ - changelog.txt \ - MIT-LICENSE.txt \ - GPL-LICENSE.txt - -VER = $$(cat version.txt) -VER_SED = sed s/@VERSION/"${VER}"/ -DATE = $$(git log -1 --pretty=format:%ad) -DATE_SED = sed s/@DATE/"${DATE}"/ - -JQ = $$(sed -nE "s/.*JQUERY[ \t]*=[ \t]*[\"'](.*)[\"'].*/\1/p" "${SRC_DIR}/_loader.js") -JQUI = $$(sed -nE "s/.*JQUERY_UI[ \t]*=[ \t]*[\"'](.*)[\"'].*/\1/p" "${SRC_DIR}/_loader.js") - -DEMO_FILES = $$(cd ${DEMOS_DIR}; find . -mindepth 1 -maxdepth 1 -type f) -DEMO_SUBDIRS = $$(cd ${DEMOS_DIR}; find . -mindepth 1 -maxdepth 1 -type d) -DEMO_RE = ( - - -If you plan to use the drag/drop/resize functionality, you must include jQuery UI draggable and resizable. -You can [download a custom build](http://jqueryui.com/download) or use the bundled files, like so: - - - - - -Somewhere in your javascript you need to initialize a FullCalendar within a pre-existing element. -Here is an example of doing it within an element having an `id` of `calendar`: - - $(document).ready(function() { - - $('#calendar').fullCalendar({ - // your options here - }); - - }); - -To see a full list of all available options, please consult the [FullCalendar documentation »](http://arshaw.com/fullcalendar/docs/) diff --git a/build/compiler.jar b/build/compiler.jar deleted file mode 100644 index 7374f2d..0000000 Binary files a/build/compiler.jar and /dev/null differ diff --git a/build/component-readme.md b/build/component-readme.md new file mode 100644 index 0000000..367bfea --- /dev/null +++ b/build/component-readme.md @@ -0,0 +1,10 @@ + +FullCalendar Component +====================== + +This repo is the official [Bower](http://twitter.github.com/bower/) component endpoint for the +[FullCalendar Project](http://arshaw.com/fullcalendar/). +It is a shim repo that has been generated by running the `grunt component` command in the +main development repo. + +[Visit the development repo](https://github.com/arshaw/fullcalendar) \ No newline at end of file diff --git a/build/deps.js b/build/deps.js new file mode 100644 index 0000000..0a0cfbf --- /dev/null +++ b/build/deps.js @@ -0,0 +1,53 @@ + +/* + * This file defines the JS dependencies required to run a barebones FullCalendar example. + * + * Additionally, if run from Node (i.e. the build system), this file will serve as a module that + * exports the dependency file list. + * + * Additionally, if run from a browser, this file will write a \n"); + } + +} \ No newline at end of file diff --git a/build/externs.js b/build/externs.js deleted file mode 100644 index 30f6635..0000000 --- a/build/externs.js +++ /dev/null @@ -1 +0,0 @@ -var jQuery; diff --git a/component.json b/component.json new file mode 100644 index 0000000..9da237b --- /dev/null +++ b/component.json @@ -0,0 +1,6 @@ +{ + "main": [ + "./fullcalendar.js", + "./fullcalendar.css" + ] +} \ No newline at end of file diff --git a/demos/agenda-views.html b/demos/agenda-views.html index ca7f8c0..0954cf9 100644 --- a/demos/agenda-views.html +++ b/demos/agenda-views.html @@ -1,15 +1,11 @@ - +
- - - + + - - - + + - + + - - - + + -