Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Work on build scripts

  • Loading branch information...
commit e3502e6070b4efc22e5ee67d164af716034462a6 1 parent 4fdea7e
@aembler aembler authored
View
1  .gitignore
@@ -49,4 +49,5 @@ error_log
# ignore node modules used for building
/build/node_modules
+/build/release
/build/Gruntfile.parameters.js
View
26 build/Gruntfile.js
@@ -164,5 +164,31 @@ module.exports = function(grunt) {
require('./tasks/remove-short-tags.js')(grunt, config, parameters, this.async());
});
+ grunt.registerTask('build-release-start', 'Create concrete5 release from Git, run various required functions.', function() {
+ require('./tasks/build-release/start.js')(grunt, config, parameters, this.async());
+ });
+
+ grunt.registerTask('build-release-clean', 'Remove certain dotfiles.', function() {
+ require('./tasks/build-release/clean.js')(grunt, config, parameters, this.async());
+ });
+
+ grunt.registerTask('build-release-finish', 'Create zip file and finish.', function() {
+ require('./tasks/build-release/finish.js')(grunt, config, parameters, this.async());
+ });
+
+ buildTranslationParameters = parameters;
+ buildTranslationParameters.destination = './release/concrete5-master/web';
+
+ buildTagParameters = parameters;
+ buildTagParameters.source = './release/concrete5-master/web';
+
+ grunt.registerTask('build-release-translations', 'Downloading Translations.', function() {
+ require('./tasks/translations.js')(grunt, config, buildTranslationParameters, this.async());
+ });
+
+ grunt.registerTask('build-release-remove-short-tags', 'Remove short tags.', function() {
+ require('./tasks/remove-short-tags.js')(grunt, config, buildTagParameters, this.async());
+ });
+
grunt.registerTask('default', 'release');
};
View
5 build/package.json
@@ -5,6 +5,9 @@
"grunt": "~0.4.1",
"grunt-contrib-uglify": "~0.2.4",
"grunt-contrib-less": "~0.7.0",
- "grunt-contrib-cssmin": "~0.6.2"
+ "grunt-contrib-cssmin": "~0.6.2",
+ "rimraf": "2.1",
+ "download": "0.1.10",
+ "execSync": "1.0.1"
}
}
View
37 build/tasks/build-release/clean.js
@@ -0,0 +1,37 @@
+module.exports = function(grunt, config, parameters, done) {
+
+ function endForError(e) {
+ process.stderr.write(e.message || e);
+ done(false);
+ }
+
+ try {
+ var fs = require('fs');
+ path = "./release/concrete5-master/web",
+ cleanFiles = [".DS_Store", ".git", ".gitignore"];
+
+ walk = function(directory, done) {
+ fs.readdir(directory, function(err, list) {
+ list.forEach(function(file) {
+ var item = directory + '/' + file;
+ fs.stat(item, function(err, stat) {
+ if (stat && stat.isDirectory()) {
+ walk(item);
+ } else {
+ if (cleanFiles.indexOf(file) > -1) {
+ process.stdout.write('Deleting File: ' + item + "\n");
+ fs.unlink(item);
+ }
+ }
+ });
+ });
+ });
+ }
+
+ walk(path);
+ }
+ catch(e) {
+ endForError(e);
+ return;
+ }
+};
View
27 build/tasks/build-release/finish.js
@@ -0,0 +1,27 @@
+module.exports = function(grunt, config, parameters, done) {
+
+ function endForError(e) {
+ process.stderr.write(e.message || e);
+ }
+
+ try {
+ var fs = require('fs'),
+ rimraf = require('rimraf');
+
+ var data = fs.readFileSync('./release/concrete5-master/web/concrete/config/version.php', 'utf8');
+ var version = data.match(/\$APP_VERSION = '(.*)'/);
+ if (version[1]) {
+ var directory = 'concrete' + version[1];
+ var execSync = require('exec-sync');
+ fs.renameSync('./release/concrete5-master/web', './release/' + directory);
+ execSync('pushd release/; zip -r ' + directory + '.zip ' + directory + '; popd');
+ rimraf.sync('./release/' + directory);
+ rimraf.sync('./release/concrete5-master');
+ done();
+ }
+ }
+ catch(e) {
+ endForError(e);
+ return;
+ }
+};
View
31 build/tasks/build-release/start.js
@@ -0,0 +1,31 @@
+module.exports = function(grunt, config, parameters, done) {
+
+ function endForError(e) {
+ process.stderr.write(e.message || e);
+ done(false);
+ }
+
+ try {
+ var rimraf = require('rimraf'),
+ fs = require('fs'),
+ download = require('download'),
+ path = "./release";
+
+ rimraf.sync(path);
+ fs.mkdir(path);
+
+ // Download archive from git
+ process.stdout.write("Downloading Archive...\n");
+ download('https://github.com/concrete5/concrete5/archive/master.zip', path, {
+ extract: true,
+ close: function() {
+ done();
+ }
+ });
+
+ }
+ catch(e) {
+ endForError(e);
+ return;
+ }
+};
View
4 build/tasks/remove-short-tags.js
@@ -37,6 +37,10 @@ module.exports = function(grunt, config, parameters, done) {
else {
sourceFolder = webRoot;
}
+
+ if (parameters.source) {
+ sourceFolder = path.resolve(__dirname, '..', parameters.source);
+ }
// Check destination folder
var destinationFolder;
if(parameters.destination) {
View
12 build/tasks/translations.js
@@ -207,6 +207,14 @@ module.exports = function(grunt, config, parameters, done) {
return;
}
var locale = allLocales[localeIndex];
+ var destinationFolder;
+
+ if (parameters.destination) {
+ destinationFolder = path.resolve(__dirname, '..', parameters.destination);
+ } else {
+ destinationFolder = path.resolve(__dirname, config.DIR_BASE);
+ }
+
process.stdout.write('Locale ' + locale.name + '... ');
get('/api/2/project/concrete5/resource/' + parameters.txResource + '/stats/' + locale.code + '/', {type: 'json'}, function(data) {
var tot = data.translated_entities + data.untranslated_entities;
@@ -217,8 +225,8 @@ module.exports = function(grunt, config, parameters, done) {
parseLocale(allLocales, localeIndex + 1, callback);
return;
}
- locale.poFile = path.join(config.DIR_BASE, 'languages/' + locale.code + '/LC_MESSAGES/messages.po');
- locale.moFile = path.join(config.DIR_BASE, 'languages/' + locale.code + '/LC_MESSAGES/messages.mo');
+ locale.poFile = path.join(destinationFolder, 'languages/' + locale.code + '/LC_MESSAGES/messages.po');
+ locale.moFile = path.join(destinationFolder, 'languages/' + locale.code + '/LC_MESSAGES/messages.mo');
downloadLocale(locale, function() {
compileLocale(
locale,
View
2  web/concrete/core/controllers/single_pages/install.php
@@ -31,7 +31,7 @@ class Concrete5_Controller_Install extends Controller {
public $helpers = array('form', 'html');
protected function getLocales() {
- return Localization::getAvailableInterfaceLanguageDescriptions();
+ return Localization::getAvailableInterfaceLanguageDescriptions('en_US');
}
public function view() {
View
5 web/concrete/core/libraries/localization.php
@@ -183,7 +183,10 @@ public static function getLanguageDescription($locale, $displayLocale = null) {
$displayLocale = NULL;
}
- Zend_Locale_Data::setCache(Cache::getLibrary());
+ $cacheLibrary = Cache::getLibrary();
+ if (is_object($cacheLibrary)) {
+ Zend_Locale_Data::setCache($cacheLibrary);
+ }
$displayLocale = $displayLocale?$displayLocale:$locale;
Please sign in to comment.
Something went wrong with that request. Please try again.