Sha256: 9ccfeaa75096bc43a38da69bae425354371ed44833d07bc2a603d3fd97079eb8
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
require 'generators/md/helpers' module Md module Generators class SubmoduleGenerator < Rails::Generators::NamedBase include MarionetteDust::Generators::Helpers include Thor::Actions source_root File.expand_path("../../common/templates", __FILE__) desc "Generates a Marionette.js resource scaffold" class_option :coffeescript, type: :boolean, aliases: "-c", default: false, desc: "Generate Coffeescript files" class_option :parent, type: :string, aliases: "-p", required: true, desc: "Parent app (required)" def parse_options coffee = options.coffeescript @ext = coffee ? ".js.coffee" : ".js" @parent_name = options.parent @submodule_name = file_name end def create_subapp create_asset("view") create_asset("controller") create_dust_template end protected def create_asset(type) file = File.join(apps_path, @parent_name.downcase, file_name, asset_file_name(type)) template "#{type}#{@ext}", file end def create_dust_template empty_directory File.join(template_path, @parent_name, @submodule_name) file = File.join(template_path, @parent_name, @submodule_name, "#{@submodule_name}.jst.dust") template "template.jst.dust", file end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
marionette_dust-0.0.3 | lib/generators/md/submodule/submodule_generator.rb |