Permalink
Browse files

Adds a controller generator

  • Loading branch information...
1 parent a6fbe36 commit 2a9a685c74a996650f71ffccc284bf35a6cee67d tomhuda committed Apr 13, 2012
Showing with 20 additions and 0 deletions.
  1. +15 −0 lib/generators/ember/controller_generator.rb
  2. +5 −0 lib/generators/templates/controller.js
@@ -0,0 +1,15 @@
+require 'ember/version'
+
+module Ember
+ module Generators
+ class ControllerGenerator < ::Rails::Generators::NamedBase
+ source_root File.expand_path("../../templates", __FILE__)
+
+ desc "Creates a new Ember.js controller"
+
+ def create_controller_files
+ template 'controller.js', File.join('app/assets/javascripts/ember/controllers', class_path, "#{file_name}_controller.js")
+ end
+ end
+ end
+end
@@ -0,0 +1,5 @@
+<%= application_name.camelize %>.<%= class_name %>Controller = Ember.Object.extend({
+ // Implement your controller here.
+});
+
+<%= application_name.camelize %>.<%= class_name.camelize(:lower) %>Controller = <%= application_name.camelize %>.<%= class_name %>Controller.create();

0 comments on commit 2a9a685

Please sign in to comment.