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 = (]*_loader\.js[^>]*><\/script>|)[^<]* -DEMO_SED = sed -nE '1h;1!H;$${;g;s/${DEMO_RE}//g;p;}' - -JS_SED = sed -nE "s/[ \t]*js\([\"'](.*)[\"']\).*/\1/p" -CSS_SED = sed -nE "s/[ \t]*css\([\"'](.*)[\"']\).*/\1/p" - -concat_js = \ - files=$$(cat "$(1)/_loader.js" | ${JS_SED}); \ - if [ -f "$(1)/intro.js" ]; then \ - files="intro.js $$files"; \ - fi; \ - if [ -f "$(1)/outro.js" ]; then \ - files="$$files outro.js"; \ - fi; \ - old=$$PWD; \ - (cd "$(1)"; cat $$files; cd "$$old") \ - | ${VER_SED} \ - | ${DATE_SED} \ - > "$(2)" - -concat_css = \ - files=$$(cat "$(1)/_loader.js" | ${CSS_SED}); \ - if [ "$$files" ]; then \ - old=$$PWD; \ - (cd "$(1)"; cat $$files; cd "$$old") \ - | ${VER_SED} \ - | ${DATE_SED} \ - > "$(2)"; \ - fi - -zip: - @rm -rf ${BUILD_DIR}/fullcalendar - @rm -rf ${BUILD_DIR}/fullcalendar-* - @mkdir -p ${BUILD_DIR}/fullcalendar/fullcalendar/ - - @echo "building core..." - @$(call concat_js,${SRC_DIR},"${BUILD_DIR}/fullcalendar/fullcalendar/fullcalendar.js") - @$(call concat_css,${SRC_DIR},"${BUILD_DIR}/fullcalendar/fullcalendar/fullcalendar.css") - @cat "${SRC_DIR}/common/print.css" \ - | ${VER_SED} \ - | ${DATE_SED} \ - > "${BUILD_DIR}/fullcalendar/fullcalendar/fullcalendar.print.css" - - @echo "compressing core js..." - @java -jar ${BUILD_DIR}/compiler.jar --warning_level VERBOSE --jscomp_off checkTypes --externs build/externs.js \ - --js ${BUILD_DIR}/fullcalendar/fullcalendar/fullcalendar.js \ - > ${BUILD_DIR}/fullcalendar/fullcalendar/fullcalendar.min.js; \ - - @echo "building plugins..." - @for loader in ${SRC_DIR}/*/_loader.js; do \ - dir=`dirname $$loader`; \ - name=`basename $$dir`; \ - $(call concat_js,$$dir,"${BUILD_DIR}/fullcalendar/fullcalendar/$$name.js"); \ - done - - @echo "copying jquery..." - @mkdir -p ${BUILD_DIR}/fullcalendar/jquery - @cp lib/${JQ} ${BUILD_DIR}/fullcalendar/jquery - @cp lib/${JQUI} ${BUILD_DIR}/fullcalendar/jquery - - @echo "building demos..." - @mkdir -p ${BUILD_DIR}/fullcalendar/demos - @for f in ${DEMO_FILES}; do \ - cat ${DEMOS_DIR}/$$f \ - | ${DEMO_SED} \ - | sed "s/jquery\.js/${JQ}/" \ - | sed "s/jquery-ui\.js/${JQUI}/" \ - > ${BUILD_DIR}/fullcalendar/demos/$$f; \ - done - @for d in ${DEMO_SUBDIRS}; do \ - cp -r ${DEMOS_DIR}/$$d ${BUILD_DIR}/fullcalendar/demos/$$d; \ - done - - @echo "copying other files..." - @cp -r ${OTHER_FILES} ${BUILD_DIR}/fullcalendar - - @echo "zipping..." - @mv ${BUILD_DIR}/fullcalendar ${BUILD_DIR}/fullcalendar-${VER} - @cd ${BUILD_DIR}; for f in fullcalendar-*; do \ - zip -q -r $$f.zip $$f; \ - done - @mv ${BUILD_DIR}/fullcalendar-${VER} ${BUILD_DIR}/fullcalendar - - @mkdir -p ${DIST_DIR} - @mv ${BUILD_DIR}/fullcalendar-${VER}.zip ${DIST_DIR} - @echo "done." - -clean: - @rm -rf ${BUILD_DIR}/fullcalendar - @rm -rf ${BUILD_DIR}/fullcalendar-* - @rm -rf ${DIST_DIR}/* - diff --git a/README.mkd b/README.mkd deleted file mode 100644 index 0549822..0000000 --- a/README.mkd +++ /dev/null @@ -1,47 +0,0 @@ - -FullCalendar - Full-sized drag & drop event calendar -==================================================== - -Development and testing ------------------------ - -Modify files in the `src/` directory and test your changes by viewing any of the HTML files -in the `tests/` directory. Each test file exercises a particular aspect of FullCalendar, -so you might want to create your own test file if you are developing a substantial new feature. - -Building from source --------------------- - -You must have a Java runtime environment (accessible by the `java` command) for minification. -Then, run `make zip` and check the `dist/` directory for your newly created ZIP archive. -To start fresh, run the `make clean` command. - -Getting started ---------------- - -Assuming you have downloaded a release, or built your own, you can get started by including the -following dependencies in the <HEAD> of your HTML file: - - - - - -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 @@ - + - - - + + - - - + + - + + - - - + + -