Class: Ember::ControllerGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
GeneratorHelpers
Defined in:
lib/generators/ember/controller/controller_generator.rb

Instance Method Summary collapse

Methods included from GeneratorHelpers

#application_name, #ember_path, #spec_path

Instance Method Details

#generate_controllerObject



12
13
14
# File 'lib/generators/ember/controller/controller_generator.rb', line 12

def generate_controller
  template 'controller.js.coffee', "#{ember_path}/controllers/#{controller_name}_controller.js.coffee"
end

#generate_directoryObject



8
9
10
# File 'lib/generators/ember/controller/controller_generator.rb', line 8

def generate_directory
  empty_directory "#{ember_path}/controllers"
end

#generate_specsObject



22
23
24
# File 'lib/generators/ember/controller/controller_generator.rb', line 22

def generate_specs
  template 'controller_spec.js.coffee', "#{spec_path}/controllers/#{controller_name}_controller_spec.js.coffee"
end

#generate_viewsObject



16
17
18
19
20
# File 'lib/generators/ember/controller/controller_generator.rb', line 16

def generate_views
  routes.each do |route|
    generate 'ember:view', controller_name, route
  end
end