You are here

function acquia_lift_libraries_info in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift.module \acquia_lift_libraries_info()

Implements hook_libraries_info().

Takes the same approach as used in navbar project.

See also

Libraries module.

File

./acquia_lift.module, line 1590
acquia_lift.module Provides Acquia Lift-specific personalization functionality.

Code

function acquia_lift_libraries_info() {
  $libraries['modernizr'] = array(
    'name' => 'Modernizr',
    'vendor url' => 'https://github.com/Modernizr/Modernizr',
    'download url' => 'http://modernizr.com/download/#-inputtypes-svg-touch-cssclasses-addtest-teststyles-prefixes-elem_details',
    'version callback' => '_acquia_lift_libraries_get_version',
    'variant order' => array(
      'minified',
      'source',
    ),
    'version arguments' => array(
      'variants' => array(
        'source' => array(
          'file' => 'modernizr.js',
          // @todo Document an actual example version string.
          'pattern' => '#Modernizr\\s+[Vv]?([0-9\\.]+)#',
        ),
        'minified' => array(
          'file' => 'modernizr-min.js',
          'pattern' => '#Modernizr\\s+[Vv]?([0-9\\.]+)#',
        ),
      ),
    ),
    'versions' => array(
      // Means ">=2.6.2": matches 2.6.2, 2.7.1, etc.
      '2.6.2' => array(
        'variants' => array(
          'source' => array(
            'files' => array(
              'js' => array(
                'modernizr.js',
              ),
            ),
            // Without a variant callback, the variant is assumed to be
            // installed.
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'modernizr.js',
            ),
          ),
          'minified' => array(
            'files' => array(
              'js' => array(
                'modernizr-min.js',
              ),
            ),
            // Without a variant callback, the variant is assumed to be
            // installed.
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'modernizr-min.js',
            ),
          ),
        ),
      ),
    ),
  );
  $libraries['underscore'] = array(
    'name' => 'Underscore',
    'vendor url' => 'http://documentcloud.github.io/backbone/',
    'download url' => 'https://github.com/jashkenas/underscore/archive/1.5.2.zip',
    'version callback' => '_acquia_lift_libraries_get_version',
    'variant order' => array(
      'minified',
      'source',
    ),
    'version arguments' => array(
      'variants' => array(
        'source' => array(
          'file' => 'underscore.js',
          'pattern' => '#VERSION *\\W *[\'\\"]{1}(.*?)[\'\\"]{1}#',
          // In the unminified Underscore.js 1.5.2, the version is defined on
          // line 68.
          'lines' => 100,
        ),
        'minified' => array(
          'file' => 'underscore-min.js',
          'pattern' => '#VERSION *\\W *[\'\\"]{1}(.*?)[\'\\"]{1}#',
          'cols' => 2000,
        ),
      ),
    ),
    'versions' => array(
      // Means ">=1.5.0": matches 1.5.0, 1.5.2, etc.
      '1.5.0' => array(
        'variants' => array(
          'source' => array(
            'files' => array(
              'js' => array(
                'underscore.js',
              ),
            ),
            // Without a variant callback, the variant is assumed to be
            // installed.
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'underscore.js',
            ),
          ),
          'minified' => array(
            'files' => array(
              'js' => array(
                'underscore-min.js',
              ),
            ),
            // Without a variant callback, the variant is assumed to be
            // installed.
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'underscore-min.js',
            ),
          ),
        ),
      ),
    ),
  );
  $libraries['backbone'] = array(
    'name' => 'Backbone',
    'vendor url' => 'http://documentcloud.github.io/backbone/',
    'download url' => 'https://github.com/jashkenas/backbone/archive/1.1.0.zip',
    'version callback' => '_acquia_lift_libraries_get_version',
    'variant order' => array(
      'minified',
      'source',
    ),
    'version arguments' => array(
      'variants' => array(
        'source' => array(
          'file' => 'backbone.js',
          'pattern' => '#VERSION *\\W *[\'\\"]{1}(.*?)[\'\\"]{1}#',
          // In the unminified Backbone.js 1.1.0, the version is defined on line
          // 38.
          'lines' => 50,
        ),
        'minified' => array(
          'file' => 'backbone-min.js',
          'pattern' => '#VERSION *\\W *[\'\\"]{1}(.*?)[\'\\"]{1}#',
        ),
      ),
    ),
    'versions' => array(
      // Means ">=1.0.0": matches 1.0.0, 1.1.0, etc.
      '1.0.0' => array(
        'variants' => array(
          'source' => array(
            'name' => 'Backbone',
            'files' => array(
              'js' => array(
                'backbone.js',
              ),
            ),
            // Without a variant callback, the variant is assumed to be
            // installed.
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'backbone.js',
            ),
            'dependencies' => array(
              'underscore (>=1.5.0)',
            ),
          ),
          'minified' => array(
            'name' => 'Backbone',
            'files' => array(
              'js' => array(
                'backbone-min.js',
              ),
            ),
            // Without a variant callback, the variant is assumed to be
            // installed.
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'backbone-min.js',
            ),
            'dependencies' => array(
              'underscore (>=1.5.0)',
            ),
          ),
        ),
      ),
    ),
  );
  $libraries['chosen'] = array(
    'name' => 'Chosen',
    'vendor url' => 'http://harvesthq.github.io/chosen/',
    'download url' => 'https://github.com/harvesthq/chosen/releases/download/v1.1.0/chosen_v1.1.0.zip',
    'version callback' => '_acquia_lift_libraries_get_version',
    'variant order' => array(
      'minified',
      'source',
    ),
    'version arguments' => array(
      'variants' => array(
        'source' => array(
          'file' => 'chosen.jquery.js',
          'pattern' => '/Version (1\\.\\d\\.\\d)+/',
        ),
        'minified' => array(
          'file' => 'chosen.jquery.min.js',
          'pattern' => '/v(1\\.\\d\\.\\d)+/',
        ),
      ),
    ),
    'versions' => array(
      '1.1.0' => array(
        'variants' => array(
          'source' => array(
            'files' => array(
              'js' => array(
                'chosen.jquery.js',
              ),
            ),
            // Without a variant callback, the variant is assumed to be
            // installed.
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'chosen.jquery.js',
            ),
          ),
          'minified' => array(
            'files' => array(
              'js' => array(
                'chosen.jquery.min.js',
              ),
            ),
            // Without a variant callback, the variant is assumed to be
            // installed.
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'chosen.jquery.min.js',
            ),
          ),
        ),
      ),
    ),
  );

  // @todo version detection assumes a version pattern within the same filename
  // but QTip has version-specific filenames and this needs to be better
  // addressed.
  $libraries['qtip'] = array(
    'name' => 'QTip',
    'vendor url' => 'http://craigsworks.com/projects/qtip/',
    'download url' => 'http://craigsworks.com/projects/qtip/download/',
    'version callback' => '_acquia_lift_libraries_get_version',
    'variant order' => array(
      'minified',
      'source',
    ),
    'version arguments' => array(
      'variants' => array(
        'source' => array(
          'file' => 'jquery.qtip-1.0.0-rc3.js',
          'pattern' => '/Version : (1\\.\\d\\.\\d)+/',
        ),
        'minified' => array(
          'file' => 'jquery.qtip-1.0.0-rc3.min.js',
          'pattern' => '/Version : (1\\.\\d\\.\\d)+/',
        ),
      ),
    ),
    'versions' => array(
      '1.0.0' => array(
        'variants' => array(
          'source' => array(
            'files' => array(
              'js' => array(
                'jquery.qtip-1.0.0-rc3.js',
              ),
            ),
            // Without a variant callback, the variant is assumed to be
            // installed.
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'jquery.qtip-1.0.0-rc3.js',
            ),
          ),
          'minified' => array(
            'files' => array(
              'js' => array(
                'jquery.qtip-1.0.0-rc3.min.js',
              ),
            ),
            // Without a variant callback, the variant is assumed to be
            // installed.
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'jquery.qtip-1.0.0-rc3.min.js',
            ),
          ),
        ),
      ),
    ),
  );

  // NOTE: Rickshaw does not declare a version.
  $libraries['rickshaw'] = array(
    'name' => 'Rickshaw',
    'vendor url' => 'http://code.shutterstock.com/rickshaw/',
    'download url' => 'https://github.com/shutterstock/rickshaw',
    'version callback' => '_acquia_lift_libraries_get_version',
    'variant order' => array(
      'minified',
      'source',
    ),
    'version arguments' => array(
      'variants' => array(
        'source' => array(
          'file' => 'rickshaw.js',
          'pattern' => '/(Rickshaw)/',
        ),
        'minified' => array(
          'file' => 'rickshaw.min.js',
          'pattern' => '/(Rickshaw)/',
        ),
      ),
    ),
    'versions' => array(
      // Rickshaw does not define versions but this will at least test to see
      // if it is installed.
      'Rickshaw' => array(
        'variants' => array(
          'source' => array(
            'name' => 'Rickshaw',
            'files' => array(
              'js' => array(
                'rickshaw.js',
              ),
              'css' => array(
                'rickshaw.css',
              ),
            ),
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'rickshaw.js',
            ),
            'dependencies' => array(
              'd3 (>=3.3.6)',
            ),
          ),
          'minified' => array(
            'name' => 'Rickshaw',
            'files' => array(
              'js' => array(
                'rickshaw.min.js',
              ),
              'css' => array(
                'rickshaw.min.css',
              ),
            ),
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'rickshaw.min.js',
            ),
            'dependencies' => array(
              'd3 (>=3.3.6)',
            ),
          ),
        ),
      ),
    ),
  );
  $libraries['d3'] = array(
    'name' => 'D3',
    'vendor url' => 'http://d3js.org',
    'download url' => 'https://github.com/mbostock/d3',
    'version callback' => '_acquia_lift_libraries_get_version',
    'variant order' => array(
      'minified',
      'source',
    ),
    'version arguments' => array(
      'variants' => array(
        'source' => array(
          'file' => 'd3.js',
          'pattern' => '/version: "(\\d\\.\\d{1,2}\\.\\d{0,3})"/',
        ),
        'minified' => array(
          'file' => 'd3.min.js',
          'pattern' => '/{version:"(\\d\\.\\d{1,2}\\.\\d{0,3})"}/',
        ),
      ),
    ),
    'versions' => array(
      // Means ">=1.0.0": matches 1.0.0, 1.1.0, etc.
      '3.3.6' => array(
        'variants' => array(
          'source' => array(
            'name' => 'D3',
            'files' => array(
              'js' => array(
                'd3.js',
              ),
            ),
            // Without a variant callback, the variant is assumed to not be
            // installed.
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'd3.js',
            ),
          ),
          'minified' => array(
            'name' => 'D3',
            'files' => array(
              'js' => array(
                'd3.min.js',
              ),
            ),
            // Without a variant callback, the variant is assumed to not be
            // installed.
            'variant callback' => '_acquia_lift_libraries_variant_exists',
            'variant arguments' => array(
              'd3.min.js',
            ),
          ),
        ),
      ),
    ),
  );
  return $libraries;
}