Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Convert Bob Tasks to Bob TaskLibrary, fixes #38

  • Loading branch information...
commit 90211321030fb08ba777cb1c52cc5b000bbf0516 1 parent 8277c9e
@CHH authored
View
30 bob/pipe_tasks.php
@@ -1,30 +0,0 @@
-<?php
-
-namespace Bob\BuildConfig;
-
-use Pipe\Config,
- Pipe\Manifest;
-
-function config()
-{
- static $config;
- return $config ?: $config = Config::fromYaml("pipe_config.yml");
-}
-
-function env()
-{
- static $env;
- return $env ?: $env = config()->createEnvironment();
-}
-
-desc("Dumps all assets.");
-task("assets:dump", function() {
- $config = config();
- $targetDir = @$_ENV["TARGET_DIR"] ?: $config->precompilePrefix;
-
- $manifest = new Manifest(env(), "$targetDir/manifest.json", $targetDir);
- $manifest->compress = true;
-
- $manifest->compile($config->precompile);
-});
-
View
2  bob_config.php
@@ -2,6 +2,8 @@
namespace Bob\BuildConfig;
+register(new \Pipe\Bob\PipeTaskLibrary);
+
task('default', array('test'));
task('test', array('phpunit.xml'), function() {
View
6 composer.json
@@ -27,16 +27,16 @@
"monolog/monolog": "~1.0"
},
"suggest": {
- "react/http": "Enable the standalone asset server",
+ "react/http": "Enable the standalone asset server (~0.2.0)",
"symfony/http-foundation": "Enable dynamic asset serving with Pipe\\Server",
"imagine/imagine": "Enable image compressors"
},
"require-dev": {
- "react/http": "~0.2",
+ "react/http": "~0.2.0",
"symfony/http-foundation": "~2.1",
"imagine/imagine": "~0.4",
"mikey179/vfsStream": "~1.1",
- "chh/bob": "*@dev"
+ "chh/bob": "1.0.*@dev"
},
"autoload": {
"psr-0": {
View
30 lib/Pipe/Bob/PipeTaskLibrary.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Pipe\Bob;
+
+use Bob\TaskLibraryInterface;
+use Bob\Application;
+use Bob\BuildConfig as b;
+
+class PipeTaskLibrary implements TaskLibraryInterface
+{
+ function register(Application $app)
+ {
+ $app['pipe.environment'] = $app->share(function() use ($app) {
+ return new Environment;
+ });
+ }
+
+ function boot(Application $app)
+ {
+ $app->task('pipe:precompile', function() use ($app) {
+ $targetDirectory = $app['pipe.precompile_directory'];
+ $assets = (array) $app['pipe.precompile'];
+
+ $manifest = new Manifest($app['pipe.environment'], "$targetDirectory/manifest.json", $targetDirectory);
+ $manifest->setLogger($app['log']);
+ $manifest->compile($assets);
+ })->description = "Precompile assets";
+ }
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.