Sha256: 479f140f6df0792317250fa2cdc9df0a9eae14bdd680f0d966dba9a443122710

Contents?: true

Size: 985 Bytes

Versions: 7

Compression:

Stored size: 985 Bytes

Contents

require 'generators/ember/generator_helpers'

module Ember
  module Generators
    class ControllerGenerator < ::Rails::Generators::NamedBase
      include Ember::Generators::GeneratorHelpers

      source_root File.expand_path("../../templates", __FILE__)

      desc "Creates a new Ember.js controller."

      class_option :array, :type => :boolean, :default => false, :desc => "Create an Ember.ArrayController to represent multiple objects."
      class_option :object, :type => :boolean, :default => false, :desc => "Create an Ember.ObjectController to represent a single object."

      def create_controller_files
        file_path = File.join(app_path, 'controllers', class_path, "#{file_name}.js.es6")

        if options.array?
          template "array_controller.js.es6", file_path
        elsif options.object?
          template "object_controller.js.es6", file_path
        else
          template "controller.js.es6", file_path
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ember-appkit-rails-0.4.0 lib/generators/ember/controller_generator.rb
ember-appkit-rails-0.3.2 lib/generators/ember/controller_generator.rb
ember-appkit-rails-0.3.1 lib/generators/ember/controller_generator.rb
ember-appkit-rails-0.3.0 lib/generators/ember/controller_generator.rb
ember-appkit-rails-0.2.2 lib/generators/ember/controller_generator.rb
ember-appkit-rails-0.2.1 lib/generators/ember/controller_generator.rb
ember-appkit-rails-0.2.0 lib/generators/ember/controller_generator.rb