7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/module_installer.rb', line 7
def install_module(module_name_or_path, module_version = nil)
brpm_content_spec = nil
if true module_spec, specs = install_gem(module_name_or_path, module_version)
brpm_content_spec = specs.find { |spec| spec.name == "brpm_content_framework" } if specs
install_bundle(module_spec)
else
module_name = module_name_or_path
module_spec = Gem::Specification.find_by_name(module_name)
end
if BrpmAuto.brpm_installed?
BrpmAuto.log "A BRPM instance is installed locally"
if brpm_content_spec
if brpm_content_spec.version > Gem::Version.new(BrpmAuto.version) or ! File.exist?(get_symlink_path)
BrpmAuto.log "Updating the symlink to brpm_content_framework-latest..."
update_symlink_to_brpm_content(brpm_content_spec.gem_dir)
end
if brpm_content_spec.version > Gem::Version.new(BrpmAuto.version) or ! File.exist?("#{ENV["BRPM_HOME"]}/automation_results/log.html")
BrpmAuto.log "Copying the log.html file to te automation_results directory..."
FileUtils.cp("#{brpm_content_spec.gem_dir}/infrastructure/log.html", "#{ENV["BRPM_HOME"]}/automation_results")
end
end
BrpmAuto.log "Preparing the connectivity to BRPM..."
if prepare_brpm_connection
module_friendly_name = get_module_friendly_name(module_spec)
BrpmAuto.log "Creating an automation category for #{module_friendly_name} if one doesn't exist yet..."
create_automation_category_if_not_exists(module_friendly_name)
BrpmAuto.log "Retrieving the integration servers..."
integration_servers = @brpm_rest_client.get_project_servers
BrpmAuto.log "Installing the automation script wrappers in the local BRPM instance..."
failed_scripts = each_auto_script_wrapper(module_spec.gem_dir) do |auto_script_path, automation_type|
BrpmAuto.log "Installing automation script wrapper for script #{auto_script_path}..."
install_auto_script_wrapper(auto_script_path, automation_type, module_spec.name, module_friendly_name, integration_servers)
end
if failed_scripts.size > 0
return false
end
end
end
end
|