ember-source-machty 1.0.0.pre4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,158 @@
1
+ (function() {
2
+ var Ember = { assert: function() {} };
3
+ // Version: v1.0.0-pre.4-277-g2c0c237
4
+ // Last commit: 2c0c237 (2013-02-21 12:03:23 -0500)
5
+
6
+
7
+ (function() {
8
+ /*global __fail__*/
9
+
10
+ /**
11
+ Ember Debug
12
+
13
+ @module ember
14
+ @submodule ember-debug
15
+ */
16
+
17
+ /**
18
+ @class Ember
19
+ */
20
+
21
+ if ('undefined' === typeof Ember) {
22
+ Ember = {};
23
+
24
+ if ('undefined' !== typeof window) {
25
+ window.Em = window.Ember = Em = Ember;
26
+ }
27
+ }
28
+
29
+ Ember.ENV = 'undefined' === typeof ENV ? {} : ENV;
30
+
31
+ if (!('MANDATORY_SETTER' in Ember.ENV)) {
32
+ Ember.ENV.MANDATORY_SETTER = true; // default to true for debug dist
33
+ }
34
+
35
+ /**
36
+ Define an assertion that will throw an exception if the condition is not
37
+ met. Ember build tools will remove any calls to `Ember.assert()` when
38
+ doing a production build. Example:
39
+
40
+ ```javascript
41
+ // Test for truthiness
42
+ Ember.assert('Must pass a valid object', obj);
43
+ // Fail unconditionally
44
+ Ember.assert('This code path should never be run')
45
+ ```
46
+
47
+ @method assert
48
+ @param {String} desc A description of the assertion. This will become
49
+ the text of the Error thrown if the assertion fails.
50
+ @param {Boolean} test Must be truthy for the assertion to pass. If
51
+ falsy, an exception will be thrown.
52
+ */
53
+ Ember.assert = function(desc, test) {
54
+ if (!test) throw new Error("assertion failed: "+desc);
55
+ };
56
+
57
+
58
+ /**
59
+ Display a warning with the provided message. Ember build tools will
60
+ remove any calls to `Ember.warn()` when doing a production build.
61
+
62
+ @method warn
63
+ @param {String} message A warning to display.
64
+ @param {Boolean} test An optional boolean. If falsy, the warning
65
+ will be displayed.
66
+ */
67
+ Ember.warn = function(message, test) {
68
+ if (!test) {
69
+ Ember.Logger.warn("WARNING: "+message);
70
+ if ('trace' in Ember.Logger) Ember.Logger.trace();
71
+ }
72
+ };
73
+
74
+ /**
75
+ Display a debug notice. Ember build tools will remove any calls to
76
+ `Ember.debug()` when doing a production build.
77
+
78
+ ```javascript
79
+ Ember.debug("I'm a debug notice!");
80
+ ```
81
+
82
+ @method debug
83
+ @param {String} message A debug message to display.
84
+ */
85
+ Ember.debug = function(message) {
86
+ Ember.Logger.debug("DEBUG: "+message);
87
+ };
88
+
89
+ /**
90
+ Display a deprecation warning with the provided message and a stack trace
91
+ (Chrome and Firefox only). Ember build tools will remove any calls to
92
+ `Ember.deprecate()` when doing a production build.
93
+
94
+ @method deprecate
95
+ @param {String} message A description of the deprecation.
96
+ @param {Boolean} test An optional boolean. If falsy, the deprecation
97
+ will be displayed.
98
+ */
99
+ Ember.deprecate = function(message, test) {
100
+ if (Ember && Ember.TESTING_DEPRECATION) { return; }
101
+
102
+ if (arguments.length === 1) { test = false; }
103
+ if (test) { return; }
104
+
105
+ if (Ember && Ember.ENV.RAISE_ON_DEPRECATION) { throw new Error(message); }
106
+
107
+ var error;
108
+
109
+ // When using new Error, we can't do the arguments check for Chrome. Alternatives are welcome
110
+ try { __fail__.fail(); } catch (e) { error = e; }
111
+
112
+ if (Ember.LOG_STACKTRACE_ON_DEPRECATION && error.stack) {
113
+ var stack, stackStr = '';
114
+ if (error['arguments']) {
115
+ // Chrome
116
+ stack = error.stack.replace(/^\s+at\s+/gm, '').
117
+ replace(/^([^\(]+?)([\n$])/gm, '{anonymous}($1)$2').
118
+ replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm, '{anonymous}($1)').split('\n');
119
+ stack.shift();
120
+ } else {
121
+ // Firefox
122
+ stack = error.stack.replace(/(?:\n@:0)?\s+$/m, '').
123
+ replace(/^\(/gm, '{anonymous}(').split('\n');
124
+ }
125
+
126
+ stackStr = "\n " + stack.slice(2).join("\n ");
127
+ message = message + stackStr;
128
+ }
129
+
130
+ Ember.Logger.warn("DEPRECATION: "+message);
131
+ };
132
+
133
+
134
+
135
+ /**
136
+ Display a deprecation warning with the provided message and a stack trace
137
+ (Chrome and Firefox only) when the wrapped method is called.
138
+
139
+ Ember build tools will not remove calls to `Ember.deprecateFunc()`, though
140
+ no warnings will be shown in production.
141
+
142
+ @method deprecateFunc
143
+ @param {String} message A description of the deprecation.
144
+ @param {Function} func The function to be deprecated.
145
+ */
146
+ Ember.deprecateFunc = function(message, func) {
147
+ return function() {
148
+ Ember.deprecate(message);
149
+ return func.apply(this, arguments);
150
+ };
151
+ };
152
+
153
+ })();
154
+
155
+
156
+ exports.precompile = Ember.Handlebars.precompile;
157
+ exports.EmberHandlebars = Ember.Handlebars;
158
+ })();