Display verbose output only if --verbose is set.

Report at the end, a quick summary of the installation.
This commit is contained in:
Jocelyn Fiat
2017-10-04 18:20:48 +02:00
parent 92925169b4
commit 6b4b3f3539

View File

@@ -125,6 +125,7 @@ feature -- Execution
l_dest_dir: DIRECTORY l_dest_dir: DIRECTORY
l_cp_params: ROC_INSTALL_COPY_PARAMETERS l_cp_params: ROC_INSTALL_COPY_PARAMETERS
i,n: INTEGER i,n: INTEGER
l_modules_count, l_themes_count, l_global_file_changes, l_errors_count: INTEGER
do do
create l_module_source_locations.make (1) create l_module_source_locations.make (1)
create l_theme_source_locations.make (1) create l_theme_source_locations.make (1)
@@ -249,6 +250,7 @@ feature -- Execution
end end
end end
elseif l_config_path /= Void then elseif l_config_path /= Void then
l_errors_count := l_errors_count + 1
localized_print_error ({STRING_32} "Unable to read configuration file %"" + l_config_path.name + "%"!%N") localized_print_error ({STRING_32} "Unable to read configuration file %"" + l_config_path.name + "%"!%N")
end end
@@ -270,6 +272,7 @@ feature -- Execution
-- Install configuration files. -- Install configuration files.
create l_site_dir.make_with_path (l_site_path) create l_site_dir.make_with_path (l_site_path)
if l_site_dir.exists then if l_site_dir.exists then
l_modules_count := l_modules_count + 1
create l_modules_dir.make_with_path (l_site_path.extended ("modules")) create l_modules_dir.make_with_path (l_site_path.extended ("modules"))
if not l_modules_dir.exists then if not l_modules_dir.exists then
l_modules_dir.create_dir l_modules_dir.create_dir
@@ -279,24 +282,38 @@ feature -- Execution
if not l_dest_dir.exists then if not l_dest_dir.exists then
l_dest_dir.create_dir l_dest_dir.create_dir
end end
print ("Install module ") if is_verbose then
print (l_mod_name) print ("Install module ")
print (" in %"") print (l_mod_name)
print (l_dest_dir.path.name) print (" in %"")
print ("%":%N") print (l_dest_dir.path.name)
install_module_elements (l_mod_name, l_module_source_path, l_dest_dir.path, Void) print ("%":%N")
-- install_module_elements (l_module_source_path, l_dest_dir.path, Config_dir) end
-- install_module_elements (l_module_source_path, l_dest_dir.path, Scripts_dir) install_module_elements (l_mod_name, l_module_source_path, l_dest_dir.path, Void)
-- install_module_elements (l_module_source_path, l_dest_dir.path, Themes_dir) l_global_file_changes := l_global_file_changes + files_changes_count
if is_verbose then
print (" - ") print (" - ")
print (directories_count.out + " director" + if directories_count > 1 then "ies" else "y" end + ", ") print (directories_count.out + " director" + if directories_count > 1 then "ies" else "y" end + ", ")
print (files_count.out + " file" + if files_count > 1 then "s" else "" end) print (files_count.out + " file" + if files_count > 1 then "s" else "" end)
if files_changes_count > 0 then if files_changes_count > 0 then
print (" (+" + files_changes_count.out + ")") print (" (+" + files_changes_count.out + ")")
end
print (".%N")
elseif files_changes_count > 0 then
print ("Install module ")
print (l_mod_name)
print (" in %"")
print (l_dest_dir.path.name)
print ("%": ")
print (files_changes_count.out)
if files_changes_count = 1 then
print (" change.%N")
else
print (" changes.%N")
end
end end
print (".%N")
else else
l_errors_count := l_errors_count + 1
print ({STRING_32} "The CMS Application located at " + l_cms_path.name + "does not have the site or modules folders.%N") print ({STRING_32} "The CMS Application located at " + l_cms_path.name + "does not have the site or modules folders.%N")
end end
else else
@@ -313,6 +330,7 @@ feature -- Execution
-- Install configuration files. -- Install configuration files.
create l_site_dir.make_with_path (l_site_path) create l_site_dir.make_with_path (l_site_path)
if l_site_dir.exists then if l_site_dir.exists then
l_themes_count := l_themes_count + 1
create l_themes_dir.make_with_path (l_site_path.extended ("themes")) create l_themes_dir.make_with_path (l_site_path.extended ("themes"))
if not l_themes_dir.exists then if not l_themes_dir.exists then
l_themes_dir.create_dir l_themes_dir.create_dir
@@ -322,26 +340,71 @@ feature -- Execution
if not l_dest_dir.exists then if not l_dest_dir.exists then
l_dest_dir.create_dir l_dest_dir.create_dir
end end
print ("Install theme ") if is_verbose then
print (l_theme_name) print ("Install theme ")
print (" in %"") print (l_theme_name)
print (l_dest_dir.path.name) print (" in %"")
print ("%":%N") print (l_dest_dir.path.name)
install_theme_elements (l_theme_source_path, l_dest_dir.path, Void) print ("%":%N")
print (" - ") end
print (directories_count.out + " director" + if directories_count > 1 then "ies" else "y" end + ", ") install_theme_elements (l_theme_source_path, l_dest_dir.path, Void)
print (files_count.out + " file" + if files_count > 1 then "s" else "" end) l_global_file_changes := l_global_file_changes + files_changes_count
if files_changes_count > 0 then if is_verbose then
print (" (+" + files_changes_count.out + ")") print (" - ")
print (directories_count.out + " director" + if directories_count > 1 then "ies" else "y" end + ", ")
print (files_count.out + " file" + if files_count > 1 then "s" else "" end)
if files_changes_count > 0 then
print (" (+" + files_changes_count.out + ")")
end
print (".%N")
elseif files_changes_count > 0 then
print ("Install theme ")
print (l_theme_name)
print (" in %"")
print (l_dest_dir.path.name)
print ("%": ")
print (files_changes_count.out)
if files_changes_count = 1 then
print (" change.%N")
else
print (" changes.%N")
end
end end
print (".%N")
else else
l_errors_count := l_errors_count + 1
print ({STRING_32} "The CMS Application located at " + l_cms_path.name + "does not have the site or themes folders.%N") print ({STRING_32} "The CMS Application located at " + l_cms_path.name + "does not have the site or themes folders.%N")
end end
else else
l_errors_count := l_errors_count + 1
print ("Error: could not retrieve theme name.%N") print ("Error: could not retrieve theme name.%N")
end end
end end
if l_modules_count > 0 then
if l_modules_count = 1 then
print ("One module updated.%N")
else
print (l_modules_count.out + " modules updated.%N")
end
end
if l_themes_count > 0 then
if l_themes_count = 1 then
print ("One theme updated.%N")
else
print (l_themes_count.out + " themes updated.%N")
end
end
if l_global_file_changes > 0 then
if l_global_file_changes = 1 then
print ("One file updated.%N")
else
print (l_global_file_changes.out + " files updated.%N")
end
else
print ("No file updated.%N")
end
if l_errors_count > 0 then
print (l_errors_count.out + " errors.%N")
end
end end
roc_configuration (a_cfg_location: PATH): detachable CONFIG_READER roc_configuration (a_cfg_location: PATH): detachable CONFIG_READER