npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-symfony2

v0.5.0

Published

Grunt plugin for running Symfony2 commands.

Downloads

422

Readme

grunt-symfony2

Grunt plugin for running Symfony2 commands.

Build Status

Getting Started

This plugin requires Grunt ~0.4.4

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-symfony2 --save-dev

Once you installed the plugin you can enable it inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-symfony2');

The "sf2-console" task

The sf2-console task let's you execute arbitrary commands of your Symfony2 application.

Overview

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

'sf2-console': {
    options: {
        // Task-specific options go here.
    },
    your_target: {
        cmd: 'command:name',
        args: {
            // Arguments
        }
    }
}

Options

options.bin

Type: String Default value: app/console

Path to console application that you want to use.

Usage Examples

Default Options

grunt-symfony2 uses by default app/console as binary to execute commands.

'sf2-console': {
    options: {},
    cache_clear_prod: {
        cmd: 'cache:clear',
        args: {
            env: 'prod'
        }
    }
}

Custom Options

If you want to use a custom binary, you can change the bin option.

'sf2-console': {
    options: {
        bin: 'app/sf2console'
    },
    cache_clear_prod: {
        cmd: 'cache:clear',
        args: {
            env: 'prod'
        }
    }
}

Environment Auto Detection

The execution environment of a task can be auto detected based on the target. If the targets name is either prod, dev or staging and the env argument is not present the task uses the target name as environment.

Example

The following task executes automatically in prod environment.

'sf2-cache-clear': {
    options: {},
    prod: {}
}

Other "sf-*" tasks

grunt-symfony2 contains additional tasks that allow you to quickly execute Symfony2 commands from grunt. The tasks work exactly like the sf2-console task, you just don't need to provide the cmd option. Arguments and auto detection of the environment are also supported. Currently we support the following commands:

  • sf2-assetic-dump: assetic:dump
  • sf2-assets-install: assets:install
  • sf2-cache-clear: cache:clear
  • sf2_cache_warmup: cache:warmup
  • sf2-doctrine-cache-clear-metadata: doctrine:cache:clear-metadata
  • sf2-doctrine-cache-clear-query: doctrine:cache:clear-query
  • sf2-doctrine-cache-clear-result: doctrine:cache:clear-result
  • sf2-doctrine-database-create: doctrine:database:create
  • sf2-doctrine-database-drop: doctrine:database:drop
  • sf2-doctrine-ensure-production-settings: doctrine:ensure-production-settings
  • sf2-doctrine-fixtures-load: doctrine:fixtures:load
  • sf2-doctrine-migrations-diff: doctrine:migrations:diff
  • sf2-doctrine-migrations-execute: doctrine:migrations:execute
  • sf2-doctrine-migrations-generate: doctrine:migrations:generate
  • sf2-doctrine-migrations-latest: doctrine:migrations:latest
  • sf2-doctrine-migrations-migrate: doctrine:migrations:migrate
  • sf2-doctrine-migrations-status: doctrine:migrations:status
  • sf2-doctrine-migrations-version: doctrine:migrations:version
  • sf2-doctrine-schema-create: doctrine:schema:create
  • sf2-doctrine-schema-drop: doctrine:schema:drop
  • sf2-doctrine-schema-update: doctrine:schema:update
  • sf2-doctrine-schema-validate: doctrine:schema:validate
  • sf2-orm-convert-mapping: orm:convert:mapping
  • sf2-translation-update: translation:update
  • sf2-twig-lint: twig:lint

Examples

Set the value to true if you want to use an option without value:

'sf2-doctrine-schema-update': {
    dev: {
        args: { force: true }
    }
}

It's a little bit confusing, but you have to put arguments (speaking in Symfony2 console terms) outside of the args array.

'sf2-orm-convert-mapping': {
    dev: {
        'to-type': 'xml',
        'dest-path': 'src/Acme/DemoBundle/Entity'
    },
    options: {
        bin: 'test/fixtures/console'
    }
}

Author

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

Version 0.5 (24 February 2016)

  • Add support for Grunt v1.0

Version 0.4 (11 April 2014)

  • Show output of Sculpin in Grunt output

Version 0.3 (30 March 2014)

  • Added support for arguments in tasks

Version 0.2 (30 March 2014)

  • Improved task names
  • Additional tests

Version 0.1 (24 March 2014)

  • Initial release