<NME> controller.js
<BEF> ADDFILE
<MSG> Refactor Controller#needs into ember-application, rather then ember-routing.
<DFF> @@ -0,0 +1,75 @@
+/**
+@module ember
+@submodule ember-routing
+*/
+
+var get = Ember.get, set = Ember.set;
+var ControllersProxy = Ember.Object.extend({
+  controller: null,
+
+  unknownProperty: function(controllerName) {
+    var controller = get(this, 'controller'),
+      needs = get(controller, 'needs'),
+      container = controller.get('container'),
+      dependency;
+
+    for (var i=0, l=needs.length; i<l; i++) {
+      dependency = needs[i];
+      if (dependency === controllerName) {
+        return container.lookup('controller:' + controllerName);
+      }
+    }
+  }
+});
+
+function verifyDependencies(controller) {
+  var needs = get(controller, 'needs'),
+      container = get(controller, 'container'),
+      dependency, satisfied = true;
+
+  for (var i=0, l=needs.length; i<l; i++) {
+    dependency = needs[i];
+    if (dependency.indexOf(':') === -1) {
+      dependency = "controller:" + dependency;
+    }
+
+    if (!container.has(dependency)) {
+      satisfied = false;
+      Ember.assert(controller + " needs " + dependency + " but it does not exist", false);
+    }
+  }
+
+  return satisfied;
+}
+
+Ember.ControllerMixin.reopen({
+  concatenatedProperties: ['needs'],
+  needs: [],
+
+  init: function() {
+    this._super.apply(this, arguments);
+
+    // Structure asserts to still do verification but not string concat in production
+    if(!verifyDependencies(this)) {
+      Ember.assert("Missing dependencies", false);
+    }
+  },
+
+  controllerFor: function(controllerName) {
+    Ember.deprecate("Controller#controllerFor is depcrecated, please use Controller#needs instead");
+    var container = get(this, 'container');
+    return container.lookup('controller:' + controllerName);
+  },
+
+  model: Ember.computed(function(key, value) {
+    if (arguments.length > 1) {
+      return set(this, 'content', value);
+    } else {
+      return get(this, 'content');
+    }
+  }).property('content'),
+
+  controllers: Ember.computed(function() {
+    return ControllersProxy.create({ controller: this });
+  })
+});

{'commit': 'diff --git a/packages/ember-application/lib/ext.js b/packages/ember-application/lib/ext.js\nnew file mode 100644\nindex 000000000..3e8f55b8f\n--- /dev/null\n+++ b/packages/ember-application/lib/ext.js\n@@ -0,0 +1 @@\n+require(\'ember-application/ext/controller\');\ndiff --git a/packages/ember-application/lib/ext/controller.js b/packages/ember-application/lib/ext/controller.js\nnew file mode 100644\nindex 000000000..5eccac839\n--- /dev/null\n+++ b/packages/ember-application/lib/ext/controller.js\n@@ -0,0 +1,75 @@\n+/**\n+@module ember\n+@submodule ember-routing\n+*/\n+\n+var get = Ember.get, set = Ember.set;\n+var ControllersProxy = Ember.Object.extend({\n+  controller: null,\n+\n+  unknownProperty: function(controllerName) {\n+    var controller = get(this, \'controller\'),\n+      needs = get(controller, \'needs\'),\n+      container = controller.get(\'container\'),\n+      dependency;\n+\n+    for (var i=0, l=needs.length; i<l; i++) {\n+      dependency = needs[i];\n+      if (dependency === controllerName) {\n+        return container.lookup(\'controller:\' + controllerName);\n+      }\n+    }\n+  }\n+});\n+\n+function verifyDependencies(controller) {\n+  var needs = get(controller, \'needs\'),\n+      container = get(controller, \'container\'),\n+      dependency, satisfied = true;\n+\n+  for (var i=0, l=needs.length; i<l; i++) {\n+    dependency = needs[i];\n+    if (dependency.indexOf(\':\') === -1) {\n+      dependency = "controller:" + dependency;\n+    }\n+\n+    if (!container.has(dependency)) {\n+      satisfied = false;\n+      Ember.assert(controller + " needs " + dependency + " but it does not exist", false);\n+    }\n+  }\n+\n+  return satisfied;\n+}\n+\n+Ember.ControllerMixin.reopen({\n+  concatenatedProperties: [\'needs\'],\n+  needs: [],\n+\n+  init: function() {\n+    this._super.apply(this, arguments);\n+\n+    // Structure asserts to still do verification but not string concat in production\n+    if(!verifyDependencies(this)) {\n+      Ember.assert("Missing dependencies", false);\n+    }\n+  },\n+\n+  controllerFor: function(controllerName) {\n+    Ember.deprecate("Controller#controllerFor is depcrecated, please use Controller#needs instead");\n+    var container = get(this, \'container\');\n+    return container.lookup(\'controller:\' + controllerName);\n+  },\n+\n+  model: Ember.computed(function(key, value) {\n+    if (arguments.length > 1) {\n+      return set(this, \'content\', value);\n+    } else {\n+      return get(this, \'content\');\n+    }\n+  }).property(\'content\'),\n+\n+  controllers: Ember.computed(function() {\n+    return ControllersProxy.create({ controller: this });\n+  })\n+});\ndiff --git a/packages/ember-application/lib/main.js b/packages/ember-application/lib/main.js\nindex ec458f708..6d9dbf8d0 100644\n--- a/packages/ember-application/lib/main.js\n+++ b/packages/ember-application/lib/main.js\n@@ -1,6 +1,7 @@\n require(\'ember-views\');\n require(\'ember-routing\');\n require(\'ember-application/system\');\n+require(\'ember-application/ext\');\n \n /**\n Ember Application\ndiff --git a/packages/ember-routing/tests/system/controller_for_test.js b/packages/ember-application/tests/system/controller_for_test.js\nsimilarity index 100%\nrename from packages/ember-routing/tests/system/controller_for_test.js\nrename to packages/ember-application/tests/system/controller_for_test.js\ndiff --git a/packages/ember-routing/tests/system/controller_test.js b/packages/ember-application/tests/system/controller_test.js\nsimilarity index 100%\nrename from packages/ember-routing/tests/system/controller_test.js\nrename to packages/ember-application/tests/system/controller_test.js\ndiff --git a/packages/ember-routing/lib/ext/controller.js b/packages/ember-routing/lib/ext/controller.js\nindex a0009daef..2efb9a919 100644\n--- a/packages/ember-routing/lib/ext/controller.js\n+++ b/packages/ember-routing/lib/ext/controller.js\n@@ -4,37 +4,8 @@\n */\n \n var get = Ember.get, set = Ember.set;\n-var ControllersProxy = Ember.Object.extend({\n-  controller: null,\n-\n-  unknownProperty: function(controllerName) {\n-    var controller = get(this, \'controller\'),\n-      needs = get(controller, \'needs\'),\n-      container = controller.get(\'container\'),\n-      dependency;\n-\n-    for (var i=0, l=needs.length; i<l; i++) {\n-      dependency = needs[i];\n-      if (dependency === controllerName) {\n-        return container.lookup(\'controller:\' + controllerName);\n-      }\n-    }\n-  }\n-});\n \n Ember.ControllerMixin.reopen({\n-  concatenatedProperties: [\'needs\'],\n-  needs: [],\n-\n-  init: function() {\n-    this._super.apply(this, arguments);\n-\n-    // Structure asserts to still do verification but not string concat in production\n-    if(!verifyDependencies(this)) {\n-      Ember.assert("Missing dependencies", false);\n-    }\n-  },\n-\n   transitionToRoute: function() {\n     var target = get(this, \'target\');\n \n@@ -57,41 +28,11 @@ Ember.ControllerMixin.reopen({\n     return this.replaceRoute.apply(this, arguments);\n   },\n \n-  controllerFor: function(controllerName) {\n-    Ember.deprecate("Controller#controllerFor is depcrecated, please use Controller#needs instead");\n-    var container = get(this, \'container\');\n-    return container.lookup(\'controller:\' + controllerName);\n-  },\n-\n   model: Ember.computed(function(key, value) {\n     if (arguments.length > 1) {\n       return set(this, \'content\', value);\n     } else {\n       return get(this, \'content\');\n     }\n-  }).property(\'content\'),\n-\n-  controllers: Ember.computed(function() {\n-    return ControllersProxy.create({ controller: this });\n-  })\n+  }).property(\'content\')\n });\n-\n-function verifyDependencies(controller) {\n-  var needs = get(controller, \'needs\'),\n-      container = get(controller, \'container\'),\n-      dependency, satisfied = true;\n-\n-  for (var i=0, l=needs.length; i<l; i++) {\n-    dependency = needs[i];\n-    if (dependency.indexOf(\':\') === -1) {\n-      dependency = "controller:" + dependency;\n-    }\n-\n-    if (!container.has(dependency)) {\n-      satisfied = false;\n-      Ember.assert(controller + " needs " + dependency + " but it does not exist", false);\n-    }\n-  }\n-\n-  return satisfied;\n-}\n', 'commit_subject': 'Refactor Controller#needs into ember-application, rather then ember-routing.', 'repo_name': 'emberjs/ember.js', 'committer': {'name': 'Stefan Penner', 'email': '0b40b374491a9d33ce3192c35cb80116802ee83a@gmail.com', 'time_sec': '1359325725', 'tz_offset': '-300', 'date': {'seconds': '1359325725'}}, 'commit_tree': 'aad6ba6d6da31fa0a8d056ba46cda918f863eb31', 'commit_message': 'Refactor Controller#needs into ember-application, rather then ember-routing.', 'language_name': 'JavaScript', 'license': 'mit', 'hunks': '@@ -0,0 +1,75 @@\n+/**\n+@module ember\n+@submodule ember-routing\n+*/\n+\n+var get = Ember.get, set = Ember.set;\n+var ControllersProxy = Ember.Object.extend({\n+  controller: null,\n+\n+  unknownProperty: function(controllerName) {\n+    var controller = get(this, \'controller\'),\n+      needs = get(controller, \'needs\'),\n+      container = controller.get(\'container\'),\n+      dependency;\n+\n+    for (var i=0, l=needs.length; i<l; i++) {\n+      dependency = needs[i];\n+      if (dependency === controllerName) {\n+        return container.lookup(\'controller:\' + controllerName);\n+      }\n+    }\n+  }\n+});\n+\n+function verifyDependencies(controller) {\n+  var needs = get(controller, \'needs\'),\n+      container = get(controller, \'container\'),\n+      dependency, satisfied = true;\n+\n+  for (var i=0, l=needs.length; i<l; i++) {\n+    dependency = needs[i];\n+    if (dependency.indexOf(\':\') === -1) {\n+      dependency = "controller:" + dependency;\n+    }\n+\n+    if (!container.has(dependency)) {\n+      satisfied = false;\n+      Ember.assert(controller + " needs " + dependency + " but it does not exist", false);\n+    }\n+  }\n+\n+  return satisfied;\n+}\n+\n+Ember.ControllerMixin.reopen({\n+  concatenatedProperties: [\'needs\'],\n+  needs: [],\n+\n+  init: function() {\n+    this._super.apply(this, arguments);\n+\n+    // Structure asserts to still do verification but not string concat in production\n+    if(!verifyDependencies(this)) {\n+      Ember.assert("Missing dependencies", false);\n+    }\n+  },\n+\n+  controllerFor: function(controllerName) {\n+    Ember.deprecate("Controller#controllerFor is depcrecated, please use Controller#needs instead");\n+    var container = get(this, \'container\');\n+    return container.lookup(\'controller:\' + controllerName);\n+  },\n+\n+  model: Ember.computed(function(key, value) {\n+    if (arguments.length > 1) {\n+      return set(this, \'content\', value);\n+    } else {\n+      return get(this, \'content\');\n+    }\n+  }).property(\'content\'),\n+\n+  controllers: Ember.computed(function() {\n+    return ControllersProxy.create({ controller: this });\n+  })\n+});\n', 'addition_count': 75, 'deletion_count': 0, 'src_file': '/dev/null', 'tgt_file': 'b/packages/ember-application/lib/ext/controller.js', 'file_extension': '.js', 'before_file': 'ADDFILE', 'message': 'Refactor Controller#needs into ember-application, rather then ember-routing.', 'author_name': 'Stefan Penner', 'lang': 'js'}