\Tailor\Config::set('styles_dir', path($assets_dir, 'css')); \Tailor\Config::set('scripts_dir', path($assets_dir, 'js')); if (arg('b build')) { say("\n \\cwhite,blue(**COMPILING**)\\c"); } else { say("\n \\cwhite,magenta(**WATCHING**)\\c\n Press \\bwhite(CTRL+C)\\b to exit"); } say("\n *From*: {$source_dir}\n *To*: {$output_dir}\n"); $cache_file = path($target_dir, '.cache'); $cache = explode("\n", read($cache_file)) ?: array(); $timeout = (int) arg('t to') ?: 3; if ($recreate) { require path(__DIR__, 'create_skeleton.php'); } elseif (arg('r reset')) { $cache = array(); \IO\Dir::unfile($output_dir, '*', TRUE); is_dir($output_dir) or mkdir($output_dir, 0755, TRUE); status('reset'); } if (arg('b build')) { $a = microtime(TRUE); $cache = array(); $timeout = 0; require path(__DIR__, 'do_compile.php'); $diff = round(microtime(TRUE) - $a, 4); say("\n *Done*: {$diff}s\n"); } else { \Sauce\Shell\CLI::main(function () use(&$cache, $target_dir, $assets_dir, $source_dir, $output_dir, $timeout) { require path(__DIR__, 'do_compile.php'); }); }
$set = array('font' => arg('f fonts all'), 'img' => arg('i images all'), 'css' => arg('c styles all'), 'js' => arg('j scripts all')); if (s3_handle()) { s3_clean_bucket($set); } else { $static_dir = path(APP_PATH, 'static'); is_dir($static_dir) or mkdir($static_dir, 0777); foreach ($set as $type => $ok) { $files_dir = path($static_dir, $type); if (is_dir($files_dir) && $ok) { status('remove', "static/{$type}"); \IO\Dir::unfile($files_dir, '*', TRUE); } is_dir($files_dir) or mkdir($files_dir, 0777); } } if (arg('v views all')) { status('remove', 'cache'); $cache_dir = path(APP_PATH, 'app', 'cache'); is_dir($cache_dir) && \IO\Dir::unfile($cache_dir, '*.*', TRUE); is_dir($cache_dir) or mkdir($cache_dir); chmod($cache_dir, 0777); } // TODO: unset from cache? if (arg('r reset all')) { $res_file = path(APP_PATH, 'config', 'resources.php'); write($res_file, "<?php return array();\n"); status('update', 'config/resources.php'); } } else { error("\n Nothing to do\n"); }
<?php $name = array_shift($params); $test = realpath(dirname($name)); if (!$name) { error("\n Missing application name\n"); } elseif (!is_dir($test)) { error("\n Can't create the directory\n"); } else { $app_path = path($test, basename($name)); if (!arg('f force') && is_dir($app_path)) { error("\n Directory '{$name}' already exists\n"); } else { arg('D delete-all') && \IO\Dir::unfile($app_path, '*', TRUE); require path(__DIR__, 'create_application.php'); } }