function drush_prebid_add_library in Doubleclick for Publishers (DFP) 7.2
Moves the prebid.js file to libraries.
1 string reference to 'drush_prebid_add_library'
- prebid_drush_command in prebid/
prebid.drush.inc - Implementation of hook_drush_command().
File
- prebid/
prebid.drush.inc, line 209 - prebid.drush.inc
Code
function drush_prebid_add_library() {
$libraries_path = 'sites/all/libraries/prebidjs';
$library = drupal_get_path('module', 'prebid') . '/js/prebid';
$package = $library . '/package.json';
if (!file_exists($package)) {
make_error('DOWNLOAD_ERROR', dt("Couldn't find the Prebid.js library. Run 'drush help prebid-clone'."));
return FALSE;
}
if (!file_exists($libraries_path)) {
drush_mkdir($libraries_path);
}
$build_path = $library . '/build';
if (!file_exists($build_path)) {
make_error('DOWNLOAD_ERROR', dt("Couldn't find the Prebid.js library. Run 'drush help prebid-build'."));
return FALSE;
}
$dev = $build_path . '/dev';
if (file_exists($dev)) {
$file_path = $dev . '/prebid.js';
}
else {
$file_path = $build_path . '/dist/prebid.js';
}
$command = 'cp ' . $file_path . ' ' . $libraries_path . '/';
drush_log(dt('Copying the built prebid.js file to @libraries_path', array(
'@libraries_path' => $libraries_path,
)), LogLevel::OK);
drush_shell_exec($command);
}