grunt-crafter-deploy

0.1.4 • Public • Published

grunt-crafter-deploy

Crafter Studio deployer for assets such as images, js or css

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-crafter-deploy --save-dev

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

grunt.loadNpmTasks('grunt-crafter-deploy');

The "crafter_deploy" task

Overview

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

grunt.initConfig({
  crafter_deploy: {
    options: {
      // Task-specific options go here.
    },
    files: {
      // Destination paths map and file lists  go here.
    },
  },
});

Options

options.protocol

Type: String Default value: 'http'

A string value that is used to specify if connection will be regular or 'https'.

options.host

Type: String Required

A string value that is used to define the server host.

options.port

Type: Integer Default value: null

An integer value that is used to define the server port.

options.site

Type: String Required

Site where files are going to be deployed.

options.username

Type: String Required

User's email required for crafter studio login.

options.password

Type: String Required

User's password required for crafter studio login.

options.loginPath

Type: String Default value: '/alfresco/service/api/login'

Login service path to retrieve the alfresco ticket id.

options.uploadFilePath

Type: String Default value: '/alfresco/s/cstudio/wcm/content/upload-content-asset'

Upload files service path.

Usage Examples

Simple example

In this example, 2 files are going to be set for deployment into the same crafter studio folder. Also as a good practice, configuration will be defined in an external file called crafter.json relative to the Gruntfile.js

crafter.json
{
    "username": "EMAIL",
    "password": "PASSWORD",
    "host": "SERVER_HOSTNAME",
    "site": "SITENAME"
}
Gruntfile.js
grunt.initConfig({
  crafter_config: grunt.file.readJSON('crafter.json'),
  crafter_deploy: {
    cloud: {
        options: {
            host: '<%= crafter_config.host %>',
            username: '<%= crafter_config.username %>',
            password: '<%= crafter_config.password %>',
            site: '<%= crafter_config.site %>'
        },
        files: {
            '/static-assets/js/': ['src/file1.js', 'src/file2.js']
        }
    }
  },
});

So now, file1.js and file2.js can be deployed into crafter studio /static-assets/js/ by running the task from commandline:

grunt crafter_deploy:cloud

Contributing

Feel free to fork it and modify it by your self :p

Release History

(Nothing yet)

Package Sidebar

Install

npm i grunt-crafter-deploy

Weekly Downloads

1

Version

0.1.4

License

none

Last publish

Collaborators

  • asotog