Permalink
Browse files

Removed unneded files and adding a default bootstrap file to add

dispatcher filter to the list
  • Loading branch information...
1 parent d1f8d4d commit fc23f22c486c2a44ac9aaaa9336363aa80e8e5a9 @lorenzo lorenzo committed with Aug 25, 2012
View
@@ -0,0 +1,2 @@
+<?php
+Configure::write('Dispatcher.filters.asset_compress', 'AssetCompress.AssetCompressor');
@@ -1,30 +0,0 @@
-<?php
-App::uses('AppController', 'Controller');
-
-/**
- * Asset Compress base controller. Stubs out some of the controller processes so
- * components in AppController don't interfere with the generation of asset files.
- *
- * @package asset_compress
- * @author Mark Story
- */
-class AssetCompressAppController extends AppController {
-
-/**
- * Stub off the startupProcess so components don't mess around with asset compression
- *
- * @return void
- */
- public function startupProcess() {
- $this->beforeFilter();
- }
-
-/**
- * Stub off the shutDown so components don't mess around with asset compression
- *
- * @return void
- */
- public function shutdownProcess() {
- }
-
-}
@@ -1,81 +0,0 @@
-<?php
-App::uses('AssetCompressAppController', 'AssetCompress.Controller');
-App::uses('AssetConfig', 'AssetCompress.Lib');
-App::uses('AssetCompiler', 'AssetCompress.Lib');
-App::uses('AssetCache', 'AssetCompress.Lib');
-
-class AssetsController extends AssetCompressAppController {
-
- public $uses = array();
-
- public $viewPath = 'Generic';
-
- public $configFile;
-
- protected $_Config;
-
- public function beforeFilter() {
- $this->configFile = APP . 'Config' . DS . 'asset_compress.ini';
- }
-
-/**
- * Get a built file. Use query parameters for dynamic builds.
- * for dynamic builds to work, you must be in debug mode, and not have the same
- * build file already defined.
- *
- * @throws ForbiddenException
- * @throws NotFoundException
- */
- public function get($build) {
- $Config = $this->_getConfig();
- $production = Configure::read('debug') == 0;
-
- if ($production && !$Config->general('alwaysEnableController')) {
- throw new ForbiddenException();
- }
-
- if (
- isset($this->request->params['ext']) &&
- in_array($this->request->params['ext'], $Config->extensions())
- ) {
- $build .= '.' . $this->request->params['ext'];
- }
-
- if (isset($this->request->query['theme'])) {
- $Config->theme($this->request->query['theme']);
- }
-
- // Dynamically defined build file. Disabled in production for
- // hopefully obvious reasons.
- if ($Config->files($build) === array()) {
- $files = array();
- if (isset($this->request->query['file'])) {
- $files = $this->request->query['file'];
- }
- $Config->files($build, $files);
- }
- try {
- $Compiler = new AssetCompiler($Config);
- $contents = $Compiler->generate($build);
- } catch (Exception $e) {
- $message = (Configure::read('debug') > 0) ? $e->getMessage() : '';
- throw new NotFoundException($message);
- }
-
- $this->response->type($Config->getExt($build));
- $this->set('contents', $contents);
- $this->layout = 'script';
- $this->render('contents');
- }
-
-/**
- * Config setter, used for testing the controller.
- */
- protected function _getConfig() {
- if (empty($this->_Config)) {
- $this->_Config = AssetConfig::buildFromIniFile();
- }
- return $this->_Config;
- }
-
-}
View
@@ -20,7 +20,7 @@ Clone or download the plugin into one of your plugin paths. Then make
sure you load the plugin:
// in app/Config/bootstrap.php
- CakePlugin::load('AssetCompress');
+ CakePlugin::load('AssetCompress', array('bootstrap' => true));
Copy the `Config/asset_compress.sample.ini` to `App/Config/asset_compress.ini`. From there
read the [wiki](http://github.com/markstory/asset_compress/wiki) for more information.
@@ -1,4 +0,0 @@
-<?php
-echo $contents;
-Configure::write('debug', 0);
-?>
View
@@ -1 +0,0 @@
-<?php echo $content_for_layout; ?>

0 comments on commit fc23f22

Please sign in to comment.