Permalink
Browse files

replacing rake with grunt

  • Loading branch information...
delambo committed Mar 18, 2013
1 parent 7a46853 commit 424de4b5de99a05ecf567d1ba8546d80f2a7fe2f
Showing with 338 additions and 245 deletions.
  1. +2 −0 .gitignore
  2. +144 −0 Gruntfile.js
  3. +0 −72 Rakefile
  4. +0 −22 assets.yml
  5. +9 −0 ice-master.min.js
  6. +30 −0 package.json
  7. +146 −145 src/bookmark.js
  8. +7 −6 src/dom.js
View
@@ -1,8 +1,10 @@
dist
+build
*.diff
*.patch
*.bak
*.log
*.swp
.DS_Store
.project
+node_modules
View
@@ -0,0 +1,144 @@
+module.exports = function(grunt) {
+
+ grunt.initConfig({
+
+ pkg: grunt.file.readJSON('package.json'),
+
+ jshint: {
+ src: ['src/**/*.js'],
+ options: {
+ browser: true,
+ indent: 2,
+ white: false,
+ evil: true,
+ regexdash: true,
+ wsh: true,
+ trailing: true,
+ eqnull: true,
+ expr: true,
+ boss: true,
+ node: true,
+ strict: false
+ }
+ },
+
+ qunit: {
+ all: {
+ options: {
+ urls: ['http://localhost:8000/ice/test/test.html']
+ }
+ }
+ },
+
+ connect: {
+ server: {
+ options: {
+ base: '../'
+ }
+ }
+ },
+
+ concat: {
+ options: {
+ stripBanners: true,
+ banner: '//\n' +
+ '// <%= pkg.name %> - v<%= pkg.version %>\n' +
+ '// The MIT License\n' +
+ '// Copyright (c) 2012 The New York Times, CMS Group, Matthew DeLambo <delambo@gmail.com> \n' +
+ '//\n'
+ },
+ dist: {
+ src: ['lib/rangy/rangy-core.js', 'src/polyfills.js', 'src/ice.js', 'src/dom.js', 'src/bookmark.js', 'src/selection.js', 'src/icePlugin.js', 'src/icePluginManager.js', 'src/plugins/IceAddTitlePlugin/IceAddTitlePlugin.js', 'src/plugins/IceCopyPastePlugin/IceCopyPastePlugin.js', 'src/plugins/IceSmartQuotesPlugin/IceSmartQuotesPlugin.js', 'src/plugins/IceEmdashPlugin/IceEmdashPlugin.js'],
+ dest: 'dist/ice.js'
+ }
+ },
+
+ uglify: {
+ options: {
+ preserveComments: false,
+ banner: '//\n' +
+ '// <%= pkg.name %> - v<%= pkg.version %>\n' +
+ '// The MIT License\n' +
+ '// Copyright (c) 2012 The New York Times, CMS Group, Matthew DeLambo <delambo@gmail.com> \n' +
+ '//\n'
+ },
+ ice: {
+ files: {
+ 'dist/ice.min.js': ['lib/rangy/rangy-core.js', 'src/polyfills.js', 'src/ice.js', 'src/dom.js', 'src/bookmark.js', 'src/selection.js', 'src/icePlugin.js', 'src/icePluginManager.js', 'src/plugins/IceAddTitlePlugin/IceAddTitlePlugin.js', 'src/plugins/IceCopyPastePlugin/IceCopyPastePlugin.js', 'src/plugins/IceSmartQuotesPlugin/IceSmartQuotesPlugin.js', 'src/plugins/IceEmdashPlugin/IceEmdashPlugin.js']
+ }
+ },
+ icemaster: {
+ options: {
+ banner: '//\n' +
+ '// <%= pkg.name %> - Master\n' +
+ '// The MIT License\n' +
+ '// Copyright (c) 2012 The New York Times, CMS Group, Matthew DeLambo <delambo@gmail.com>\n' +
+ '//\n'
+ },
+ files: {
+ 'ice-master.min.js': ['lib/rangy/rangy-core.js', 'src/polyfills.js', 'src/ice.js', 'src/dom.js', 'src/bookmark.js', 'src/selection.js', 'src/icePlugin.js', 'src/icePluginManager.js', 'src/plugins/IceAddTitlePlugin/IceAddTitlePlugin.js', 'src/plugins/IceCopyPastePlugin/IceCopyPastePlugin.js', 'src/plugins/IceSmartQuotesPlugin/IceSmartQuotesPlugin.js', 'src/plugins/IceEmdashPlugin/IceEmdashPlugin.js']
+ }
+ },
+ tinyice: {
+ files: {
+ 'dist/ice_editor_plugin.js': 'lib/tinymce/jscripts/tiny_mce/plugins/ice/editor_plugin.js'
+ }
+ },
+ tinysr: {
+ files: {
+ 'dist/sr_editor_plugin.js': 'lib/tinymce/jscripts/tiny_mce/plugins/icesearchreplace/editor_plugin.js'
+ }
+ }
+ },
+
+ compress: {
+ gz: {
+ options: {
+ mode: 'gzip',
+ archive: 'ice.min.gz'
+ },
+ dest: 'dist/',
+ src: 'dist/ice.min.js'
+ },
+ zip: {
+ options: {
+ archive: 'dist/ice_<%= pkg.version %>.zip'
+ },
+ files: [
+ {src: './**', cwd: 'dist/', expand:true}
+ ]
+ }
+ },
+
+ clean: {
+ build: ['dist']
+ }
+ });
+
+ grunt.loadNpmTasks('grunt-contrib-concat');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-qunit');
+ grunt.loadNpmTasks('grunt-contrib-uglify');
+ grunt.loadNpmTasks('grunt-contrib-clean');
+ grunt.loadNpmTasks('grunt-contrib-compress');
+ grunt.loadNpmTasks('grunt-contrib-connect');
+
+ grunt.registerTask('test', ['connect', 'qunit']);
+
+ grunt.registerTask('build', ['clean:build', 'uglify:ice', 'uglify:icemaster', 'concat', 'compress:gz', 'cp', 'compress:zip']);
+
+ grunt.registerTask('cp', function() {
+ cpTinyDir('ice');
+ //grunt.file.delete('dist/ice_editor_plugin.js');
+
+ cpTinyDir('icesearchreplace');
+ //grunt.file.delete('dist/sr_editor_plugin.js');
+ });
+
+ var cpTinyDir = function(dir) {
+ grunt.file.recurse('lib/tinymce/jscripts/tiny_mce/plugins/' + dir + '/', function(abspath, rootdir, subdir, filename) {
+ grunt.file.copy(rootdir + '/' + (subdir ? subdir + '/' : '') + filename,'dist/tinymce/plugins/' + dir + '/' + (subdir ? subdir + '/' : '') + '/' + filename);
+ });
+ };
+
+};
View
@@ -1,72 +0,0 @@
-require 'rubygems'
-require 'jammit'
-require 'fileutils'
-
-#
-# USAGE:
-# rake build
-# With version parameter:
-# rake build[0.5.0]
-#
-
-# Think before you change - this directory is removed!!!
-BUILDDIR = "dist"
-
-# Build with jammit. Copy the license to
-# the top of the build file.
-def build
- FileUtils.rm_rf BUILDDIR, :verbose => true
-
- Jammit.package!({
- :config_path => "assets.yml",
- :output_folder => BUILDDIR
- })
-
- # copy the license to the top of the minified file
- icefile = BUILDDIR + "/ice.min.js"
- File.open(BUILDDIR + "/temp.js","w") do |tempfile|
- tempfile.puts "/**\n" + File.read("LICENSE") + "\n**/"
- tempfile.puts File.read(icefile)
- end
- File.delete(icefile)
- FileUtils.mv BUILDDIR + "/temp.js", icefile
-end
-
-def confMCE
- # Create the mce plugins
- path = BUILDDIR + "/tinymce/plugins/"
- icepath = path + "ice/"
- srpath = path + "icesearchreplace/"
- FileUtils.mkdir_p path
- # Create the ice plugin
- FileUtils.cp_r "lib/tinymce/jscripts/tiny_mce/plugins/ice/", icepath, :verbose => true
- FileUtils.cp BUILDDIR + "/ice.min.js", icepath + 'js/', :verbose => true
- FileUtils.mv icepath + "editor_plugin.js", icepath + "editor_plugin_src.js", :verbose => true
- FileUtils.mv BUILDDIR + "/ice_editor_plugin.js", icepath + "editor_plugin.js", :verbose => true
- FileUtils.rm BUILDDIR + "/ice_editor_plugin.js.gz"
- # Create the icesearchreplace plugin
- FileUtils.cp_r "lib/tinymce/jscripts/tiny_mce/plugins/icesearchreplace/", srpath, :verbose => true
- FileUtils.mv srpath + "editor_plugin.js", srpath + "editor_plugin_src.js", :verbose => true
- FileUtils.mv BUILDDIR + "/sr_editor_plugin.js", srpath + "editor_plugin.js", :verbose => true
- FileUtils.rm BUILDDIR + "/sr_editor_plugin.js.gz"
-end
-
-def confWP
- # Create the WordPress plugin
- path = BUILDDIR + "/wp-plugin/mce-revisions/"
- iceMCEpath = BUILDDIR + '/tinymce/plugins/ice'
- FileUtils.mkdir_p path
- FileUtils.cp_r "wp-plugin/.", path + '.', :verbose => true
- FileUtils.cp_r iceMCEpath, path, :verbose => true
- FileUtils.cp "wp-plugin/ice/css/ice.css", path + "ice/css/", :verbose => true
-end
-
-desc "Build ice and mce plugins."
-task :build, [:version] do |t, args|
- puts "Building version #{args.version} to #{BUILDDIR}/"
- build
- confMCE
- confWP
- # Zip it all up.
- system "zip -r #{BUILDDIR}/ice_#{args.version}.zip #{BUILDDIR}"
-end
View
@@ -1,22 +0,0 @@
-javascript_compressor: closure
-gzip_assets: on
-compress_assets: on
-
-javascripts:
- ice_editor_plugin:
- - lib/tinymce/jscripts/tiny_mce/plugins/ice/editor_plugin.js
- sr_editor_plugin:
- - lib/tinymce/jscripts/tiny_mce/plugins/icesearchreplace/editor_plugin.js
- ice.min:
- - lib/rangy/rangy-core.js
- - src/polyfills.js
- - src/ice.js
- - src/dom.js
- - src/bookmark.js
- - src/selection.js
- - src/icePlugin.js
- - src/icePluginManager.js
- - src/plugins/IceAddTitlePlugin/IceAddTitlePlugin.js
- - src/plugins/IceCopyPastePlugin/IceCopyPastePlugin.js
- - src/plugins/IceSmartQuotesPlugin/IceSmartQuotesPlugin.js
- - src/plugins/IceEmdashPlugin/IceEmdashPlugin.js
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,30 @@
+{
+ "name": "ice",
+ "description": "Track changes in JavaScript.",
+ "version": "0.4.1",
+ "author": "Matthew DeLambo <delambo@gmail.com>",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/nytimes/ice"
+ },
+ "devDependencies": {
+ "grunt-contrib": "~0.4.0",
+ "grunt": "~0.4.0",
+ "grunt-contrib-concat": "~0.1.3",
+ "grunt-contrib-jshint": "~0.2.0",
+ "grunt-contrib-qunit": "~0.2.0",
+ "grunt-contrib-uglify": "~0.1.2",
+ "grunt-contrib-clean": "~0.4.0",
+ "grunt-contrib-compress": "~0.4.1",
+ "grunt-contrib-connect": "~0.2.0"
+ },
+ "bugs": {
+ "url": "http://github.com/nytimes/ice/issues"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "https://github.com/nytimes/ice/blob/master/LICENSE"
+ }
+ ]
+}
Oops, something went wrong.

0 comments on commit 424de4b

Please sign in to comment.