@@ -10,122 +10,122 @@ |
||
| 10 | 10 | |
| 11 | 11 | class Installer |
| 12 | 12 | { |
| 13 | - const TEST_FOLDER = 'tests'; |
|
| 13 | + const TEST_FOLDER = 'tests'; |
|
| 14 | 14 | |
| 15 | - public static function install($app = 'application') |
|
| 16 | - { |
|
| 17 | - self::recursiveCopy( |
|
| 18 | - dirname(__FILE__) . '/application/tests', |
|
| 19 | - $app . '/' . static::TEST_FOLDER |
|
| 20 | - ); |
|
| 21 | - self::fixPath($app); |
|
| 22 | - } |
|
| 15 | + public static function install($app = 'application') |
|
| 16 | + { |
|
| 17 | + self::recursiveCopy( |
|
| 18 | + dirname(__FILE__) . '/application/tests', |
|
| 19 | + $app . '/' . static::TEST_FOLDER |
|
| 20 | + ); |
|
| 21 | + self::fixPath($app); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Fix paths in Bootstrap.php |
|
| 26 | - */ |
|
| 27 | - private static function fixPath($app = 'application') |
|
| 28 | - { |
|
| 29 | - $file = $app . '/' . static::TEST_FOLDER . '/Bootstrap.php'; |
|
| 30 | - $contents = file_get_contents($file); |
|
| 24 | + /** |
|
| 25 | + * Fix paths in Bootstrap.php |
|
| 26 | + */ |
|
| 27 | + private static function fixPath($app = 'application') |
|
| 28 | + { |
|
| 29 | + $file = $app . '/' . static::TEST_FOLDER . '/Bootstrap.php'; |
|
| 30 | + $contents = file_get_contents($file); |
|
| 31 | 31 | |
| 32 | - if (! file_exists('system')) { |
|
| 33 | - if (file_exists('vendor/codeigniter/framework/system')) { |
|
| 34 | - $contents = str_replace( |
|
| 35 | - '$system_path = \'../../system\';', |
|
| 36 | - '$system_path = \'../../vendor/codeigniter/framework/system\';', |
|
| 37 | - $contents |
|
| 38 | - ); |
|
| 39 | - } else { |
|
| 40 | - throw new Exception('Can\'t find "system" folder.'); |
|
| 41 | - } |
|
| 42 | - } |
|
| 32 | + if (! file_exists('system')) { |
|
| 33 | + if (file_exists('vendor/codeigniter/framework/system')) { |
|
| 34 | + $contents = str_replace( |
|
| 35 | + '$system_path = \'../../system\';', |
|
| 36 | + '$system_path = \'../../vendor/codeigniter/framework/system\';', |
|
| 37 | + $contents |
|
| 38 | + ); |
|
| 39 | + } else { |
|
| 40 | + throw new Exception('Can\'t find "system" folder.'); |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - if (! file_exists('index.php')) { |
|
| 45 | - if (file_exists('public/index.php')) { |
|
| 46 | - $contents = str_replace( |
|
| 47 | - "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
| 48 | - "define('FCPATH', realpath(dirname(__FILE__).'/../../public').'/');", |
|
| 49 | - $contents |
|
| 50 | - ); |
|
| 51 | - } elseif (file_exists($app . '/public/index.php')) { |
|
| 52 | - $contents = str_replace( |
|
| 53 | - "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
| 54 | - "define('FCPATH', realpath(dirname(__FILE__).'/../public').'/');", |
|
| 55 | - $contents |
|
| 56 | - ); |
|
| 57 | - if ($app != 'application') { |
|
| 58 | - $contents = str_replace( |
|
| 59 | - "\$application_folder = '../../application';", |
|
| 60 | - "\$application_folder = '../../{$app}';", |
|
| 61 | - $contents |
|
| 62 | - ); |
|
| 63 | - } |
|
| 64 | - } else { |
|
| 65 | - throw new Exception('Can\'t find "index.php".'); |
|
| 66 | - } |
|
| 67 | - } |
|
| 44 | + if (! file_exists('index.php')) { |
|
| 45 | + if (file_exists('public/index.php')) { |
|
| 46 | + $contents = str_replace( |
|
| 47 | + "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
| 48 | + "define('FCPATH', realpath(dirname(__FILE__).'/../../public').'/');", |
|
| 49 | + $contents |
|
| 50 | + ); |
|
| 51 | + } elseif (file_exists($app . '/public/index.php')) { |
|
| 52 | + $contents = str_replace( |
|
| 53 | + "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
|
| 54 | + "define('FCPATH', realpath(dirname(__FILE__).'/../public').'/');", |
|
| 55 | + $contents |
|
| 56 | + ); |
|
| 57 | + if ($app != 'application') { |
|
| 58 | + $contents = str_replace( |
|
| 59 | + "\$application_folder = '../../application';", |
|
| 60 | + "\$application_folder = '../../{$app}';", |
|
| 61 | + $contents |
|
| 62 | + ); |
|
| 63 | + } |
|
| 64 | + } else { |
|
| 65 | + throw new Exception('Can\'t find "index.php".'); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - file_put_contents($file, $contents); |
|
| 70 | - } |
|
| 69 | + file_put_contents($file, $contents); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - public static function update($app = 'application') |
|
| 73 | - { |
|
| 74 | - $target_dir = $app . '/' . static::TEST_FOLDER . '/_ci_phpunit_test'; |
|
| 75 | - self::recursiveUnlink($target_dir); |
|
| 76 | - self::recursiveCopy( |
|
| 77 | - dirname(__FILE__) . '/application/tests/_ci_phpunit_test', |
|
| 78 | - $target_dir |
|
| 79 | - ); |
|
| 80 | - } |
|
| 72 | + public static function update($app = 'application') |
|
| 73 | + { |
|
| 74 | + $target_dir = $app . '/' . static::TEST_FOLDER . '/_ci_phpunit_test'; |
|
| 75 | + self::recursiveUnlink($target_dir); |
|
| 76 | + self::recursiveCopy( |
|
| 77 | + dirname(__FILE__) . '/application/tests/_ci_phpunit_test', |
|
| 78 | + $target_dir |
|
| 79 | + ); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Recursive Copy |
|
| 84 | - * |
|
| 85 | - * @param string $src |
|
| 86 | - * @param string $dst |
|
| 87 | - */ |
|
| 88 | - private static function recursiveCopy($src, $dst) |
|
| 89 | - { |
|
| 90 | - @mkdir($dst, 0755); |
|
| 82 | + /** |
|
| 83 | + * Recursive Copy |
|
| 84 | + * |
|
| 85 | + * @param string $src |
|
| 86 | + * @param string $dst |
|
| 87 | + */ |
|
| 88 | + private static function recursiveCopy($src, $dst) |
|
| 89 | + { |
|
| 90 | + @mkdir($dst, 0755); |
|
| 91 | 91 | |
| 92 | - $iterator = new \RecursiveIteratorIterator( |
|
| 93 | - new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 94 | - \RecursiveIteratorIterator::SELF_FIRST |
|
| 95 | - ); |
|
| 92 | + $iterator = new \RecursiveIteratorIterator( |
|
| 93 | + new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 94 | + \RecursiveIteratorIterator::SELF_FIRST |
|
| 95 | + ); |
|
| 96 | 96 | |
| 97 | - foreach ($iterator as $file) { |
|
| 98 | - if ($file->isDir()) { |
|
| 99 | - @mkdir($dst . '/' . $iterator->getSubPathName()); |
|
| 100 | - } else { |
|
| 101 | - $success = copy($file, $dst . '/' . $iterator->getSubPathName()); |
|
| 102 | - if ($success) { |
|
| 103 | - echo 'copied: ' . $dst . '/' . $iterator->getSubPathName() . PHP_EOL; |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - } |
|
| 107 | - } |
|
| 97 | + foreach ($iterator as $file) { |
|
| 98 | + if ($file->isDir()) { |
|
| 99 | + @mkdir($dst . '/' . $iterator->getSubPathName()); |
|
| 100 | + } else { |
|
| 101 | + $success = copy($file, $dst . '/' . $iterator->getSubPathName()); |
|
| 102 | + if ($success) { |
|
| 103 | + echo 'copied: ' . $dst . '/' . $iterator->getSubPathName() . PHP_EOL; |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * Recursive Unlink |
|
| 111 | - * |
|
| 112 | - * @param string $dir |
|
| 113 | - */ |
|
| 114 | - private static function recursiveUnlink($dir) |
|
| 115 | - { |
|
| 116 | - $iterator = new \RecursiveIteratorIterator( |
|
| 117 | - new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 118 | - \RecursiveIteratorIterator::CHILD_FIRST |
|
| 119 | - ); |
|
| 109 | + /** |
|
| 110 | + * Recursive Unlink |
|
| 111 | + * |
|
| 112 | + * @param string $dir |
|
| 113 | + */ |
|
| 114 | + private static function recursiveUnlink($dir) |
|
| 115 | + { |
|
| 116 | + $iterator = new \RecursiveIteratorIterator( |
|
| 117 | + new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 118 | + \RecursiveIteratorIterator::CHILD_FIRST |
|
| 119 | + ); |
|
| 120 | 120 | |
| 121 | - foreach ($iterator as $file) { |
|
| 122 | - if ($file->isDir()) { |
|
| 123 | - rmdir($file); |
|
| 124 | - } else { |
|
| 125 | - unlink($file); |
|
| 126 | - } |
|
| 127 | - } |
|
| 121 | + foreach ($iterator as $file) { |
|
| 122 | + if ($file->isDir()) { |
|
| 123 | + rmdir($file); |
|
| 124 | + } else { |
|
| 125 | + unlink($file); |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - rmdir($dir); |
|
| 130 | - } |
|
| 129 | + rmdir($dir); |
|
| 130 | + } |
|
| 131 | 131 | } |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | public static function install($app = 'application') |
| 16 | 16 | { |
| 17 | 17 | self::recursiveCopy( |
| 18 | - dirname(__FILE__) . '/application/tests', |
|
| 19 | - $app . '/' . static::TEST_FOLDER |
|
| 18 | + dirname(__FILE__).'/application/tests', |
|
| 19 | + $app.'/'.static::TEST_FOLDER |
|
| 20 | 20 | ); |
| 21 | 21 | self::fixPath($app); |
| 22 | 22 | } |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | private static function fixPath($app = 'application') |
| 28 | 28 | { |
| 29 | - $file = $app . '/' . static::TEST_FOLDER . '/Bootstrap.php'; |
|
| 29 | + $file = $app.'/'.static::TEST_FOLDER.'/Bootstrap.php'; |
|
| 30 | 30 | $contents = file_get_contents($file); |
| 31 | 31 | |
| 32 | - if (! file_exists('system')) { |
|
| 32 | + if ( ! file_exists('system')) { |
|
| 33 | 33 | if (file_exists('vendor/codeigniter/framework/system')) { |
| 34 | 34 | $contents = str_replace( |
| 35 | 35 | '$system_path = \'../../system\';', |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if (! file_exists('index.php')) { |
|
| 44 | + if ( ! file_exists('index.php')) { |
|
| 45 | 45 | if (file_exists('public/index.php')) { |
| 46 | 46 | $contents = str_replace( |
| 47 | 47 | "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
| 48 | 48 | "define('FCPATH', realpath(dirname(__FILE__).'/../../public').'/');", |
| 49 | 49 | $contents |
| 50 | 50 | ); |
| 51 | - } elseif (file_exists($app . '/public/index.php')) { |
|
| 51 | + } elseif (file_exists($app.'/public/index.php')) { |
|
| 52 | 52 | $contents = str_replace( |
| 53 | 53 | "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
| 54 | 54 | "define('FCPATH', realpath(dirname(__FILE__).'/../public').'/');", |
@@ -71,10 +71,10 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public static function update($app = 'application') |
| 73 | 73 | { |
| 74 | - $target_dir = $app . '/' . static::TEST_FOLDER . '/_ci_phpunit_test'; |
|
| 74 | + $target_dir = $app.'/'.static::TEST_FOLDER.'/_ci_phpunit_test'; |
|
| 75 | 75 | self::recursiveUnlink($target_dir); |
| 76 | 76 | self::recursiveCopy( |
| 77 | - dirname(__FILE__) . '/application/tests/_ci_phpunit_test', |
|
| 77 | + dirname(__FILE__).'/application/tests/_ci_phpunit_test', |
|
| 78 | 78 | $target_dir |
| 79 | 79 | ); |
| 80 | 80 | } |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | foreach ($iterator as $file) { |
| 98 | 98 | if ($file->isDir()) { |
| 99 | - @mkdir($dst . '/' . $iterator->getSubPathName()); |
|
| 99 | + @mkdir($dst.'/'.$iterator->getSubPathName()); |
|
| 100 | 100 | } else { |
| 101 | - $success = copy($file, $dst . '/' . $iterator->getSubPathName()); |
|
| 101 | + $success = copy($file, $dst.'/'.$iterator->getSubPathName()); |
|
| 102 | 102 | if ($success) { |
| 103 | - echo 'copied: ' . $dst . '/' . $iterator->getSubPathName() . PHP_EOL; |
|
| 103 | + echo 'copied: '.$dst.'/'.$iterator->getSubPathName().PHP_EOL; |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of ci-phpunit-test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of ci-phpunit-test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | require __DIR__ . '/Installer.php'; |
| 12 | 12 | |
| 13 | 13 | $app = 'application'; |
| 14 | 14 | if ($argv && $argv[1] && is_dir($argv[1])) { |
| 15 | - $app = $argv[1]; |
|
| 15 | + $app = $argv[1]; |
|
| 16 | 16 | } |
| 17 | 17 | $installer = new Installer(); |
| 18 | 18 | $installer->install($app); |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of ci-phpunit-test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of ci-phpunit-test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | require __DIR__ . '/Installer.php'; |
| 12 | 12 | |
| 13 | 13 | $app = 'application'; |
| 14 | 14 | if ($argv && $argv[1] && is_dir($argv[1])) { |
| 15 | - $app = $argv[1]; |
|
| 15 | + $app = $argv[1]; |
|
| 16 | 16 | } |
| 17 | 17 | $installer = new Installer(); |
| 18 | 18 | $installer->update($app); |