Sha256: 9a5947836e535e334776943d785dffb0a4015a166155e7c8fdba9caa0a8c56b2

Contents?: true

Size: 705 Bytes

Versions: 1

Compression:

Stored size: 705 Bytes

Contents

module Vue
  class StoreGenerator < Rails::Generators::NamedBase
    source_root File.expand_path('../templates', __FILE__)

    def generate_store
      [
        'Store', 'actions', 'getters', 'mutations', 'state'
      ].each do |template|
        template "#{template}.template", Rails.root.join("app", "javascript", "stores", *path, "#{template}.js")
      end
    end

    private
    def store_name
      # name is from Rails::Generators::NamedBase which expects a single argument to the generator
      store = name.split("/").last
      store.camelize(:lower) # makesTheFirstLetterLowerCase
    end

    def path
      name.split("/").map {|part| part.underscore.tr('_', '-') }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vue-generators-0.1.3 lib/vue/generators/vue/store/store_generator.rb