mirror of https://github.com/RubaXa/Sortable.git
Dan Dascalescu
10 years ago
6 changed files with 88 additions and 0 deletions
@ -1,3 +1,4 @@ |
|||||||
node_modules |
node_modules |
||||||
mock.png |
mock.png |
||||||
.*.sw* |
.*.sw* |
||||||
|
.build* |
||||||
|
@ -0,0 +1,24 @@ |
|||||||
|
var packageName = 'rubaxa:sortable'; |
||||||
|
|
||||||
|
Package.describe({ |
||||||
|
name: packageName, |
||||||
|
summary: 'Sortable (official): minimalist reorderable drag-and-drop lists on modern browsers and touch devices', |
||||||
|
version: '0.5.2', |
||||||
|
git: 'https://github.com/RubaXa/Sortable.git' |
||||||
|
}); |
||||||
|
|
||||||
|
Package.onUse(function (api) { |
||||||
|
api.versionsFrom('0.9.0'); |
||||||
|
api.export('Sortable'); |
||||||
|
api.addFiles([ |
||||||
|
'Sortable.js' |
||||||
|
], 'client' |
||||||
|
); |
||||||
|
}); |
||||||
|
|
||||||
|
Package.onTest(function (api) { |
||||||
|
api.use(packageName, 'client'); |
||||||
|
api.use('tinytest', 'client'); |
||||||
|
|
||||||
|
api.addFiles('meteor/test.js', 'client'); |
||||||
|
}); |
@ -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 |
@ -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 |
||||||
|
|
||||||
|
rm package.js |
@ -0,0 +1,9 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
Tinytest.add('Sortable.is', function (test) { |
||||||
|
var items = document.createElement('ul'); |
||||||
|
items.innerHTML = '<li data-id="one">item 1</li><li data-id="two">item 2</li><li data-id="three">item 3</li>'; |
||||||
|
var sortable = new Sortable(items); |
||||||
|
test.instanceOf(sortable, Sortable, 'Instantiation OK'); |
||||||
|
test.length(sortable.toArray(), 3, 'Three elements'); |
||||||
|
}); |
Loading…
Reference in new issue