Commit 953b82e6 authored by tstoeckler's avatar tstoeckler

Removed files from deprecated master branch.

parent e455286c
Libraries 7.x-2.x, xxxx-xx-xx
-----------------------------
#1023258 by tstoeckler: Make 'files' consistently keyed by filename.
#958162 by sun, tstoeckler: Add pre-detect callback group.
#958162 by sun, tstoeckler: Make tests debuggable and provide libraries_info_defaults().
#961476 by tstoeckler: Changed libraries_get_path() to return FALSE by default.
#958162 by tstoeckler, sun, good_man: Allow to apply callbacks to libraries.
#1125904 by tstoeckler, boombatower: Fix drush libraries-list.
#1050076 by tstoeckler: Re-utilize libraries_detect() and remove libraries_detect_library().
#466090 by tstoeckler: Add update function.
#466090 by tstoeckler: Allow cache to be flushed.
#466090 by tstoeckler, sun: Cache library information.
#1064008 by tstoeckler, bfroehle: Fix outdated API examples in libraries.api.php.
#1028744 by tstoeckler: Code clean-up.
#1023322 by tstoeckler, sun: Fixed libraries shouldn't be loaded multiple times.
#1024080 by hswong3i, tstoeckler: Fixed installation profile retrieval.
#995988 by good_man: Wrong default install profile.
#975498 by Gábor Hojtsy: Update JS/CSS-loading to new drupal_add_js/css() API.
#958162 by tsteoeckler, sun: Consistent variable naming.
#924130 by aaronbauman: Fixed libraries_get_path() should use drupal_static().
#958162 by tstoeckler, sun: Code clean-up, tests revamp, more robust loading.
#919632 by tstoeckler, sun: Allow library information to be stored in info files.
by sun: Fixed testbot breaks upon directory name/info file name mismatch.
#864376 by tstoeckler, sun: Code-cleanup, allow hard-coded 'version'.
#939174 by sun, tstoeckler: Rename example.info to libraries_example.info.
by sun: Fixed testbot breaks upon .info file without .module file.
#542940 by tstoeckler, sun: Add libraries-list command.
#919632 by tstoeckler: Add example library info file for testing purposes.
#719896 by tstoeckler, sun: Documentation clean-up and tests improvement.
#542940 by sun: Added initial Drush integration file.
#719896 by tstoeckler, sun: Improved library detection and library loading.
#855050 by Gábor Hojtsy: Avoid call-time pass by reference in libraries_detect().
#719896 by tstoeckler, sun: Added starting point for hook_libraries_info().
Libraries 7.x-1.x, xxxx-xx-xx
-----------------------------
Libraries 7.x-1.0, 2010-01-27
-----------------------------
#743522 by sun: Ported to D7.
Libraries 6.x-1.0, 2010-01-27
-----------------------------
#1028744 by tstoeckler: Code clean-up.
#496732 by tstoeckler, robphillips: Allow placing libraries in root directory.
Libraries 6.x-1.0-ALPHA1, 2009-12-30
------------------------------------
#480440 by markus_petrux: Fixed base_path() not applied to default library path.
#320562 by sun: Added basic functions.
-- SUMMARY --
Libraries API provides external library handling for Drupal modules.
For a full description visit the project page:
http://drupal.org/project/libraries
Bug reports, feature suggestions and latest developments:
http://drupal.org/project/issues/libraries
-- REQUIREMENTS --
* None.
-- INSTALLATION --
* Install as usual, see http://drupal.org/node/70151 for further information.
-- CONTACT --
Current maintainers:
* Daniel F. Kudwien (sun) - http://drupal.org/user/54136
* Tobias Stöckler (tstoeckler) - http://drupal.org/user/107158
This project has been sponsored by:
* UNLEASHED MIND
Specialized in consulting and planning of Drupal powered sites, UNLEASHED
MIND offers installation, development, theming, customization, and hosting
to get you started. Visit http://www.unleashedmind.com for more information.
See major version branches.
This diff is collapsed.
<?php
/**
* @file
* Drush integration for Libraries API.
*/
/**
* Implements hook_drush_command().
*/
function libraries_drush_command() {
$items['libraries-list'] = array(
'callback' => 'libraries_drush_list',
'description' => dt('Lists registered library information.'),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
);
/**$items['libraries-download'] = array(
'callback' => 'libraries_drush_download',
'description' => dt('Downloads a registered library into the libraries directory for the active site.'),
'arguments' => array(
'name' => dt('The internal name of the registered library.'),
),
);*/
return $items;
}
/**
* Implements hook_drush_help().
*/
function libraries_drush_help($section) {
switch ($section) {
case 'drush:libraries-list':
return dt('Lists registered library information.');
case 'drush:libraries-download':
return dt('Downloads a registered library into the libraries directory for the active site.
See libraries-list for a list of registered libraries.');
}
}
/**
* Lists registered library information.
*/
function libraries_drush_list() {
$libraries = array();
foreach (libraries_info() as $name => $info) {
$libraries[$name] = libraries_detect($name);
}
ksort($libraries);
if (empty($libraries)) {
drush_print('There are no registered libraries.');
}
else {
$header = array('Name', 'Status', 'Version', 'Variants');
$rows = array();
foreach ($libraries as $name => $library) {
// Status and version
if ($library['installed']) {
$status = 'OK';
$version = $library['version'];
}
else {
$status = drupal_ucfirst($library['error']);
$version = (empty($library['version']) ? '-' : $library['version']);
}
// Variants
$variants = array();
foreach ($library['variants'] as $variant_name => $variant) {
if ($variant['installed']) {
$variants[] = $variant_name;
}
}
if (empty($variants)) {
$variants = '-';
}
else {
$variants = implode(', ', $variants);
}
$rows[] = array($name, $status, $version, $variants);
}
$table = new Console_Table();
drush_print($table->fromArray($header, $rows));
}
}
/**
* Downloads a library.
*
* @param $name
* The internal name of the library to download.
*/
function libraries_drush_download($name) {
return;
// @todo Looks wonky?
if (!drush_shell_exec('type unzip')) {
return drush_set_error(dt('Missing dependency: unzip. Install it before using this command.'));
}
// @todo Simply use current drush site.
$args = func_get_args();
if ($args[0]) {
$path = $args[0];
}
else {
$path = 'sites/all/libraries';
}
// Create the path if it does not exist.
if (!is_dir($path)) {
drush_op('mkdir', $path);
drush_log(dt('Directory @path was created', array('@path' => $path)), 'notice');
}
// Set the directory to the download location.
$olddir = getcwd();
chdir($path);
$filename = basename(COLORBOX_DOWNLOAD_URI);
$dirname = basename(COLORBOX_DOWNLOAD_URI, '.zip');
// Remove any existing Colorbox plugin directory
if (is_dir($dirname)) {
drush_log(dt('A existing Colorbox plugin was overwritten at @path', array('@path' => $path)), 'notice');
}
// Remove any existing Colorbox plugin zip archive
if (is_file($filename)) {
drush_op('unlink', $filename);
}
// Download the zip archive
if (!drush_shell_exec('wget '. COLORBOX_DOWNLOAD_URI)) {
drush_shell_exec('curl -O '. COLORBOX_DOWNLOAD_URI);
}
if (is_file($filename)) {
// Decompress the zip archive
drush_shell_exec('unzip -qq -o '. $filename);
// Remove the zip archive
drush_op('unlink', $filename);
}
// Set working directory back to the previous working directory.
chdir($olddir);
if (is_dir($path .'/'. $dirname)) {
drush_log(dt('Colorbox plugin has been downloaded to @path', array('@path' => $path)), 'success');
}
else {
drush_log(dt('Drush was unable to download the Colorbox plugin to @path', array('@path' => $path)), 'error');
}
}
name = Libraries
description = Allows version dependent and shared usage of external libraries.
core = 7.x
files[] = tests/libraries.test
<?php
/**
* @file
* Install, uninstall, and update functions for libraries.module.
*/
/**
* Implements hook_schema().
*/
function libraries_schema() {
$schema['cache_libraries'] = drupal_get_schema_unprocessed('system', 'cache');
$schema['cache_libraries']['description'] = 'Cache table to store library information';
return $schema;
}
/**
* Create the 'cache_libraries' table.
*/
function libraries_update_7200() {
if (!db_table_exists('cache_libraries')) {
$specs = drupal_get_schema_unprocessed('system', 'cache');
db_create_table('cache_libraries', $specs);
}
}
This diff is collapsed.
Example library
Version 1
This file is an example file to test version detection.
The various other files in this directory are to test the loading of JavaScript,
CSS and PHP files.
- JavaScript: The filenames of the JavaScript files are asserted to be in the
raw HTML via SimpleTest. Since the filename could appear, for instance, in an
error message, this is not very robust. Explicit testing of JavaScript,
though, is not yet possible with SimpleTest. To allow for easier debugging, we
place the following text on the page:
"If this text shows up, no JavaScript test file was loaded."
This text is replaced via JavaScript by a text of the form:
"If this text shows up, [[file] was loaded successfully."
[file] is either 'example_1.js', 'example_2.js', 'example_3.js',
'example_4.js' or 'libraries_test.js'. If you have SimpleTest's verbose mode
enabled and see the above text in one of the debug pages, the noted JavaScript
file was loaded successfully.
- CSS: The filenames of the CSS files are asserted to be in the raw HTML via
SimpleTest. Since the filename could appear, for instance, in an error
message, this is not very robust. Explicit testing of CSS, though, is not yet
possible with SimpleTest. Hence, the CSS files, if loaded, make the following
text a certain color:
"If one of the CSS test files has been loaded, this text will be colored:
- example_1: red
- example_2: green
- example_3: orange
- example_4: blue
- libraries_test: purple"
If you have SimpleTest's verbose mode enabled, and see the above text in a
certain color (i.e. not in black), a CSS file was loaded successfully. Which
file depends on the color as referenced in the text above.
- PHP: The loading of PHP files is tested by defining a dummy function in the
PHP files and then checking whether this function was defined using
function_exists(). This can be checked programatically with SimpleTest.
The loading of integration files is tested with the same method. The integration
files are libraries_test.js, libraries_test.css, libraries_test.inc and are
located in the tests directory alongside libraries_test.module (i.e. they are
not in the same directory as this file).
/**
* @file
* Test CSS file for Libraries loading.
*
* Color the 'libraries-test-css' div red. See README.txt for more information.
*/
.libraries-test-css {
color: red;
}
/**
* @file
* Test JavaScript file for Libraries loading.
*
* Replace the text in the 'libraries-test-javascript' div. See README.txt for
* more information.
*/
(function ($) {
Drupal.behaviors.librariesTest = {
attach: function(context, settings) {
$('.libraries-test-javascript').text('If this text shows up, example_1.js was loaded successfully.')
}
};
})(jQuery);
<?php
/**
* @file
* Test PHP file for Libraries loading.
*/
/**
* Dummy function to see if this file was loaded.
*/
function _libraries_test_example_1() {
}
/**
* @file
* Test CSS file for Libraries loading.
*
* Color the 'libraries-test-css' div green. See README.txt for more information.
*/
.libraries-test-css {
color: green;
}
/**
* @file
* Test JavaScript file for Libraries loading.
*
* Replace the text in the 'libraries-test-javascript' div. See README.txt for
* more information.
*/
(function ($) {
Drupal.behaviors.librariesTest = {
attach: function(context, settings) {
$('.libraries-test-javascript').text('If this text shows up, example_2.js was loaded successfully.')
}
};
})(jQuery);
<?php
/**
* @file
* Test PHP file for Libraries loading.
*/
/**
* Dummy function to see if this file was loaded.
*/
function _libraries_test_example_2() {
}
/**
* @file
* Test CSS file for Libraries loading.
*
* Color the 'libraries-test-css' div orange. See README.txt for more information.
*/
.libraries-test-css {
color: orange;
}
/**
* @file
* Test JavaScript file for Libraries loading.
*
* Replace the text in the 'libraries-test-javascript' div. See README.txt for
* more information.
*/
(function ($) {
Drupal.behaviors.librariesTest = {
attach: function(context, settings) {
$('.libraries-test-javascript').text('If this text shows up, example_3.js was loaded successfully.')
}
};
})(jQuery);
<?php
/**
* @file
* Test PHP file for Libraries loading.
*/
/**
* Dummy function to see if this file was loaded.
*/
function _libraries_test_example_3() {
}
/**
* @file
* Test CSS file for Libraries loading.
*
* Color the 'libraries-test-css' div blue. See README.txt for more information.
*/
.libraries-test-css {
color: blue;
}
/**
* @file
* Test JavaScript file for Libraries loading.
*
* Replace the text in the 'libraries-test-javascript' div. See README.txt for
* more information.
*/
(function ($) {
Drupal.behaviors.librariesTest = {
attach: function(context, settings) {
$('.libraries-test-javascript').text('If this text shows up, example_4.js was loaded successfully.')
}
};
})(jQuery);
<?php
/**
* @file
* Test PHP file for Libraries loading.
*/
/**
* Dummy function to see if this file was loaded.
*/
function _libraries_test_example_4() {
}
; This is an example info file of a library used for testing purposes.
name = Example info file
This diff is collapsed.
/**
* @file
* Test CSS file for Libraries loading.
*
* Color the 'libraries-test-css' div purple. See README.txt for more
* information.
*/
.libraries-test-css {
color: purple;
}
<?php
/**
* @file
* Test PHP file for Libraries loading.
/**
* Dummy function to see if this file was loaded.
*/
function _libraries_test_integration_file() {
}
name = Libraries test module
description = Tests library detection and loading.
core = 7.x
dependencies[] = libraries
hidden = TRUE
/**
* @file
* Test JavaScript file for Libraries loading.
*
* Replace the text in the 'libraries-test-javascript' div. See README.txt for
* more information.
*/
(function ($) {
Drupal.behaviors.librariesTest = {
attach: function(context, settings) {
$('.libraries-test-javascript').text('If this text shows up, libraries_test.js was loaded successfully.')
}
};
})(jQuery);
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment