Sha256: 6ca3fc672406b8b737d783704aa7dd3db31095f4fb5bb4b7cf3047d57cbc39ca

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'generators/ember/generator_helpers'

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

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

      desc "Creates a new Ember.js router, controller, view and template"

      class_option :javascript_engine, :desc => "Engine for JavaScripts"
      class_option :skip_route, :type => :boolean, :default => false, :desc => "Don't create route"
      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_resource_files

        invoke('ember:route', [ name ], options) unless options[:skip_route]
        invoke('ember:controller', [ name ], options)
        invoke('ember:view', [ name ], options)
        invoke('ember:template', [ name ], options) 
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ember-rails-lite-0.12.0 lib/generators/ember/resource_generator.rb