Browse files

Added concat compiler to bundlers. Locale cache will only be used if …

…dir exists. Cache dirs will be init'd on install.
  • Loading branch information...
1 parent 89d5e32 commit 77a6e172333f25783fdb23897f71bf9e6c279207 @balupton balupton committed Nov 10, 2010
View
1 .gitignore
@@ -0,0 +1 @@
+*.esproj
View
4 lib/Bal/App.php
@@ -231,7 +231,7 @@ public function setup ( ) {
LIBRARY_PATH.' '.MODELS_PATH.' '.MODELS_BASE_PATH.' '.CONFIG_COMPILED_PATH.' '.
DATA_DUMP_PATH.' '.DATA_SCHEMA_COMPILED_PATH.' '.DATABASES_PATH.' '.
MEDIA_PATH.' '.MEDIA_DELETED_PATH.' '.MEDIA_UPLOADS_PATH.' '.MEDIA_IMAGES_PATH.' '.MEDIA_INVOICES_PATH.' '.
- LOGS_PATH.' '.LOGS_PAYMENT_PATH.' '.CACHE_PATH.' '.CACHE_STYLES_PATH.' '.CACHE_SCRIPTS_PATH,
+ LOGS_PATH.' '.LOGS_PAYMENT_PATH.' '.CACHE_PATH.' '.CACHE_LOCALE_PATH.' '.CACHE_STYLES_PATH.' '.CACHE_SCRIPTS_PATH,
// Standard Files
"chmod -R 755 ".
APPLICATION_ROOT_PATH,
@@ -240,7 +240,7 @@ public function setup ( ) {
MODELS_PATH.' '.MODELS_BASE_PATH.' '.CONFIG_COMPILED_PATH.' '.
DATA_DUMP_PATH.' '.DATA_SCHEMA_COMPILED_PATH.' '.DATABASES_PATH.' '.
MEDIA_PATH.' '.MEDIA_DELETED_PATH.' '.MEDIA_UPLOADS_PATH.' '.MEDIA_IMAGES_PATH.' '.MEDIA_INVOICES_PATH.' '.
- LOGS_PATH.' '.LOGS_PAYMENT_PATH.' '.CACHE_PATH,
+ LOGS_PATH.' '.LOGS_PAYMENT_PATH.' '.CACHE_PATH.' '.CACHE_LOCALE_PATH.' '.CACHE_STYLES_PATH.' '.CACHE_SCRIPTS_PATH,
// Executable Files
"chmod +x ".
APPLICATION_ROOT_PATH.' '.
View
26 lib/Bal/Bootstrap.php
@@ -12,18 +12,20 @@ protected function _initLocale ( ) {
$this->bootstrap('balphp');
# Set Local Cache
- $Cache = Zend_Cache::factory(
- 'Core',
- 'File',
- array(
- 'lifetime' => 120,
- 'automatic_serialization' => true
- ),
- array(
- 'cache_dir' => CACHE_LOCALE_PATH
- )
- );
- Zend_Currency::setCache($Cache);
+ if ( is_dir(CACHE_LOCALE_PATH) ) {
+ $Cache = Zend_Cache::factory(
+ 'Core',
+ 'File',
+ array(
+ 'lifetime' => 120,
+ 'automatic_serialization' => true
+ ),
+ array(
+ 'cache_dir' => CACHE_LOCALE_PATH
+ )
+ );
+ Zend_Currency::setCache($Cache);
+ }
# Locale
$Locale = new Bal_Locale($this->getOption('locale'));
View
14 lib/Bal/View/Helper/App.php
@@ -157,8 +157,8 @@ public function headLink ( array $options = array() ) {
# Options
$default = array_merge(
array(
- 'bundle' => APPLICATION_ENV !== 'development',
- 'minify' => APPLICATION_ENV !== 'development',
+ 'bundle' => true,
+ 'minify' => true,
'csscaffold' => false,
'scaffold' => false,
'favicon' => true,
@@ -182,7 +182,7 @@ public function headLink ( array $options = array() ) {
# Bundle
if ( $bundle )
$headLink = $this->view->getHelper('headLinkBundler')
- ->setCompiler($this->getApp('compiler.style.code'))
+ ->setCompiler($this->getConfig('compiler.style.code'))
->setCompiledOffset($compiled);
else
$headLink = $this->view->getHelper('headLink');
@@ -329,8 +329,8 @@ public function headScript ( array $options = array() ) {
# Options
$default = array_merge(
array(
- 'bundle' => APPLICATION_ENV !== 'development',
- 'minify' => APPLICATION_ENV !== 'development',
+ 'bundle' => true,
+ 'minify' => true,
'modernizr' => 100,
'json' => 110,
'ie9_js' => 120,
@@ -354,8 +354,8 @@ public function headScript ( array $options = array() ) {
# Bundle
if ( $bundle )
$headScript = $this->view->getHelper('HeadScriptBundler')
- ->setCompiler($this->getApp('compiler.script.code'))
- ->setCompilerPath($this->getApp('compiler.style.path'))
+ ->setCompiler($this->getConfig('compiler.script.code'))
+ ->setCompilerPath($this->getConfig('compiler.style.path'))
->setCompiledOffset($compiled);
else
$headScript = $this->view->getHelper('HeadScript');
View
7 lib/Bal/View/Helper/HeadLinkBundler.php
@@ -36,6 +36,13 @@ protected function getCacheUrl ( ) {
# =========================
# Custom: Compilers
+ protected function compileConcat ( $paths, $path ) {
+ file_put_contents($path,'');
+ foreach ( $paths as $file ) {
+ file_put_contents($path,file_get_contents($file),FILE_APPEND);
+ }
+ }
+
protected function compileCsscaffold ( $paths, $path ) {
# Load Scaffold
require_once CSSCAFFOLD_PATH.'/libraries/Bootstrap.php';
View
7 lib/Bal/View/Helper/HeadScriptBundler.php
@@ -39,6 +39,13 @@ protected function getCacheUrl ( ) {
# =========================
# Custom: Compilers
+ protected function compileConcat ( $paths, $path ) {
+ file_put_contents($path,'');
+ foreach ( $paths as $file ) {
+ file_put_contents($path,file_get_contents($file),FILE_APPEND);
+ }
+ }
+
protected function compileClosureWebservice ( $paths, $path ) {
$Compiler = new Bal_Service_GoogleClosure();
$Compiler->compile($paths,$path);

0 comments on commit 77a6e17

Please sign in to comment.