Sha256: 6c1b9b48cc4e398c34ac2876f34d3798b133d7e330def31c8fe442340d234bb4

Contents?: true

Size: 721 Bytes

Versions: 62

Compression:

Stored size: 721 Bytes

Contents

module Workarea
  module Generators
    class JsModuleGenerator < Rails::Generators::NamedBase
      source_root File.expand_path('../templates', __FILE__)
      desc File.read(File.expand_path('../USAGE', __FILE__))

      class_option :engine, type: :string, default: 'storefront', desc: 'The engine in which the JS module will be used'

      def generate_module
        template 'js_module.js.erb', module_file_path
      end

      protected

      def module_name
        name.camelize(:lower)
      end

      private

      def module_file_path
        "app/assets/javascripts/workarea/#{asset_path}.js"
      end

      def asset_path
        "#{options.engine}/modules/#{file_path}"
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.4.13 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.4.12 lib/generators/workarea/js_module/js_module_generator.rb