Sha256: f9625271c4ff1fb409005a29db0b528012187ef43df1ca204827dc0e07c86002

Contents?: true

Size: 707 Bytes

Versions: 1

Compression:

Stored size: 707 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", *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('_', '-') } + ['store']
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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