grunt-doctrine

Grunt plugin to convert doctrine xml annotations into backbone models and collections. Useful in conjunction with doctrine apigility. Includes option to scaffold an entire BBB application

Usage no npm install needed!

<script type="module">
  import gruntDoctrine from 'https://cdn.skypack.dev/grunt-doctrine';
</script>

README

grunt-doctrine

Grunt plugin to convert doctrine xml annotations into backbone models and collections. useful in conjunction with doctrine apigility. Includes option to scaffold a complete BBB crud application.

Getting Started

This plugin requires Grunt.

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-doctrine --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-doctrine');

The "doctrine" task

Overview

In your project's Gruntfile, add a section named doctrine to the data object passed into grunt.initConfig().

grunt.initConfig({
  doctrine: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
})

Options

options.appName

Type: String Default value: 'app'

The application name that will be written to the package.json file

options.root

Type: String Default value: '/'

The destination folder where the code will be generated.

options.endpoint

Type: String Default value: 'null'

The api endpoint for example http://example.com/v1/

options.backbone

Type: Object Default value: '{}'

Options for the backbone modules to use. Options will be described later in this module.

options.backbone.relational

Type: Boolean Default value: 'false'

Use Backbone.Relational

options.backbone.fetchcache

Type: Boolean Default value: 'false'

Use Backbone.Fetch cache plugin to cache resources?

options.backbone.modelDefaults

Type: Boolean Default value: 'false'

Declare defaults in Backbone models.

options.backbone.pushState

Type: Boolean Default value: 'false'

Enables pushState for Backbone.History

Usage Examples

Default Options

In this example, We create a complete module application

grunt.initConfig({
  doctrine: {
    options: {
          appName: 'app',
          root: 'tmp',
          endpoint: 'http://example.com/v1/'
        },
    src: ['test/fixtures/**/*.xml']
  },
})

Custom Options

in this example, we create a bbb modular application

grunt.initConfig({
  doctrine: {
    options: {
          appName: 'app',
          root: 'tmp',
          endpoint: 'http://example.com/v1/'
        },
    src: ['test/fixtures/**/*.xml']
  },
})

Contributing

Actually contributing is not permitted.

Release History

(Nothing yet)

License

Copyright (c) 2014 mattimatti. Licensed under the MIT license.