Skip to content

Commit ba6fcfe

Browse files
committed
Merge branch 'master' of https://github.com/ozsay/angular-meteor
2 parents 5aa2331 + 23985e6 commit ba6fcfe

File tree

17 files changed

+5866
-1554
lines changed

17 files changed

+5866
-1554
lines changed

angular-meteor-auth-bundle-min.sh

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Run this script from home folder
2+
3+
# configs variables
4+
NAME=angular-meteor-auth # Set the bundle file name
5+
PACKAGE=angular-meteor-auth
6+
DIST_FOLDER=dist # The folder that the bundled files will be copy in to
7+
8+
# run time variables
9+
PROJECT_ROOT=$(pwd)
10+
DIST_PATH=$PROJECT_ROOT/$DIST_FOLDER
11+
BUNDLER_TEMP="tmp-$NAME-bundler"
12+
BUNDLER_PATH=$DIST_PATH/$BUNDLER_TEMP
13+
# Ansure that the dist folder exists
14+
mkdir -p $DIST_PATH
15+
16+
# Create temp meteor project
17+
rm -rf $BUNDLER_PATH
18+
meteor create $BUNDLER_PATH
19+
cd $BUNDLER_PATH
20+
21+
# Add packages
22+
echo > .meteor/packages # Delete all default packages
23+
PACKAGE_DIRS="$PROJECT_ROOT/packages" meteor add $PACKAGE
24+
25+
# Build the packages
26+
PACKAGE_DIRS=$PROJECT_ROOT/packages meteor build --debug .
27+
tar -zxf $BUNDLER_TEMP.tar.gz
28+
29+
OUTPUT_PATH="$DIST_PATH/$NAME-bundler-output"
30+
PACKAGES_PATH="$DIST_PATH/$BUNDLER_TEMP/bundle/programs/web.browser/packages"
31+
32+
# Create output folder and copy the dependencies files
33+
rm -rf $OUTPUT_PATH
34+
mkdir $OUTPUT_PATH
35+
36+
ls $PACKAGES_PATH
37+
38+
cat "$PACKAGES_PATH/angular-meteor-auth.js" >> $OUTPUT_PATH/$NAME.bundle.js
39+
40+
# Minify
41+
cd $PROJECT_ROOT
42+
npm install uglify-js
43+
./node_modules/.bin/uglifyjs $OUTPUT_PATH/$NAME.bundle.js -o $OUTPUT_PATH/$NAME.bundle.min.js
44+
45+
# Copy the bundled files to the dist folder
46+
cp $OUTPUT_PATH/$NAME.bundle.* $DIST_PATH
47+
48+
# Cleanup
49+
rm -rf $BUNDLER_PATH $OUTPUT_PATH

bundle-min.sh

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ cat "$PACKAGES_PATH/reactive-var.js" >> $OUTPUT_PATH/$NAME.bundle.js
5050

5151
cat "$PACKAGES_PATH/lai_collection-extensions.js" >> $OUTPUT_PATH/$NAME.bundle.js
5252
cat "$PACKAGES_PATH/dburles_mongo-collection-instances.js" >> $OUTPUT_PATH/$NAME.bundle.js
53+
cat "$PACKAGES_PATH/benjamine_jsondiffpatch.js" >> $OUTPUT_PATH/$NAME.bundle.js
5354

5455
cat "$PACKAGES_PATH/angular-meteor-data.js" >> $OUTPUT_PATH/$NAME.bundle.js
5556

dist/angular-meteor-auth.bundle.js

+175
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
//////////////////////////////////////////////////////////////////////////
2+
// //
3+
// This is a generated file. You can view the original //
4+
// source in your browser if your browser supports source maps. //
5+
// Source maps are supported by all recent versions of Chrome, Safari, //
6+
// and Firefox, and by Internet Explorer 11. //
7+
// //
8+
//////////////////////////////////////////////////////////////////////////
9+
10+
11+
(function () {
12+
13+
/* Imports */
14+
var Meteor = Package.meteor.Meteor;
15+
var _ = Package.underscore._;
16+
var Tracker = Package.tracker.Tracker;
17+
var Deps = Package.tracker.Deps;
18+
var Session = Package.session.Session;
19+
var Mongo = Package.mongo.Mongo;
20+
var EJSON = Package.ejson.EJSON;
21+
var check = Package.check.check;
22+
var Match = Package.check.Match;
23+
var LocalCollection = Package.minimongo.LocalCollection;
24+
var Minimongo = Package.minimongo.Minimongo;
25+
var ObserveSequence = Package['observe-sequence'].ObserveSequence;
26+
var ECMAScript = Package.ecmascript.ECMAScript;
27+
var ReactiveVar = Package['reactive-var'].ReactiveVar;
28+
var Accounts = Package['accounts-base'].Accounts;
29+
var AccountsClient = Package['accounts-base'].AccountsClient;
30+
var DiffSequence = Package['diff-sequence'].DiffSequence;
31+
var MongoID = Package['mongo-id'].MongoID;
32+
var babelHelpers = Package['babel-runtime'].babelHelpers;
33+
var Symbol = Package['ecmascript-runtime'].Symbol;
34+
var Map = Package['ecmascript-runtime'].Map;
35+
var Set = Package['ecmascript-runtime'].Set;
36+
var Promise = Package.promise.Promise;
37+
38+
(function(){
39+
40+
///////////////////////////////////////////////////////////////////////////////////////////////
41+
// //
42+
// packages/angular-meteor-auth/angular-meteor-auth.js //
43+
// //
44+
///////////////////////////////////////////////////////////////////////////////////////////////
45+
//
46+
angular.module('angular-meteor.auth', ['angular-meteor']); // 1
47+
///////////////////////////////////////////////////////////////////////////////////////////////
48+
49+
}).call(this);
50+
51+
52+
53+
54+
55+
56+
(function(){
57+
58+
///////////////////////////////////////////////////////////////////////////////////////////////
59+
// //
60+
// packages/angular-meteor-auth/modules/auth.js //
61+
// //
62+
///////////////////////////////////////////////////////////////////////////////////////////////
63+
//
64+
angular.module('angular-meteor.auth').service('$auth', function ($q, $rootScope, $timeout) {
65+
var AngularMeteorAuthentication = (function () { //
66+
function AngularMeteorAuthentication() { // 5
67+
babelHelpers.classCallCheck(this, AngularMeteorAuthentication); //
68+
//
69+
this.accountsPackage = Package['accounts-base']; // 6
70+
//
71+
if (!this.accountsPackage) { // 8
72+
throw new Error('Oops, looks like Accounts-base package is missing! Please add it by running: meteor add accounts-base ');
73+
} //
74+
} //
75+
//
76+
AngularMeteorAuthentication.prototype._autorun = (function () { // 4
77+
function _autorun(fn) { // 13
78+
var comp = Tracker.autorun(function (c) { // 14
79+
fn(c); // 15
80+
if (!c.firstRun) $timeout(angular.noop, 0); // 16
81+
}); //
82+
//
83+
$rootScope.$on('$destroy', function () { // 19
84+
comp.stop(); // 20
85+
}); //
86+
//
87+
return comp; // 23
88+
} //
89+
//
90+
return _autorun; //
91+
})(); //
92+
//
93+
AngularMeteorAuthentication.prototype.waitForUser = (function () { // 4
94+
function waitForUser() { // 26
95+
var deferred = $q.defer(); // 27
96+
//
97+
this._autorun(function () { // 29
98+
if (!Meteor.loggingIn()) { // 30
99+
deferred.resolve(Meteor.user()); // 31
100+
} //
101+
}); //
102+
//
103+
return deferred.promise; // 35
104+
} //
105+
//
106+
return waitForUser; //
107+
})(); //
108+
//
109+
AngularMeteorAuthentication.prototype.requireUser = (function () { // 4
110+
function requireUser() { // 38
111+
var deferred = $q.defer(); // 39
112+
//
113+
this._autorun(function () { // 41
114+
if (!Meteor.loggingIn()) { // 42
115+
if (Meteor.user() == null) { // 43
116+
deferred.reject("AUTH_REQUIRED"); // 44
117+
} else { //
118+
deferred.resolve(Meteor.user()); // 47
119+
} //
120+
} //
121+
}); //
122+
//
123+
return deferred.promise; // 52
124+
} //
125+
//
126+
return requireUser; //
127+
})(); //
128+
//
129+
AngularMeteorAuthentication.prototype.requireValidUser = (function () { // 4
130+
function requireValidUser(validatorFn) { // 55
131+
validatorFn = validatorFn || angular.noop; // 56
132+
//
133+
return this.requireUser().then(function (user) { // 58
134+
var valid = validatorFn(user); // 59
135+
//
136+
if (valid === true) { // 61
137+
return user; // 62
138+
} else if (angular.isString(valid)) { //
139+
return $q.reject(valid); // 65
140+
} else { //
141+
return $q.reject("FORBIDDEN"); // 68
142+
} //
143+
}); //
144+
} //
145+
//
146+
return requireValidUser; //
147+
})(); //
148+
//
149+
return AngularMeteorAuthentication; //
150+
})(); //
151+
//
152+
var instance = new AngularMeteorAuthentication(); // 74
153+
//
154+
angular.extend(this, Object.getPrototypeOf(instance)); // 76
155+
}).run(function ($auth, $rootScope) { //
156+
$auth._autorun(function () { // 79
157+
if (!Meteor.user) return; // 80
158+
//
159+
Object.getPrototypeOf($rootScope).$auth = { // 82
160+
currentUser: Meteor.user(), // 83
161+
currentUserId: Meteor.userId(), // 84
162+
loggingIn: Meteor.loggingIn() // 85
163+
}; //
164+
}); //
165+
}); //
166+
///////////////////////////////////////////////////////////////////////////////////////////////
167+
168+
}).call(this);
169+
170+
171+
/* Exports */
172+
if (typeof Package === 'undefined') Package = {};
173+
Package['angular-meteor-auth'] = {};
174+
175+
})();

dist/angular-meteor-auth.bundle.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)