]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Get rid of the .sh scripts; target all Meteor versions
authorDan Dascalescu <ddascalescu+github@gmail.com>
Sun, 30 Nov 2014 07:15:34 +0000 (23:15 -0800)
committerDan Dascalescu <ddascalescu+github@gmail.com>
Sun, 30 Nov 2014 07:15:34 +0000 (23:15 -0800)
Gruntfile.js
meteor/package.js
meteor/publish.sh [deleted file]
meteor/runtests.sh [deleted file]
package.json

index 5db19b4868408c2319e07d36679c354aa72c0893..1da8fb0cef97b824695a4e871da27ed333bceba5 100644 (file)
@@ -196,19 +196,32 @@ module.exports = function (grunt) {
                 src: ['benchmarks/*.js']
             }
         },
-        shell: {
+        exec: {
+            'meteor-init': {
+                command: [
+                    // Make sure Meteor is installed, per https://meteor.com/install.
+                    // The curl'ed script is safe; takes 2 minutes to read source & check.
+                    'type meteor >/dev/null 2>&1 || { curl https://install.meteor.com/ | sh; }',
+                    // Meteor expects package.js to be in the root directory of
+                    // the checkout, but we already have a package.js for Dojo
+                    'mv package.js package.dojo && cp meteor/package.js .'
+                ].join(';')
+            },
+            'meteor-cleanup': {
+                // remove build files and restore Dojo's package.js
+                command: 'rm -rf ".build.*" versions.json; mv package.dojo package.js'
+            },
             'meteor-test': {
-                command: 'meteor/runtests.sh'
+                command: 'spacejam --mongo-url mongodb:// test-packages ./'
             },
             'meteor-publish': {
-                command: 'meteor/publish.sh'
+                command: 'meteor publish'
             }
         }
 
     });
 
     grunt.loadTasks('tasks');
-    grunt.loadNpmTasks('grunt-shell');
 
     // These plugins provide necessary tasks.
     require('load-grunt-tasks')(grunt);
@@ -223,7 +236,7 @@ module.exports = function (grunt) {
     grunt.registerTask('test:browser', ['concat', 'embedLocales', 'karma:chrome', 'karma:firefox']);
     grunt.registerTask('test:sauce-browser', ['concat', 'embedLocales', 'env:sauceLabs', 'karma:sauce']);
     grunt.registerTask('test:travis-sauce-browser', ['concat', 'embedLocales', 'karma:sauce']);
-    grunt.registerTask('test:meteor', ['shell:meteor-test']);
+    grunt.registerTask('test:meteor', ['exec:meteor-init', 'exec:meteor-test', 'exec:meteor-cleanup']);
 
     // travis build task
     grunt.registerTask('build:travis', [
@@ -236,6 +249,7 @@ module.exports = function (grunt) {
     // Task to be run when releasing a new version
     grunt.registerTask('release', [
         'jshint', 'nodeunit', 'concat', 'embedLocales',
-        'component', 'uglify:main', 'shell:meteor-publish'
+        'component', 'uglify:main',
+        'exec:meteor-init', 'exec:meteor-publish', 'exec:meteor-cleanup'
     ]);
 };
index b52734dc8386022467a4936e6165ea824d8c26a6..108191b244cc0dfa9c6d5c8b33e80647b1330449 100644 (file)
@@ -13,7 +13,7 @@ Package.describe({
 });
 
 Package.onUse(function (api) {
-  api.versionsFrom('METEOR@1.0');
+  api.versionsFrom(['METEOR@0.9.0', 'METEOR@1.0']);
   api.export('moment');
   api.addFiles([
     'moment.js',
diff --git a/meteor/publish.sh b/meteor/publish.sh
deleted file mode 100755 (executable)
index 0b70a68..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/bash
-
-# Publish package on Meteor's Atmosphere.js
-
-# Make sure Meteor is installed, per https://www.meteor.com/install.
-# The curl'ed script is totally safe; takes 2 minutes to read its source and check.
-type meteor >/dev/null 2>&1 || { curl https://install.meteor.com/ | sh; }
-
-# sanity check: make sure we're in the root directory of the checkout
-cd "$( dirname "$0" )/.."
-
-
-cleanup() {
-  # restore package.js for Dojo
-  mv package.dojo package.js
-
-  # temporary build files
-  rm -rf ".build.$PACKAGE_NAME" versions.json
-}
-
-
-# publish separately any package*.js files we have, e.g. package.js, package-compat.js
-for PACKAGE_FILE in meteor/package*.js; do
-
-  # Meteor expects package.js to be in the root directory of the checkout,
-  # but we already have a package.js for Dojo
-  mv package.js package.dojo
-  cp $PACKAGE_FILE ./package.js
-
-  # publish package, creating it if it's the first time we're publishing
-  PACKAGE_NAME=$(grep -i name $PACKAGE_FILE | head -1 | cut -d "'" -f 2)
-  ATMOSPHERE_NAME=${PACKAGE_NAME/://}
-
-  echo "Publishing $PACKAGE_NAME..."
-
-  # attempt to re-publish the package - the most common operation
-  # once the initial release has been made
-  OUTPUT="$( meteor publish 2>&1 )"
-
-  if [ $? -gt 0 ]; then
-    # there was an error
-
-    if [[ "$OUTPUT" =~ "There is no package named" ]]; then
-      # actually this is the first time the package is created,
-      # so pass the special --create flag and congratulate the maintainer
-      echo "Thank you for creating the official Meteor package for this library!"
-      if meteor publish --create; then
-        echo "Please post the following to https://github.com/raix/Meteor-community-discussions/issues/14:
-
---------------------------------------------- 8< --------------------------------------------------------
-
-Happy to announce that I've published the official $PACKAGE_NAME to Atmosphere. Please star!
-https://atmospherejs.com/$ATMOSPHERE_NAME
-
---------------------------------------------- >8 --------------------------------------------------------
-
-"
-      else
-        echo "We got an error. Please post it at https://github.com/raix/Meteor-community-discussions/issues/14"
-        cleanup
-        exit 1
-      fi
-    else
-      # the error wasn't that the package didn't exist, so we need to ask for help
-      echo "We got an error. Please post it at https://github.com/raix/Meteor-community-discussions/issues/14:
---------------------------------------------- 8< --------------------------------------------------------
-$OUTPUT
---------------------------------------------- >8 --------------------------------------------------------
-"
-      cleanup
-      exit 1
-    fi
-  else
-    # no error on the first `meteor publish` attempt
-    echo "$OUTPUT"  # just in case meteor said something interesting
-    echo "Thanks for releasing a new version of $PACKAGE_NAME! You can see it at"
-    echo "https://atmospherejs.com/$ATMOSPHERE_NAME"
-  fi
-
-  cleanup
-
-done
diff --git a/meteor/runtests.sh b/meteor/runtests.sh
deleted file mode 100755 (executable)
index c0e80a3..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-# Test Meteor package before publishing to Atmospherejs.com
-
-# Make sure Meteor is installed, per https://www.meteor.com/install. The curl'ed script is totally safe; takes 2 minutes to read its source and check.
-type meteor >/dev/null 2>&1 || { curl https://install.meteor.com/ | sh; }
-
-# sanity check: make sure we're in the root directory of the checkout
-cd "$( dirname "$0" )/.."
-
-# run tests and delete the temporary package.js even if Ctrl+C is pressed
-int_trap() {
-  echo
-  printf "Tests interrupted. Hopefully you verified in the browser that tests pass?\n\n"
-}
-
-trap int_trap INT
-
-# test any package*.js packages we may have, e.g. package.js, package-compat.js
-for PACKAGE_FILE in meteor/package*.js; do
-
-  PACKAGE_NAME=$(grep -i name $PACKAGE_FILE | head -1 | cut -d "'" -f 2)
-
-  echo "Testing $PACKAGE_NAME..."
-
-  # Meteor expects package.js to be in the root directory of the checkout, but we already have a package.js for Dojo
-  mv package.js package.dojo
-  cp $PACKAGE_FILE ./package.js
-
-  # provide an invalid MONGO_URL so Meteor doesn't bog us down with an empty Mongo database
-  MONGO_URL=mongodb:// meteor test-packages ./
-
-  rm -rf ".build.$PACKAGE_NAME"
-  rm -rf ".build.local-test:$PACKAGE_NAME"
-  rm versions.json 2>/dev/null
-
-  mv package.dojo package.js
-
-done
index fc86e8a4d49a17295b6da4278568d2368e185f53..bf3343defc8f7329ac6c25b9fb32afce6cded016 100644 (file)
         "grunt-karma": "latest",
         "grunt-benchmark": "latest",
         "grunt-string-replace": "latest",
-        "grunt-shell": "latest",
+        "grunt-exec": "latest",
         "load-grunt-tasks": "latest",
         "karma": "latest",
         "karma-chrome-launcher": "latest",
         "karma-firefox-launcher": "latest",
         "karma-nodeunit": "latest",
-        "karma-sauce-launcher": "latest"
+        "karma-sauce-launcher": "latest",
+        "spacejam": "^1.1.1"
     },
     "scripts": {
         "test": "grunt test:node"