-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure locations to put plugins under packages dir as per https:…
…//wiki.civicrm.org/confluence/display/CRMDOC/Javascript+Reference#JavascriptReference-Location Add script to fetch latest package files Update plugins to latest versions
- Loading branch information
Showing
21 changed files
with
86 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
# Fetch package files | ||
|
||
$packages = array ( | ||
'd3' => array ( | ||
'd3.min.js', | ||
), | ||
'c3' => array ( | ||
'c3.min.js', | ||
'c3.min.css', | ||
), | ||
'pivottable' => array ( | ||
'c3_renderers.min.js', | ||
'd3_renderers.min.js', | ||
'export_renderers.min.js', | ||
'pivot.min.js', | ||
'pivot.min.css', | ||
), | ||
); | ||
|
||
$package_dir = "packages"; | ||
if (!is_dir($package_dir)) { | ||
mkdir($package_dir, 0775); | ||
} | ||
|
||
foreach ($packages as $key => $files) { | ||
$dir = "$package_dir/$key"; | ||
$version_file = "$dir/version"; | ||
if (!is_dir($dir)) { | ||
mkdir($dir, 0775, true); | ||
} | ||
$json = file_get_contents("http://api.cdnjs.com/libraries/$key?fields=version,name,filename"); | ||
$info = json_decode($json, true); | ||
$version = $info['version']; | ||
|
||
if (is_file($version_file) AND is_readable($version_file)) { | ||
$old_json = file_get_contents($version_file); | ||
if ($old_json == $json) { | ||
print "$key is already at latest version: $version\n"; | ||
continue; | ||
} | ||
} | ||
|
||
file_put_contents($version_file, $json); | ||
print "Downloading $key $version\n"; | ||
foreach ($files as $file) { | ||
file_put_contents("$dir/$file", fopen("https://cdnjs.cloudflare.com/ajax/libs/$key/$version/$file", 'r')); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.