Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldaverill committed Nov 8, 2015
0 parents commit c6381da
Show file tree
Hide file tree
Showing 15 changed files with 339 additions and 0 deletions.
Empty file added README.md
Empty file.
23 changes: 23 additions & 0 deletions anti-gravity.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template name="Constellation_anti_gravity_header">
</template>

<template name="Constellation_anti_gravity_menu">
<div style="text-indent: 8px;"><button>Check Packages</button></div>
</template>

<template name="Constellation_anti_gravity_main">
{{#unless mainContent.error}}
{{#unless mainContent.loading}}
{{#each package in mainContent.packages}}
<strong><a href="https://atmospherejs.com/{{convertPackageName package.packageName}}" target="_blank">{{package.packageName}}</a></strong><br>
App Version: {{package.currentAppVersion}}<br>
Latest Verison: {{package.latestMeteorVersion}}<br>
Publish Date: {{package.publishDate}}<br><br>
{{/each}}
{{else}}
Checking...
{{/unless}}
{{else}}
Theres and error {{mainContent.error}}
{{/unless}}
</template>
47 changes: 47 additions & 0 deletions anti-gravity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
var Constellation = Package["constellation:console"].API;

Constellation.addTab({
name: 'Anti-Gravity',
headerContentTemplate: 'Constellation_anti_gravity_header',
menuContentTemplate: 'Constellation_anti_gravity_menu',
mainContentTemplate: 'Constellation_anti_gravity_main'
});

var mainContent = new ReactiveVar(null);

Template.Constellation_anti_gravity_main.helpers({
mainContent: function() {
return mainContent.get();
},
convertPackageName: function(packageName) {
return packageName.replace(':', '/');
}
});

Template.Constellation_anti_gravity_menu.helpers({
dictionaries: function() {},
selected: function() {
return true;
},
});

Template.Constellation_anti_gravity_menu.events({
'click button': function(evt, tmpl) {
mainContent.set({
loading: true,
});
Meteor.call('fourquet:anti-gravity/package-difference', function(error, result) {
if (error) {
mainContent.set({
error: error,
});
} else {
mainContent.set({
packages: result,
});
}
});
},
});

Meteor.subscribe('atmosPackages');
12 changes: 12 additions & 0 deletions example/.meteor/.finished-upgraders
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file contains information which helps Meteor properly upgrade your
# app when you run 'meteor update'. You should check it into version control
# with your project.

notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
notices-for-facebook-graph-api-2
1.2.0-standard-minifiers-package
1.2.0-meteor-platform-split
1.2.0-cordova-changes
1.2.0-breaking-changes
1 change: 1 addition & 0 deletions example/.meteor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local
7 changes: 7 additions & 0 deletions example/.meteor/.id
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics

1ax9qksihweyuq0ftkl
25 changes: 25 additions & 0 deletions example/.meteor/packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

autopublish
insecure
standard-minifiers
meteor-base
mobile-experience
mongo
blaze-html-templates
session
jquery
tracker
logging
reload
random
ejson
spacebars
check
old-package-tester
fortawesome:fontawesome
fourquet:anti-gravity
2 changes: 2 additions & 0 deletions example/.meteor/platforms
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
server
browser
1 change: 1 addition & 0 deletions example/.meteor/release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[email protected]
76 changes: 76 additions & 0 deletions example/.meteor/versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
aldeed:[email protected]
[email protected]
[email protected]
[email protected]_1
[email protected]
babrahams:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
constellation:[email protected]
dburles:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
fortawesome:[email protected]_2
fourquet:[email protected]
[email protected]
gwendall:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
lai:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
momentjs:[email protected]
[email protected]
[email protected]
[email protected]_1
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
8 changes: 8 additions & 0 deletions example/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<head>
<title>Anti-Gravity Example</title>
</head>

<body>
<h1>Welcome to Anti-Gravity!</h1>
Press <b>Control + C</b> to open Constellation Console.
</body>
1 change: 1 addition & 0 deletions example/packages/fourquet:anti-gravity
13 changes: 13 additions & 0 deletions example/packages/old-package-tester/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Package.describe({
name: 'old-package-tester',
version: '0.0.1',
summary: '',
git: '',
documentation: ''
});

Package.onUse(function(api) {
api.versionsFrom('1.0');
api.use('momentjs:moment');
api.imply('momentjs:moment');
});
36 changes: 36 additions & 0 deletions package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Package.describe({
name: 'fourquet:anti-gravity',
version: '1.0.0',
summary: '',
git: '',
documentation: 'README.md',
debugOnly: true
});

Package.onUse(function(api) {
api.versionsFrom('1.0');
api.use([
'templating',
'session',
'blaze',
'underscore',
'ejson',
'tracker',
'reactive-var',
'reactive-dict',
'constellation:[email protected]',
],
'client');
api.imply('constellation:console');
api.use([
'ddp',
'http',
'[email protected]',
]);

api.addFiles([
'anti-gravity.html',
'anti-gravity.js'
], 'client');
api.addFiles('server.js', 'server');
});
87 changes: 87 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
var fs = Npm.require('fs');
var Future = Npm.require('fibers/future');

Meteor.methods({
'fourquet:anti-gravity/app-package-information': function() {
var filePath = process.env.PWD + '/.meteor/versions';
var packages = [];
var packageNameString = '';
var future = new Future();
fs.exists(filePath, function(exists) {
if (exists) {
fs.readFile(filePath, function(err, data) {
var bufferString = data.toString();
var bufferStringSplit = bufferString.split('\n');
if (bufferStringSplit[bufferStringSplit.length - 1] === '') {
bufferStringSplit.pop();
}
bufferStringSplit.map(function(item) {
packageNameString += (packageNameString === '') ? item.split('@')[0] : ',' + item.split('@')[0];
packages.push(objectify(item));
});
future.return({
packageNameString: packageNameString,
packages: packages,
});
});
}
});
return future.wait();
},
'fourquet:anti-gravity/meteor-package-information': function(packageNameString) {
var url = 'https://atmospherejs.com/a/packages/findByNames?names=' + packageNameString;
var future = new Future();
var result = HTTP.get(url, {
timeout: 30000,
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
},
}, Meteor.bindEnvironment(function(error, result) {
if (error) {
future.throw(error);
} else {
future.return(result.data);
}
}));
return future.wait();
},
'fourquet:anti-gravity/package-difference': function() {
var future = new Future();
Meteor.call('fourquet:anti-gravity/app-package-information', function(error, result) {
if (error) {
future.throw(error);
} else {
future.return(result);
}
});
var appPackageInfo = future.wait();
var meteorPackageInformation = Meteor.call('fourquet:anti-gravity/meteor-package-information', appPackageInfo.packageNameString);
var appPackages = _.reduce(appPackageInfo.packages, function(memo, package) {
return _.extend(memo, package);
}, {});
var packageDifferences = [];
_.each(meteorPackageInformation, function(meteorPackage) {
if (appPackages[meteorPackage.name] &&
appPackages[meteorPackage.name] !==
meteorPackage.latestVersion.version) {
var d = new Date();
d.setTime(meteorPackage.latestVersion.published.$date);
var publishDate = (d.getMonth() + 1) + '/' + d.getDate() + '/' + d.getFullYear();
packageDifferences.push({
packageName: meteorPackage.name,
currentAppVersion: appPackages[meteorPackage.name],
latestMeteorVersion: meteorPackage.latestVersion.version,
publishDate: publishDate,
});
}
});
return packageDifferences;
},
});

function objectify(item) {
var itemSplit = {};
itemSplit[[item.split('@')[0]]] = item.split('@')[1];
return itemSplit;
};

0 comments on commit c6381da

Please sign in to comment.