コード例 #1
0
 public static function get_all_config_files()
 {
     $all_config_files = array();
     $project_directory = HaddockProjectOrganisation_ProjectDirectoryHelper::get_project_directory();
     /*
      * Get the config files in the module directories.
      */
     foreach ($project_directory->get_module_directories() as $module_directory) {
         if ($module_directory->has_config_directory()) {
             $config_directory = $module_directory->get_config_directory();
             $all_config_files = array_merge($all_config_files, $config_directory->get_all_config_files());
         }
     }
     /*
      * Get the config files that are specific to this
      * instance of the project.
      */
     $instance_specific_config_directory = Configuration_ConfigDirectoriesHelper::get_instance_specific_config_directory();
     $all_config_files = array_merge($all_config_files, $instance_specific_config_directory->get_all_config_files());
     #usort(
     #	$all_config_files,
     #	create_function(
     #		'$a, $b',
     #		'strcmp($a->get_name(), $b->get_name());'
     #	)
     #);
     return $all_config_files;
 }
 public static function test_identifying_names_for_all_modules_are_unique()
 {
     $identifying_names = array();
     $project_directory = HaddockProjectOrganisation_ProjectDirectoryHelper::get_project_directory();
     foreach ($project_directory->get_module_directories() as $module_directory) {
         $identifying_names[] = $module_directory->get_identifying_name();
     }
     return count($identifying_names) == count(array_unique($identifying_names));
 }
 public static function get_module_directory_for_camel_case_root($camel_case_module_root)
 {
     $project_directory = HaddockProjectOrganisation_ProjectDirectoryHelper::get_project_directory();
     foreach ($project_directory->get_module_directories() as $module_directory) {
         if ($module_directory->get_camel_case_root() == $camel_case_module_root) {
             return $module_directory;
         }
     }
     throw new ErrorHandling_SprintfException('Unable to module directory for \'%s\'!', array($camel_case_module_name));
 }
コード例 #4
0
 public static function get_passwords_file()
 {
     #$project_directory_finder
     #	= HaddockProjectOrganisation_ProjectDirectoryFinder::get_instance();
     #
     #$project_directory
     #	= $project_directory_finder->get_project_directory_for_this_project();
     $project_directory = HaddockProjectOrganisation_ProjectDirectoryHelper::get_project_directory();
     $passwords_file = $project_directory->get_passwords_file();
     return $passwords_file;
 }
 public static function test_all_classes_compile_without_writing_to_stdout()
 {
     $project_directory = HaddockProjectOrganisation_ProjectDirectoryHelper::get_project_directory();
     $php_class_files = $project_directory->get_php_class_files();
     $php_cli_interpreter = CLIScripts_InterpreterProgramHelper::get_php_cli_interpreter();
     $temp_dir = Environment_MachineHelper::get_temporary_directory();
     #print_r($temp_dir); exit;
     $tmp_out_file = $temp_dir->get_name() . '/haddock-compilations-tests-out.txt';
     $tmp_err_file = $temp_dir->get_name() . '/haddock-compilations-tests-err.txt';
     $define_debug_constants_file = PROJECT_ROOT . '/haddock/public-html/public-html/' . 'define-debug-constants.inc.php';
     $autoload_inc_file_name = PROJECT_ROOT . '/haddock/haddock-project-organisation/includes/' . 'autoload.inc.php';
     $total_out_length = 0;
     foreach ($php_class_files as $php_class_file) {
         $out_length = 0;
         self::conditionally_unlink_tmp_files($tmp_out_file, $tmp_err_file);
         $tmp_class_file_name = $temp_dir->get_name() . '/haddock-compilations-tests-tmp-' . $php_class_file->get_php_class_name() . '-class.php';
         $fh = fopen($tmp_class_file_name, 'w');
         if ($fh) {
             fwrite($fh, '<?php define(\'PROJECT_ROOT\', \'' . PROJECT_ROOT . '\'); ?>');
             fwrite($fh, file_get_contents($define_debug_constants_file));
             fwrite($fh, file_get_contents($autoload_inc_file_name));
             fwrite($fh, file_get_contents($php_class_file->get_name()));
             fclose($fh);
             $cmd = "{$php_cli_interpreter} -f \"{$tmp_class_file_name}\" >> \"{$tmp_out_file}\" 2>> \"{$tmp_err_file}\"";
             #echo $cmd . PHP_EOL;
             system($cmd);
             $out_length = strlen(file_get_contents($tmp_out_file)) + strlen(file_get_contents($tmp_err_file));
             if ($out_length == 0) {
                 unlink($tmp_class_file_name);
             }
         }
         $total_out_length += $out_length;
         self::conditionally_unlink_tmp_files($tmp_out_file, $tmp_err_file);
     }
     return $total_out_length == 0;
 }
 public static function get_all_module_directories()
 {
     $project_directory = HaddockProjectOrganisation_ProjectDirectoryHelper::get_project_directory();
     return $project_directory->get_module_directories();
 }
 public static function get_project_specific_directory()
 {
     $project_directory = HaddockProjectOrganisation_ProjectDirectoryHelper::get_project_directory();
     return $project_directory->get_project_specific_directory();
 }
 public function do_actions()
 {
     $project_directory = HaddockProjectOrganisation_ProjectDirectoryHelper::get_project_directory();
     $php_class_files = $project_directory->get_php_class_files();
     printf('This project has %d PHP class files.' . PHP_EOL, count($php_class_files));
 }