ember-appkit-rails 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/templates/application.hbs +569 -5
  3. data/lib/ember-appkit-rails.rb +0 -9
  4. data/lib/ember/appkit/rails.rb +15 -3
  5. data/lib/ember/appkit/rails/active_support.rb +1 -0
  6. data/lib/ember/appkit/rails/active_support/dependencies.rb +10 -0
  7. data/lib/ember/appkit/rails/engine.rb +49 -19
  8. data/lib/ember/appkit/rails/sprockets.rb +1 -0
  9. data/lib/ember/appkit/rails/sprockets/context.rb +10 -0
  10. data/lib/ember/appkit/rails/sprockets/processed_asset.rb +1 -1
  11. data/lib/ember/appkit/rails/template.rb +109 -0
  12. data/lib/ember/appkit/rails/version.rb +1 -1
  13. data/lib/ember/appkit/rails/walker.rb +99 -0
  14. data/lib/generators/ember/bootstrap_generator.rb +16 -8
  15. data/lib/generators/ember/component_generator.rb +1 -1
  16. data/lib/generators/ember/generator_helpers.rb +1 -1
  17. data/lib/generators/ember/model_generator.rb +1 -1
  18. data/lib/generators/ember/resource_generator.rb +3 -4
  19. data/lib/generators/ember/resource_override.rb +21 -0
  20. data/lib/generators/ember/scaffold_controller_override.rb +14 -0
  21. data/lib/generators/ember/scaffold_override.rb +25 -0
  22. data/lib/generators/templates/{adapter.js → adapter.js.erb} +1 -1
  23. data/lib/generators/templates/application.js.erb +0 -1
  24. data/lib/generators/templates/environments/development.js +3 -0
  25. data/lib/generators/templates/environments/production.js +3 -0
  26. data/lib/generators/templates/environments/test.js +3 -0
  27. data/lib/generators/templates/scaffold/template/index.hbs +2 -2
  28. data/lib/generators/templates/scaffold/template/show.hbs +1 -1
  29. data/lib/generators/templates/scaffold_controller/controller.rb +56 -0
  30. data/test/dummy/Gemfile +0 -3
  31. data/test/dummy/app/assets/javascripts/application.js +16 -0
  32. data/test/dummy/app/models/is_a_module/dog.rb +0 -0
  33. data/test/dummy/config/adapter.js.erb +3 -0
  34. data/test/dummy/config/application.js +0 -1
  35. data/test/dummy/config/environments/development.js +3 -0
  36. data/test/dummy/config/environments/production.js +3 -0
  37. data/test/dummy/config/environments/test.js +3 -0
  38. data/test/dummy/config/initializers/secret_token.rb +1 -1
  39. data/test/dummy/log/test.log +47 -12
  40. data/test/dummy/tmp/{ember-rails/ember.js → cache/assets/test/sprockets/012cc56cb3d167247c623ab5a4dd2f8a} +0 -0
  41. data/test/dummy/tmp/cache/assets/test/sprockets/07afa5d8ceda557642e2330ab45eb203 +0 -0
  42. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  43. data/test/dummy/tmp/cache/assets/test/sprockets/1d5975f28925835fe6077b200f4f150f +0 -0
  44. data/test/dummy/tmp/cache/assets/test/sprockets/1f15c49a05b13c3a7ee50d2ac3900f38 +0 -0
  45. data/test/dummy/tmp/{ember-rails/ember-data.js → cache/assets/test/sprockets/352c2af460d03b624ae5652411a463d1} +0 -0
  46. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  47. data/test/dummy/tmp/cache/assets/test/sprockets/4a1d4e32cd7b9fd1c62bfd553ae56051 +0 -0
  48. data/test/dummy/tmp/cache/assets/test/sprockets/{6870da13c3305651063dc22ccce27d5c → 5421e30f80c2b8cdf4379b8dce18bcd3} +0 -0
  49. data/test/dummy/tmp/cache/assets/test/sprockets/645beb565f2e6d67728537e06963533d +0 -0
  50. data/test/dummy/tmp/cache/assets/test/sprockets/660bc633c8899c6c1b20514637fa0169 +0 -0
  51. data/test/dummy/tmp/cache/assets/test/sprockets/67afcba9807cd5e57b80b5fdf9f26758 +0 -0
  52. data/test/dummy/tmp/cache/assets/test/sprockets/{8ebc8c58233ab12eee6edfc0feca2492 → 702dbd08a7eb5e831dd268e0460d97b2} +0 -0
  53. data/test/dummy/tmp/cache/assets/test/sprockets/7ca4966e0a480430a858a7ab74518c75 +0 -0
  54. data/test/dummy/tmp/cache/assets/test/sprockets/827fafc13575b345cc572fd041ef1fba +0 -0
  55. data/test/dummy/tmp/cache/assets/test/sprockets/83af35bb6b852de883a26a9458fd4e3a +0 -0
  56. data/test/dummy/tmp/cache/assets/test/sprockets/9160f792acb62d1f7721c714681fcfe6 +0 -0
  57. data/test/dummy/tmp/cache/assets/test/sprockets/ae884a1acda0e6f9bb27a856a22bb08d +0 -0
  58. data/test/dummy/tmp/cache/assets/test/sprockets/bb4a2293175928af3e23c47488077098 +0 -0
  59. data/test/dummy/tmp/cache/assets/test/sprockets/bf689240392e7355c0de5cfd47272146 +0 -0
  60. data/test/dummy/tmp/cache/assets/test/sprockets/d5a48c6656341c56cac8a8e42bb925a5 +0 -0
  61. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  62. data/test/dummy/tmp/cache/assets/test/sprockets/de0932670a6c856bc6eda1586fd29061 +0 -0
  63. data/test/dummy/tmp/cache/assets/test/sprockets/de94a60b438eb5bf57653f3a220acd80 +0 -0
  64. data/test/dummy/tmp/cache/assets/test/sprockets/e15ec26dd7914851e352c6f2c73c4284 +0 -0
  65. data/test/dummy/tmp/cache/assets/test/sprockets/e3ddb4a07e99c5bbf5f9cd9db3cdb82a +0 -0
  66. data/test/dummy/tmp/cache/assets/test/sprockets/e9abb671d48f6ff2be6ffb463ea652bf +0 -0
  67. data/test/dummy/tmp/cache/assets/test/sprockets/eeb5bd38d1dad0d908461fd114f702bc +0 -0
  68. data/test/dummy/tmp/cache/assets/test/sprockets/fde9e78f8d55a70f4ef757638fc6cde0 +0 -0
  69. data/test/dummy/tmp/cache/assets/test/sprockets/fdfac6623944c5a23737724cbd90e58e +0 -0
  70. data/test/fixtures/routes_with_api_and_version_namespaces.rb +6 -0
  71. data/test/fixtures/routes_with_api_namespace.rb +4 -0
  72. data/test/generators/bootstrap_generator_test.rb +6 -3
  73. data/test/generators/component_generator_test.rb +6 -6
  74. data/test/generators/model_generator_test.rb +8 -2
  75. data/test/generators/resource_generator_test.rb +6 -6
  76. data/test/generators/resource_override_test.rb +10 -4
  77. data/test/generators/scaffold_override_test.rb +94 -0
  78. data/test/integration/autoload_modules_test.rb +22 -0
  79. data/test/integration/navigation_test.rb +1 -2
  80. data/test/support/generator_test_support.rb +8 -10
  81. data/test/test_helper.rb +2 -1
  82. data/vendor/assets/javascripts/app.js.es6.erb +1 -1
  83. data/vendor/assets/javascripts/ember-appkit/index.js +1 -3
  84. data/vendor/assets/javascripts/ember-appkit/loader.js +53 -0
  85. metadata +98 -41
  86. data/lib/ember/appkit.rb +0 -5
  87. data/lib/ember/appkit/rails/resource_override.rb +0 -14
  88. data/test/dummy/config/adapter.js +0 -3
  89. data/test/dummy/tmp/cache/assets/test/sprockets/07a9ce16127008e142b1b0223c4d7784 +0 -0
  90. data/test/dummy/tmp/cache/assets/test/sprockets/a2f615309ade94c14ae81d7ebc94fd67 +0 -0
  91. data/test/dummy/tmp/cache/assets/test/sprockets/a9648a765fed0738b076bd24099109a3 +0 -0
  92. data/test/dummy/tmp/cache/assets/test/sprockets/b340d5578308bb4c197a8ca3538b0e24 +0 -0
  93. data/test/dummy/tmp/cache/assets/test/sprockets/c8c4c1b316845f30168739b5795846d6 +0 -0
  94. data/test/dummy/tmp/cache/assets/test/sprockets/e22019b3c13c20bc08e899fb2b7248ea +0 -0
  95. data/vendor/assets/javascripts/ember-appkit/almond.js +0 -417
@@ -1,5 +0,0 @@
1
- require 'ember-rails'
2
- require 'ember/source'
3
- require 'es6_module_transpiler/rails'
4
-
5
- module Ember::Appkit; end
@@ -1,14 +0,0 @@
1
- require 'generators/ember/resource_override'
2
-
3
- module Ember::Appkit::Rails::ResourceOverride
4
- def add_ember
5
- if options.ember
6
- super
7
- end
8
- end
9
- end
10
-
11
- Rails::Generators::ResourceGenerator.class_eval do
12
- prepend Ember::Appkit::Rails::ResourceOverride
13
- class_option :ember, aliases: '-e', desc: 'force ember resource to generate', optional: true, type: 'boolean', default: false, banner: '--ember'
14
- end
@@ -1,3 +0,0 @@
1
- window.App.ApplicationAdapter = DS.ActiveModelAdapter.extend({
2
- namespace: 'api/v1'
3
- });
@@ -1,417 +0,0 @@
1
- /**
2
- * almond 0.2.6 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
3
- * Available via the MIT or new BSD license.
4
- * see: http://github.com/jrburke/almond for details
5
- *
6
- * This copy of almond.js has been modified to better support ember-app-kit.
7
- * See reference to `requirejs._eak_seen` below.
8
- *
9
- */
10
- //Going sloppy to avoid 'use strict' string cost, but strict practices should
11
- //be followed.
12
- /*jslint sloppy: true */
13
- /*global setTimeout: false */
14
-
15
- var requirejs, require, define;
16
- (function (undef) {
17
- var main, req, makeMap, handlers,
18
- defined = {},
19
- waiting = {},
20
- seen = {},
21
- config = {},
22
- defining = {},
23
- hasOwn = Object.prototype.hasOwnProperty,
24
- aps = [].slice;
25
-
26
- function hasProp(obj, prop) {
27
- return hasOwn.call(obj, prop);
28
- }
29
-
30
- /**
31
- * Given a relative module name, like ./something, normalize it to
32
- * a real name that can be mapped to a path.
33
- * @param {String} name the relative name
34
- * @param {String} baseName a real name that the name arg is relative
35
- * to.
36
- * @returns {String} normalized name
37
- */
38
- function normalize(name, baseName) {
39
- var nameParts, nameSegment, mapValue, foundMap,
40
- foundI, foundStarMap, starI, i, j, part,
41
- baseParts = baseName && baseName.split("/"),
42
- map = config.map,
43
- starMap = (map && map['*']) || {};
44
-
45
- //Adjust any relative paths.
46
- if (name && name.charAt(0) === ".") {
47
- //If have a base name, try to normalize against it,
48
- //otherwise, assume it is a top-level require that will
49
- //be relative to baseUrl in the end.
50
- if (baseName) {
51
- //Convert baseName to array, and lop off the last part,
52
- //so that . matches that "directory" and not name of the baseName's
53
- //module. For instance, baseName of "one/two/three", maps to
54
- //"one/two/three.js", but we want the directory, "one/two" for
55
- //this normalization.
56
- baseParts = baseParts.slice(0, baseParts.length - 1);
57
-
58
- name = baseParts.concat(name.split("/"));
59
-
60
- //start trimDots
61
- for (i = 0; i < name.length; i += 1) {
62
- part = name[i];
63
- if (part === ".") {
64
- name.splice(i, 1);
65
- i -= 1;
66
- } else if (part === "..") {
67
- if (i === 1 && (name[2] === '..' || name[0] === '..')) {
68
- //End of the line. Keep at least one non-dot
69
- //path segment at the front so it can be mapped
70
- //correctly to disk. Otherwise, there is likely
71
- //no path mapping for a path starting with '..'.
72
- //This can still fail, but catches the most reasonable
73
- //uses of ..
74
- break;
75
- } else if (i > 0) {
76
- name.splice(i - 1, 2);
77
- i -= 2;
78
- }
79
- }
80
- }
81
- //end trimDots
82
-
83
- name = name.join("/");
84
- } else if (name.indexOf('./') === 0) {
85
- // No baseName, so this is ID is resolved relative
86
- // to baseUrl, pull off the leading dot.
87
- name = name.substring(2);
88
- }
89
- }
90
-
91
- //Apply map config if available.
92
- if ((baseParts || starMap) && map) {
93
- nameParts = name.split('/');
94
-
95
- for (i = nameParts.length; i > 0; i -= 1) {
96
- nameSegment = nameParts.slice(0, i).join("/");
97
-
98
- if (baseParts) {
99
- //Find the longest baseName segment match in the config.
100
- //So, do joins on the biggest to smallest lengths of baseParts.
101
- for (j = baseParts.length; j > 0; j -= 1) {
102
- mapValue = map[baseParts.slice(0, j).join('/')];
103
-
104
- //baseName segment has config, find if it has one for
105
- //this name.
106
- if (mapValue) {
107
- mapValue = mapValue[nameSegment];
108
- if (mapValue) {
109
- //Match, update name to the new value.
110
- foundMap = mapValue;
111
- foundI = i;
112
- break;
113
- }
114
- }
115
- }
116
- }
117
-
118
- if (foundMap) {
119
- break;
120
- }
121
-
122
- //Check for a star map match, but just hold on to it,
123
- //if there is a shorter segment match later in a matching
124
- //config, then favor over this star map.
125
- if (!foundStarMap && starMap && starMap[nameSegment]) {
126
- foundStarMap = starMap[nameSegment];
127
- starI = i;
128
- }
129
- }
130
-
131
- if (!foundMap && foundStarMap) {
132
- foundMap = foundStarMap;
133
- foundI = starI;
134
- }
135
-
136
- if (foundMap) {
137
- nameParts.splice(0, foundI, foundMap);
138
- name = nameParts.join('/');
139
- }
140
- }
141
-
142
- return name;
143
- }
144
-
145
- function makeRequire(relName, forceSync) {
146
- return function () {
147
- //A version of a require function that passes a moduleName
148
- //value for items that may need to
149
- //look up paths relative to the moduleName
150
- return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
151
- };
152
- }
153
-
154
- function makeNormalize(relName) {
155
- return function (name) {
156
- return normalize(name, relName);
157
- };
158
- }
159
-
160
- function makeLoad(depName) {
161
- return function (value) {
162
- defined[depName] = value;
163
- };
164
- }
165
-
166
- function callDep(name) {
167
- if (hasProp(waiting, name)) {
168
- var args = waiting[name];
169
- delete waiting[name];
170
- defining[name] = true;
171
- main.apply(undef, args);
172
- }
173
-
174
- if (!hasProp(defined, name) && !hasProp(defining, name)) {
175
- throw new Error('No ' + name);
176
- }
177
- return defined[name];
178
- }
179
-
180
- //Turns a plugin!resource to [plugin, resource]
181
- //with the plugin being undefined if the name
182
- //did not have a plugin prefix.
183
- function splitPrefix(name) {
184
- var prefix,
185
- index = name ? name.indexOf('!') : -1;
186
- if (index > -1) {
187
- prefix = name.substring(0, index);
188
- name = name.substring(index + 1, name.length);
189
- }
190
- return [prefix, name];
191
- }
192
-
193
- /**
194
- * Makes a name map, normalizing the name, and using a plugin
195
- * for normalization if necessary. Grabs a ref to plugin
196
- * too, as an optimization.
197
- */
198
- makeMap = function (name, relName) {
199
- var plugin,
200
- parts = splitPrefix(name),
201
- prefix = parts[0];
202
-
203
- name = parts[1];
204
-
205
- if (prefix) {
206
- prefix = normalize(prefix, relName);
207
- plugin = callDep(prefix);
208
- }
209
-
210
- //Normalize according
211
- if (prefix) {
212
- if (plugin && plugin.normalize) {
213
- name = plugin.normalize(name, makeNormalize(relName));
214
- } else {
215
- name = normalize(name, relName);
216
- }
217
- } else {
218
- name = normalize(name, relName);
219
- parts = splitPrefix(name);
220
- prefix = parts[0];
221
- name = parts[1];
222
- if (prefix) {
223
- plugin = callDep(prefix);
224
- }
225
- }
226
-
227
- //Using ridiculous property names for space reasons
228
- return {
229
- f: prefix ? prefix + '!' + name : name, //fullName
230
- n: name,
231
- pr: prefix,
232
- p: plugin
233
- };
234
- };
235
-
236
- function makeConfig(name) {
237
- return function () {
238
- return (config && config.config && config.config[name]) || {};
239
- };
240
- }
241
-
242
- handlers = {
243
- require: function (name) {
244
- return makeRequire(name);
245
- },
246
- exports: function (name) {
247
- var e = defined[name];
248
- if (typeof e !== 'undefined') {
249
- return e;
250
- } else {
251
- return (defined[name] = {});
252
- }
253
- },
254
- module: function (name) {
255
- return {
256
- id: name,
257
- uri: '',
258
- exports: defined[name],
259
- config: makeConfig(name)
260
- };
261
- }
262
- };
263
-
264
- main = function (name, deps, callback, relName) {
265
- var cjsModule, depName, ret, map, i,
266
- args = [],
267
- usingExports;
268
-
269
- //Use name if no relName
270
- relName = relName || name;
271
-
272
- //Call the callback to define the module, if necessary.
273
- if (typeof callback === 'function') {
274
-
275
- //Pull out the defined dependencies and pass the ordered
276
- //values to the callback.
277
- //Default to [require, exports, module] if no deps
278
- deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
279
- for (i = 0; i < deps.length; i += 1) {
280
- map = makeMap(deps[i], relName);
281
- depName = map.f;
282
-
283
- //Fast path CommonJS standard dependencies.
284
- if (depName === "require") {
285
- args[i] = handlers.require(name);
286
- } else if (depName === "exports") {
287
- //CommonJS module spec 1.1
288
- args[i] = handlers.exports(name);
289
- usingExports = true;
290
- } else if (depName === "module") {
291
- //CommonJS module spec 1.1
292
- cjsModule = args[i] = handlers.module(name);
293
- } else if (hasProp(defined, depName) ||
294
- hasProp(waiting, depName) ||
295
- hasProp(defining, depName)) {
296
- args[i] = callDep(depName);
297
- } else if (map.p) {
298
- map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
299
- args[i] = defined[depName];
300
- } else {
301
- throw new Error(name + ' missing ' + depName);
302
- }
303
- }
304
-
305
- ret = callback.apply(defined[name], args);
306
-
307
- if (name) {
308
- //If setting exports via "module" is in play,
309
- //favor that over return value and exports. After that,
310
- //favor a non-undefined return value over exports use.
311
- if (cjsModule && cjsModule.exports !== undef &&
312
- cjsModule.exports !== defined[name]) {
313
- defined[name] = cjsModule.exports;
314
- } else if (ret !== undef || !usingExports) {
315
- //Use the return value from the function.
316
- defined[name] = ret;
317
- }
318
- }
319
- } else if (name) {
320
- //May just be an object definition for the module. Only
321
- //worry about defining if have a module name.
322
- defined[name] = callback;
323
- }
324
- };
325
-
326
- requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
327
- if (typeof deps === "string") {
328
- if (handlers[deps]) {
329
- //callback in this case is really relName
330
- return handlers[deps](callback);
331
- }
332
- //Just return the module wanted. In this scenario, the
333
- //deps arg is the module name, and second arg (if passed)
334
- //is just the relName.
335
- //Normalize module name, if it contains . or ..
336
- return callDep(makeMap(deps, callback).f);
337
- } else if (!deps.splice) {
338
- //deps is a config object, not an array.
339
- config = deps;
340
- if (callback.splice) {
341
- //callback is an array, which means it is a dependency list.
342
- //Adjust args if there are dependencies
343
- deps = callback;
344
- callback = relName;
345
- relName = null;
346
- } else {
347
- deps = undef;
348
- }
349
- }
350
-
351
- //Support require(['a'])
352
- callback = callback || function () {};
353
-
354
- //If relName is a function, it is an errback handler,
355
- //so remove it.
356
- if (typeof relName === 'function') {
357
- relName = forceSync;
358
- forceSync = alt;
359
- }
360
-
361
- //Simulate async callback;
362
- if (forceSync) {
363
- main(undef, deps, callback, relName);
364
- } else {
365
- //Using a non-zero value because of concern for what old browsers
366
- //do, and latest browsers "upgrade" to 4 if lower value is used:
367
- //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
368
- //If want a value immediately, use require('id') instead -- something
369
- //that works in almond on the global level, but not guaranteed and
370
- //unlikely to work in other AMD implementations.
371
- setTimeout(function () {
372
- main(undef, deps, callback, relName);
373
- }, 4);
374
- }
375
-
376
- return req;
377
- };
378
-
379
- /**
380
- * Just drops the config on the floor, but returns req in case
381
- * the config return value is used.
382
- */
383
- req.config = function (cfg) {
384
- config = cfg;
385
- if (config.deps) {
386
- req(config.deps, config.callback);
387
- }
388
- return req;
389
- };
390
-
391
- /**
392
- * Expose module registry for debugging and tooling
393
- */
394
- requirejs._defined = defined;
395
- requirejs._eak_seen = seen; // HAXORS
396
-
397
- define = function (name, deps, callback) {
398
- seen[name] = true;
399
-
400
- //This module may not have dependencies
401
- if (!deps.splice) {
402
- //deps is not an array, so probably means
403
- //an object literal or factory function for
404
- //the value. Adjust args.
405
- callback = deps;
406
- deps = [];
407
- }
408
-
409
- if (!hasProp(defined, name) && !hasProp(waiting, name)) {
410
- waiting[name] = [name, deps, callback];
411
- }
412
- };
413
-
414
- define.amd = {
415
- jQuery: true
416
- };
417
- }());