Skip to content

Commit

Permalink
Add packaging for Meteor.js
Browse files Browse the repository at this point in the history
  • Loading branch information
zimme committed Nov 27, 2014
1 parent 3f74d08 commit 5673a1a
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
node_modules/
libs/
!libs/jquery-loader.js
.build*
23 changes: 23 additions & 0 deletions meteor/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var fs = Npm.require('fs');
var packageJson = JSON.parse(fs.readFileSync('vide.jquery.json'));
var packageName = 'vodkabears:vide';
var where = 'client';

Package.describe({
git: 'https://github.com/VodkaBears/Vide',
name: packageName,
summary: 'Easy as hell jQuery plugin for video backgrounds',
version: packageJson.version
});

Package.onUse(function(api) {
api.versionsFrom('1.0');
api.use('jquery', where);
api.addFiles('dist/jquery.vide.js', where);
});

Package.onTest(function(api) {
api.use(packageName, where);
api.use('tinytest', where);
api.addFiles('meteor/test.js', where);
});
23 changes: 23 additions & 0 deletions meteor/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
DIR=$( cd "$( dirname "$0" )" && pwd )
cd $DIR/..

# Meteor expects package.js to be in the root directory of the checkout, so copy it there temporarily
cp meteor/package.js ./

# publish package, creating it if it's the first time we're publishing
PACKAGE_NAME=$(grep -i name package.js | head -1 | cut -d "'" -f 2)
PACKAGE_EXISTS=$(meteor search $PACKAGE_NAME 2>/dev/null | wc -l)

if [ $PACKAGE_EXISTS -gt 0 ]; then
meteor publish
else
meteor publish --create
fi

rm package.js
28 changes: 28 additions & 0 deletions meteor/runtests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Test Meteor package before publishing to 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
DIR=$( cd "$( dirname "$0" )" && pwd )
cd $DIR/..

# Meteor expects package.js to be in the root directory of the checkout, so copy it there temporarily
cp meteor/package.js ./

# run tests and delete the temporary package.js even if Ctrl+C is pressed
int_trap() {
echo
echo "Tests interrupted."
}

trap int_trap INT

meteor test-packages ./

PACKAGE_NAME=$(grep -i name package.js | head -1 | cut -d "'" -f 2)
rm -rf ".build.$PACKAGE_NAME"
rm -rf ".build.local-test:$PACKAGE_NAME"
rm versions.json 2>/dev/null

rm package.js
5 changes: 5 additions & 0 deletions meteor/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

Tinytest.add('Instantiation', function(test) {
test.notEqual(jQuery().vide, undefined);
});

0 comments on commit 5673a1a

Please sign in to comment.