Sha256: 8a873ae3eaa605bfb0fa75ff53a577fdf40c26c0ab318a00f93369e97e168d99
Contents?: true
Size: 1.75 KB
Versions: 3
Compression:
Stored size: 1.75 KB
Contents
require 'generators/ember/generator_helpers' module Ember module Generators class BootstrapGenerator < ::Rails::Generators::Base include Ember::Generators::GeneratorHelpers source_root File.expand_path("../../templates", __FILE__) desc "Creates a default Ember.js folder layout in app/assets/javascripts/ember" class_option :skip_git, :type => :boolean, :aliases => "-g", :default => false, :desc => "Skip Git keeps" def inject_ember application_file = "app/assets/javascripts/application.js" inject_into_file(application_file, :before => "//= require_tree") do dependencies = [ # this should eventually become handlebars-runtime when we remove # the runtime dependency on compilation "//= require handlebars", "//= require ember", "//= require ember-data", "//= require_self", "//= require #{application_name.underscore}", "#{application_name.camelize} = Ember.Application.create();" ] dependencies.join("\n").concat("\n") end end def create_dir_layout %W{models controllers views routes helpers templates}.each do |dir| empty_directory "#{ember_path}/#{dir}" create_file "#{ember_path}/#{dir}/.gitkeep" unless options[:skip_git] end end def create_app_file template "app.js", "#{ember_path}/#{application_name.underscore}.js" end def create_router_file template "router.js", "#{ember_path}/router.js" end def create_store_file template "store.js", "#{ember_path}/store.js" end def create_app_stubs generate "ember:view", "application" end end end end
Version data entries
3 entries across 3 versions & 2 rubygems