Sha256: 08b43df00c931847d864b5d68972e1067ca55c4adad33a1762b209cee45ad9cf

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 Bytes

Contents

require 'generators/ember/generator_helpers'

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

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

      desc "Creates a new Ember.js view and associated template."
      class_option :ember_path, :type => :string, :aliases => "-d", :default => false, :desc => "Custom ember app path"
      class_option :without_template, :type => :boolean, :default => false, :desc => "Create template for this view"

      def create_view_files
        file_path = File.join(ember_path, 'views', class_path, "#{file_name}.js.es6")
        template "view.js.es6", file_path
        invoke('ember:template', [ name ], options) unless options[:without_template]
      end
    end
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ember-appkit-rails-0.1.2 lib/generators/ember/view_generator.rb
ember-appkit-rails-0.1.1 lib/generators/ember/view_generator.rb