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.5.15 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.4.36 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.5.14 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.4.35 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.5.13 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.4.34 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.5.12 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.4.33 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.5.11 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.5.10 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.4.32 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.5.9 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.4.31 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.5.8 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.4.30 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.5.7 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.4.29 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.5.6 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.4.28 lib/generators/workarea/js_module/js_module_generator.rb
workarea-core-3.5.5 lib/generators/workarea/js_module/js_module_generator.rb