RDI 0.1.0.20091020
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +3 -0
- data/ChangeLog +46 -0
- data/Credits +21 -0
- data/LICENSE +31 -0
- data/README +18 -0
- data/TODO +17 -0
- data/lib/rdi/Installer.rb +678 -0
- data/lib/rdi/Model/ContextModifier.rb +20 -0
- data/lib/rdi/Model/DependencyDescription.rb +154 -0
- data/lib/rdi/Model/DependencyUserChoice.rb +202 -0
- data/lib/rdi/Model/Installer.rb +24 -0
- data/lib/rdi/Model/LocationSelector.rb +16 -0
- data/lib/rdi/Model/ProgressView.rb +16 -0
- data/lib/rdi/Model/Tester.rb +20 -0
- data/lib/rdi/Model/View.rb +16 -0
- data/lib/rdi/Plugins/ContextModifiers/GemPath.desc.rb +13 -0
- data/lib/rdi/Plugins/ContextModifiers/GemPath.rb +106 -0
- data/lib/rdi/Plugins/ContextModifiers/LibraryPath.rb +74 -0
- data/lib/rdi/Plugins/ContextModifiers/RubyLoadPath.rb +76 -0
- data/lib/rdi/Plugins/ContextModifiers/SystemPath.rb +74 -0
- data/lib/rdi/Plugins/GemCommon.rb +127 -0
- data/lib/rdi/Plugins/Installers/Download.rb +72 -0
- data/lib/rdi/Plugins/Installers/DownloadAndInstall.desc.rb +11 -0
- data/lib/rdi/Plugins/Installers/DownloadAndInstall.rb +54 -0
- data/lib/rdi/Plugins/Installers/Gem.desc.rb +13 -0
- data/lib/rdi/Plugins/Installers/Gem.rb +67 -0
- data/lib/rdi/Plugins/Installers/Icons/Download.png +0 -0
- data/lib/rdi/Plugins/Installers/Icons/DownloadAndInstall.png +0 -0
- data/lib/rdi/Plugins/Installers/Icons/Gem.png +0 -0
- data/lib/rdi/Plugins/Installers/Yum.rb +52 -0
- data/lib/rdi/Plugins/ProgressViews/SimpleWxGUI.desc.rb +13 -0
- data/lib/rdi/Plugins/ProgressViews/SimpleWxGUI.rb +58 -0
- data/lib/rdi/Plugins/ProgressViews/Text.rb +68 -0
- data/lib/rdi/Plugins/RubyGemsDepDesc.rb +41 -0
- data/lib/rdi/Plugins/Testers/Binaries.rb +56 -0
- data/lib/rdi/Plugins/Testers/DynamicLibraries.rb +56 -0
- data/lib/rdi/Plugins/Testers/RubyRequires.rb +76 -0
- data/lib/rdi/Plugins/Views/SimpleWxGUI/DependenciesLoaderDialog.rb +147 -0
- data/lib/rdi/Plugins/Views/SimpleWxGUI/DependencyPanel.rb +301 -0
- data/lib/rdi/Plugins/Views/SimpleWxGUI/Icons/Dependency.png +0 -0
- data/lib/rdi/Plugins/Views/SimpleWxGUI/Icons/Ignore.png +0 -0
- data/lib/rdi/Plugins/Views/SimpleWxGUI/Icons/ValidKO.png +0 -0
- data/lib/rdi/Plugins/Views/SimpleWxGUI/Icons/ValidOK.png +0 -0
- data/lib/rdi/Plugins/Views/SimpleWxGUI/LocationSelectors/Directory.desc.rb +13 -0
- data/lib/rdi/Plugins/Views/SimpleWxGUI/LocationSelectors/Directory.rb +45 -0
- data/lib/rdi/Plugins/Views/SimpleWxGUI.desc.rb +13 -0
- data/lib/rdi/Plugins/Views/SimpleWxGUI.rb +60 -0
- data/lib/rdi/Plugins/Views/Text/LocationSelectors/Directory.rb +44 -0
- data/lib/rdi/Plugins/Views/Text.rb +257 -0
- data/lib/rdi/Plugins/WxCommon.rb +69 -0
- data/lib/rdi/Plugins/WxRubyDepDesc.rb +36 -0
- data/lib/rdi/rdi.rb +8 -0
- data/test/Common.rb +796 -0
- data/test/Flows/BasicFlows.rb +114 -0
- data/test/Flows/UIFlows.rb +460 -0
- data/test/Plugins/ContextModifiers/GemPath.rb +44 -0
- data/test/Plugins/ContextModifiers/LibraryPath.rb +36 -0
- data/test/Plugins/ContextModifiers/RubyLoadPath.rb +36 -0
- data/test/Plugins/ContextModifiers/SystemPath.rb +36 -0
- data/test/Plugins/Installers/Download.rb +65 -0
- data/test/Plugins/Installers/DownloadAndInstall.rb +73 -0
- data/test/Plugins/Installers/Gem.rb +79 -0
- data/test/Plugins/LocationSelectors/Directory.rb +34 -0
- data/test/Plugins/Testers/Binaries.rb +46 -0
- data/test/Plugins/Testers/DynamicLibraries.rb +46 -0
- data/test/Plugins/Testers/RubyRequires.rb +48 -0
- data/test/Plugins/Views/SimpleWxGUI.rb +190 -0
- data/test/Plugins/Views/Text.rb +112 -0
- data/test/Plugins/WxEnv.rb +58 -0
- data/test/Plugins/WxEnvApp.rb +53 -0
- data/test/Repository/Binaries/DummyBinary +1 -0
- data/test/Repository/Libraries/DummyLibrary.so +1 -0
- data/test/Repository/RubyGems/DummyGem-0.0.1.20090828.gem +0 -0
- data/test/Repository/RubyGems/GemsSources/DummyGem/DummyGem.gemspec.rb +23 -0
- data/test/Repository/RubyGems/GemsSources/DummyGem/lib/DummyGemMain.rb +5 -0
- data/test/Repository/RubyLibraries/DummyRubyLib.rb +1 -0
- data/test/run.rb +23 -0
- metadata +145 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
#++
|
5
|
+
|
6
|
+
module RDI
|
7
|
+
|
8
|
+
module Test
|
9
|
+
|
10
|
+
module ContextModifiers
|
11
|
+
|
12
|
+
class SystemPath < RDITestCase
|
13
|
+
|
14
|
+
include RDITestCase_ContextModifiers
|
15
|
+
|
16
|
+
# Constructor
|
17
|
+
def setup
|
18
|
+
super
|
19
|
+
@ContextModifierPluginName = 'SystemPath'
|
20
|
+
end
|
21
|
+
|
22
|
+
# Get a test location
|
23
|
+
#
|
24
|
+
# Return:
|
25
|
+
# * _Object_: Location of the given ContextModifier to be tested
|
26
|
+
def getTestLocation
|
27
|
+
return 'DummyLocation'
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
#++
|
5
|
+
|
6
|
+
require 'tmpdir'
|
7
|
+
require 'fileutils'
|
8
|
+
|
9
|
+
module RDI
|
10
|
+
|
11
|
+
module Test
|
12
|
+
|
13
|
+
module Installers
|
14
|
+
|
15
|
+
class Download < RDITestCase
|
16
|
+
|
17
|
+
include RDITestCase_Installers
|
18
|
+
|
19
|
+
# Constructor
|
20
|
+
def setup
|
21
|
+
super
|
22
|
+
@InstallerPluginName = 'Download'
|
23
|
+
end
|
24
|
+
|
25
|
+
# Get a test content
|
26
|
+
#
|
27
|
+
# Return:
|
28
|
+
# * _Object_: Content of the given Installer to be tested
|
29
|
+
def getTestContent
|
30
|
+
return "#{@RepositoryDir}/Binaries/DummyBinary"
|
31
|
+
end
|
32
|
+
|
33
|
+
# Verify installed content
|
34
|
+
#
|
35
|
+
# Parameters:
|
36
|
+
# * *iLocation* (_Object_): Location where the content should be installed
|
37
|
+
# Return:
|
38
|
+
# * _Boolean_: Is the content installed in this location ?
|
39
|
+
def verifyInstalledContent(iLocation)
|
40
|
+
return File.exists?("#{iLocation}/DummyBinary")
|
41
|
+
end
|
42
|
+
|
43
|
+
# Uninstall the test content
|
44
|
+
#
|
45
|
+
# Parameters:
|
46
|
+
# * *iLocation* (_Object_): Location where the content should be installed
|
47
|
+
def uninstallTestContent(iLocation)
|
48
|
+
FileUtils.rm("#{iLocation}/DummyBinary")
|
49
|
+
end
|
50
|
+
|
51
|
+
# Get a location to be used as the "other" one, chosen by the user
|
52
|
+
#
|
53
|
+
# Return:
|
54
|
+
# * _Object_: The other location
|
55
|
+
def getOtherLocation
|
56
|
+
return "#{Dir.tmpdir}/RDITest"
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
#++
|
5
|
+
|
6
|
+
require 'tmpdir'
|
7
|
+
require 'fileutils'
|
8
|
+
|
9
|
+
module RDI
|
10
|
+
|
11
|
+
module Test
|
12
|
+
|
13
|
+
module Installers
|
14
|
+
|
15
|
+
class DownloadAndInstall < RDITestCase
|
16
|
+
|
17
|
+
include RDITestCase_Installers
|
18
|
+
|
19
|
+
# Constructor
|
20
|
+
def setup
|
21
|
+
super
|
22
|
+
@InstallerPluginName = 'DownloadAndInstall'
|
23
|
+
end
|
24
|
+
|
25
|
+
# Get a test content
|
26
|
+
#
|
27
|
+
# Return:
|
28
|
+
# * _Object_: Content of the given Installer to be tested
|
29
|
+
def getTestContent
|
30
|
+
return [
|
31
|
+
"#{@RepositoryDir}/Binaries/DummyBinary",
|
32
|
+
Proc.new do |iInstallLocation|
|
33
|
+
# *iInstallLocation* (_String_): Installation directory
|
34
|
+
FileUtils::mkdir_p(iInstallLocation)
|
35
|
+
FileUtils::cp('DummyBinary', iInstallLocation)
|
36
|
+
next true
|
37
|
+
end
|
38
|
+
]
|
39
|
+
end
|
40
|
+
|
41
|
+
# Verify installed content
|
42
|
+
#
|
43
|
+
# Parameters:
|
44
|
+
# * *iLocation* (_Object_): Location where the content should be installed
|
45
|
+
# Return:
|
46
|
+
# * _Boolean_: Is the content installed in this location ?
|
47
|
+
def verifyInstalledContent(iLocation)
|
48
|
+
return File.exists?("#{iLocation}/DummyBinary")
|
49
|
+
end
|
50
|
+
|
51
|
+
# Uninstall the test content
|
52
|
+
#
|
53
|
+
# Parameters:
|
54
|
+
# * *iLocation* (_Object_): Location where the content should be installed
|
55
|
+
def uninstallTestContent(iLocation)
|
56
|
+
FileUtils.rm("#{iLocation}/DummyBinary")
|
57
|
+
end
|
58
|
+
|
59
|
+
# Get a location to be used as the "other" one, chosen by the user
|
60
|
+
#
|
61
|
+
# Return:
|
62
|
+
# * _Object_: The other location
|
63
|
+
def getOtherLocation
|
64
|
+
return "#{Dir.tmpdir}/RDITest"
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
#++
|
5
|
+
|
6
|
+
require 'tmpdir'
|
7
|
+
require 'fileutils'
|
8
|
+
|
9
|
+
module RDI
|
10
|
+
|
11
|
+
module Test
|
12
|
+
|
13
|
+
module Installers
|
14
|
+
|
15
|
+
class Gem < RDITestCase
|
16
|
+
|
17
|
+
include RDITestCase_Installers
|
18
|
+
|
19
|
+
# Constructor
|
20
|
+
def setup
|
21
|
+
super
|
22
|
+
@InstallerPluginName = 'Gem'
|
23
|
+
# Install Gems if needed
|
24
|
+
require 'rdi/Plugins/RubyGemsDepDesc'
|
25
|
+
setupAppDir do
|
26
|
+
@Installer.ensureDependencies( [
|
27
|
+
# RubyGems
|
28
|
+
RDI::getRubyGemsDepDesc
|
29
|
+
] )
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get a test content
|
34
|
+
#
|
35
|
+
# Return:
|
36
|
+
# * _Object_: Content of the given Installer to be tested
|
37
|
+
def getTestContent
|
38
|
+
return "#{@RepositoryDir}/RubyGems/DummyGem-0.0.1.20090828.gem"
|
39
|
+
end
|
40
|
+
|
41
|
+
# Verify installed content
|
42
|
+
#
|
43
|
+
# Parameters:
|
44
|
+
# * *iLocation* (_Object_): Location where the content should be installed
|
45
|
+
# Return:
|
46
|
+
# * _Boolean_: Is the content installed in this location ?
|
47
|
+
def verifyInstalledContent(iLocation)
|
48
|
+
return (
|
49
|
+
(File.exists?("#{iLocation}/gems/DummyGem-0.0.1.20090828/lib/DummyGemMain.rb")) and
|
50
|
+
(File.exists?("#{iLocation}/specifications/DummyGem-0.0.1.20090828.gemspec")) and
|
51
|
+
(File.exists?("#{iLocation}/cache/DummyGem-0.0.1.20090828.gem"))
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Uninstall the test content
|
56
|
+
#
|
57
|
+
# Parameters:
|
58
|
+
# * *iLocation* (_Object_): Location where the content should be installed
|
59
|
+
def uninstallTestContent(iLocation)
|
60
|
+
FileUtils.rm_rf("#{iLocation}/gems/DummyGem-0.0.1.20090828")
|
61
|
+
FileUtils.rm("#{iLocation}/specifications/DummyGem-0.0.1.20090828.gemspec")
|
62
|
+
FileUtils.rm("#{iLocation}/cache/DummyGem-0.0.1.20090828.gem")
|
63
|
+
end
|
64
|
+
|
65
|
+
# Get a location to be used as the "other" one, chosen by the user
|
66
|
+
#
|
67
|
+
# Return:
|
68
|
+
# * _Object_: The other location
|
69
|
+
def getOtherLocation
|
70
|
+
return "#{Dir.tmpdir}/RDITest"
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
#++
|
5
|
+
|
6
|
+
module RDI
|
7
|
+
|
8
|
+
module Test
|
9
|
+
|
10
|
+
module LocationSelectors
|
11
|
+
|
12
|
+
class Directory < RDITestCase
|
13
|
+
|
14
|
+
include RDITestCase_LocationSelectors
|
15
|
+
|
16
|
+
# Constructor
|
17
|
+
def setup
|
18
|
+
super
|
19
|
+
@LocationSelectorPluginName = 'Directory'
|
20
|
+
end
|
21
|
+
|
22
|
+
# Install dependencies
|
23
|
+
def installDep_SimpleWxGUI
|
24
|
+
require 'Plugins/WxEnv'
|
25
|
+
RDI::Test::RDIWx.installTestWxEnv
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
#++
|
5
|
+
|
6
|
+
module RDI
|
7
|
+
|
8
|
+
module Test
|
9
|
+
|
10
|
+
module Testers
|
11
|
+
|
12
|
+
class Binaries < RDITestCase
|
13
|
+
|
14
|
+
include RDITestCase_Testers
|
15
|
+
|
16
|
+
# Constructor
|
17
|
+
def setup
|
18
|
+
super
|
19
|
+
@TesterPluginName = 'Binaries'
|
20
|
+
end
|
21
|
+
|
22
|
+
# Get a test content
|
23
|
+
#
|
24
|
+
# Return:
|
25
|
+
# * _Object_: Content of the given Tester to be tested
|
26
|
+
def getTestContent
|
27
|
+
return [ 'DummyBinary' ]
|
28
|
+
end
|
29
|
+
|
30
|
+
# Install the test content
|
31
|
+
def installTestContent
|
32
|
+
$rUtilAnts_Platform_Info.setSystemExePath($rUtilAnts_Platform_Info.getSystemExePath + [ "#{@RepositoryDir}/Binaries" ])
|
33
|
+
end
|
34
|
+
|
35
|
+
# Uninstall the test content
|
36
|
+
def uninstallTestContent
|
37
|
+
$rUtilAnts_Platform_Info.setSystemExePath($rUtilAnts_Platform_Info.getSystemExePath - [ "#{@RepositoryDir}/Binaries" ])
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
#++
|
5
|
+
|
6
|
+
module RDI
|
7
|
+
|
8
|
+
module Test
|
9
|
+
|
10
|
+
module Testers
|
11
|
+
|
12
|
+
class DynamicLibraries < RDITestCase
|
13
|
+
|
14
|
+
include RDITestCase_Testers
|
15
|
+
|
16
|
+
# Constructor
|
17
|
+
def setup
|
18
|
+
super
|
19
|
+
@TesterPluginName = 'DynamicLibraries'
|
20
|
+
end
|
21
|
+
|
22
|
+
# Get a test content
|
23
|
+
#
|
24
|
+
# Return:
|
25
|
+
# * _Object_: Content of the given Tester to be tested
|
26
|
+
def getTestContent
|
27
|
+
return [ 'DummyLibrary.so' ]
|
28
|
+
end
|
29
|
+
|
30
|
+
# Install the test content
|
31
|
+
def installTestContent
|
32
|
+
$rUtilAnts_Platform_Info.setSystemLibsPath($rUtilAnts_Platform_Info.getSystemLibsPath + [ "#{@RepositoryDir}/Libraries" ])
|
33
|
+
end
|
34
|
+
|
35
|
+
# Uninstall the test content
|
36
|
+
def uninstallTestContent
|
37
|
+
$rUtilAnts_Platform_Info.setSystemLibsPath($rUtilAnts_Platform_Info.getSystemLibsPath - [ "#{@RepositoryDir}/Libraries" ])
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
#++
|
5
|
+
|
6
|
+
module RDI
|
7
|
+
|
8
|
+
module Test
|
9
|
+
|
10
|
+
module Testers
|
11
|
+
|
12
|
+
class RubyRequires < RDITestCase
|
13
|
+
|
14
|
+
include RDITestCase_Testers
|
15
|
+
|
16
|
+
# Constructor
|
17
|
+
def setup
|
18
|
+
super
|
19
|
+
@TesterPluginName = 'RubyRequires'
|
20
|
+
end
|
21
|
+
|
22
|
+
# Get a test content
|
23
|
+
#
|
24
|
+
# Return:
|
25
|
+
# * _Object_: Content of the given Tester to be tested
|
26
|
+
def getTestContent
|
27
|
+
return [ 'DummyRubyLib.rb' ]
|
28
|
+
end
|
29
|
+
|
30
|
+
# Install the test content
|
31
|
+
def installTestContent
|
32
|
+
$LOAD_PATH << "#{@RepositoryDir}/RubyLibraries"
|
33
|
+
end
|
34
|
+
|
35
|
+
# Uninstall the test content
|
36
|
+
def uninstallTestContent
|
37
|
+
$LOAD_PATH.delete_if do |iDir|
|
38
|
+
(iDir == "#{@RepositoryDir}/RubyLibraries")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,190 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
#++
|
5
|
+
|
6
|
+
module RDI
|
7
|
+
|
8
|
+
module Test
|
9
|
+
|
10
|
+
module Views
|
11
|
+
|
12
|
+
class SimpleWxGUI < RDITestCase
|
13
|
+
|
14
|
+
include RDITestCase_Views
|
15
|
+
|
16
|
+
# Constructor
|
17
|
+
def setup
|
18
|
+
super
|
19
|
+
@ViewPluginName = 'SimpleWxGUI'
|
20
|
+
require 'Plugins/WxEnv'
|
21
|
+
RDI::Test::RDIWx.installTestWxEnv
|
22
|
+
end
|
23
|
+
|
24
|
+
# initScenario
|
25
|
+
#
|
26
|
+
# Parameters:
|
27
|
+
# * *ioPlugin* (_Object_): The View plugin
|
28
|
+
# * *iScenario* (<em>list<[Integer,String,Object]></em>): The scenario
|
29
|
+
# * *iMissingDependencies* (<em>list<DependencyDescription></em>): The missing dependencies list
|
30
|
+
def initScenario(ioPlugin, iScenario, iMissingDependencies)
|
31
|
+
# Display it to the user for him to perform the actions
|
32
|
+
@Scenario = iScenario
|
33
|
+
end
|
34
|
+
|
35
|
+
# executeScenario
|
36
|
+
#
|
37
|
+
# Parameters:
|
38
|
+
# * *ioPlugin* (_Object_): The View plugin
|
39
|
+
# * *ioInstaller* (_Installer_): The RDI installer
|
40
|
+
# * *iMissingDependencies* (<em>list<DependencyDescription></em>): The missing dependencies list
|
41
|
+
# Return:
|
42
|
+
# * <em>list<DependencyUserChoice></em>: The corresponding user choices
|
43
|
+
def executeScenario(ioPlugin, ioInstaller, iMissingDependencies)
|
44
|
+
# Modify the constructor of DependenciesLoaderDialog to trap its instance (as Wx::get_app.get_top_window does not work as expected)
|
45
|
+
# Load it first to ensure the class will be loaded
|
46
|
+
ioInstaller.accessPlugin('Views', 'SimpleWxGUI') do |iPlugin|
|
47
|
+
require 'rdi/Plugins/Views/SimpleWxGUI/DependenciesLoaderDialog'
|
48
|
+
end
|
49
|
+
if (defined?($RDI_ModifiedDepLoaderDialog) == nil)
|
50
|
+
$RDI_ModifiedDepLoaderDialog = true
|
51
|
+
RDI::Views::SimpleWxGUI::DependenciesLoaderDialog.module_eval('
|
52
|
+
alias :initialize_ORG :initialize
|
53
|
+
|
54
|
+
# Constructor
|
55
|
+
#
|
56
|
+
# Parameters:
|
57
|
+
# * *iParent* (<em>Wx::Window</em>): The parent
|
58
|
+
# * *ioInstaller* (_Installer_): The installer
|
59
|
+
# * *iDepsUserChoices* (<em>list<DependencyUserChoice></em>): The dependency user choices to reflect in this dialog
|
60
|
+
def initialize(iParent, ioInstaller, iDepsUserChoices)
|
61
|
+
initialize_ORG(iParent, ioInstaller, iDepsUserChoices)
|
62
|
+
$RDI_DepLoaderDialog = self
|
63
|
+
end
|
64
|
+
|
65
|
+
')
|
66
|
+
end
|
67
|
+
$RDI_DepLoaderDialog = nil
|
68
|
+
Thread.new do
|
69
|
+
# This thread will pilot our GUI
|
70
|
+
begin
|
71
|
+
lExit = false
|
72
|
+
while !lExit
|
73
|
+
# Get the Top window (don't use Wx::get_app.get_top_window as it is not updated after several dialogs displayed)
|
74
|
+
# TODO (wxRuby): Make Wx::get_app.get_top_window work as expected
|
75
|
+
lTopWindow = $RDI_DepLoaderDialog
|
76
|
+
if (lTopWindow != nil)
|
77
|
+
# Add some methods that will give us some internals
|
78
|
+
lTopWindow.class.module_eval('
|
79
|
+
# The list of dependency panels
|
80
|
+
# list< DependencyPanel >
|
81
|
+
attr_reader :DependencyPanels
|
82
|
+
|
83
|
+
# The Apply button
|
84
|
+
# Wx::Button
|
85
|
+
attr_reader :BApply
|
86
|
+
|
87
|
+
# The list of DepUserChoices
|
88
|
+
# list< DependencyUserChoice >
|
89
|
+
attr_reader :DepsUserChoices
|
90
|
+
|
91
|
+
')
|
92
|
+
lTopWindow.DependencyPanels[0].class.module_eval('
|
93
|
+
# The Locate radio button
|
94
|
+
# Wx::RadioButton
|
95
|
+
attr_reader :RBLocate
|
96
|
+
|
97
|
+
# The Ignore radio button
|
98
|
+
# Wx::RadioButton
|
99
|
+
attr_reader :RBIgnore
|
100
|
+
|
101
|
+
# The Installers components
|
102
|
+
# list< [ RadioButton, StaticBitmap, list< RadioButton > ] >
|
103
|
+
attr_reader :InstallerComponents
|
104
|
+
|
105
|
+
')
|
106
|
+
# Execute the scenario
|
107
|
+
@Scenario.each do |iActionInfo|
|
108
|
+
iAction, iDepID, iParameters = iActionInfo
|
109
|
+
# First, find the correct dependency panel
|
110
|
+
lDepPanel = nil
|
111
|
+
lDepUserChoice = nil
|
112
|
+
if (iDepID != nil)
|
113
|
+
# Find the correct index
|
114
|
+
lIdxDep = 0
|
115
|
+
iMissingDependencies.each do |iDepDesc|
|
116
|
+
if (iDepDesc.ID == iDepID)
|
117
|
+
break
|
118
|
+
end
|
119
|
+
lIdxDep += 1
|
120
|
+
end
|
121
|
+
lDepPanel = lTopWindow.DependencyPanels[lIdxDep]
|
122
|
+
lDepUserChoice = lTopWindow.DepsUserChoices[lIdxDep]
|
123
|
+
end
|
124
|
+
case iAction
|
125
|
+
when ACTION_LOCATE
|
126
|
+
lDepPanel.RBLocate.command(Wx::CommandEvent.new(Wx::EVT_COMMAND_RADIOBUTTON_SELECTED, lDepPanel.RBLocate.get_id))
|
127
|
+
when ACTION_IGNORE
|
128
|
+
lDepPanel.RBIgnore.command(Wx::CommandEvent.new(Wx::EVT_COMMAND_RADIOBUTTON_SELECTED, lDepPanel.RBIgnore.get_id))
|
129
|
+
when ACTION_INSTALL
|
130
|
+
lIdxInstaller, lIdxDest, lOtherLocation = iParameters
|
131
|
+
lRBDest = lDepPanel.InstallerComponents[lIdxInstaller][2][lIdxDest]
|
132
|
+
# In case of DEST_OTHER, we must use a different LocationSelector
|
133
|
+
lOtherFound = false
|
134
|
+
lInstallerName, lInstallerContent, lContextModifiers = lDepUserChoice.DepDesc.Installers[lIdxInstaller]
|
135
|
+
ioInstaller.accessPlugin('Installers', lInstallerName) do |iPlugin|
|
136
|
+
lFlavour, lLocation = iPlugin.PossibleDestinations[lIdxDest]
|
137
|
+
if (lFlavour == DEST_OTHER)
|
138
|
+
setupFakeSelector(lLocation, lOtherLocation) do
|
139
|
+
lRBDest.command(Wx::CommandEvent.new(Wx::EVT_COMMAND_RADIOBUTTON_SELECTED, lRBDest.get_id))
|
140
|
+
end
|
141
|
+
lOtherFound = true
|
142
|
+
break
|
143
|
+
end
|
144
|
+
end
|
145
|
+
if (!lOtherFound)
|
146
|
+
lRBDest.command(Wx::CommandEvent.new(Wx::EVT_COMMAND_RADIOBUTTON_SELECTED, lRBDest.get_id))
|
147
|
+
end
|
148
|
+
when ACTION_APPLY
|
149
|
+
lTopWindow.BApply.command(Wx::CommandEvent.new(Wx::EVT_COMMAND_BUTTON_CLICKED, lTopWindow.BApply.get_id))
|
150
|
+
# Exit our loop
|
151
|
+
lExit = true
|
152
|
+
break
|
153
|
+
when ACTION_SELECT_AFFECTING_CONTEXTMODIFIER
|
154
|
+
lCMName, lLocation = iParameters
|
155
|
+
# Click on the button named "Change #{lCMName}"
|
156
|
+
# TODO (wxRuby): Make Window#find_window_by_label work (little typo)
|
157
|
+
lButton = Wx::Window.find_window_by_label("Change #{lCMName}", lDepPanel)
|
158
|
+
# Change the LocationSelector
|
159
|
+
ioInstaller.accessPlugin('ContextModifiers', lCMName) do |ioCMPlugin|
|
160
|
+
# Get the name of LocationSelector class to use
|
161
|
+
# Setup a fake selector
|
162
|
+
setupFakeSelector(ioCMPlugin.LocationSelectorName, lLocation) do
|
163
|
+
lButton.command(Wx::CommandEvent.new(Wx::EVT_COMMAND_BUTTON_CLICKED, lButton.get_id))
|
164
|
+
end
|
165
|
+
end
|
166
|
+
else
|
167
|
+
logBug "Unknown Action: #{iAction}"
|
168
|
+
end
|
169
|
+
end
|
170
|
+
# Time between each action: 200 ms
|
171
|
+
sleep(0.2)
|
172
|
+
end
|
173
|
+
# Time between each attempt to find the new window: 200 ms
|
174
|
+
sleep(0.2)
|
175
|
+
end
|
176
|
+
rescue Exception
|
177
|
+
logExc $!, 'Exception while piloting GUI for testing.'
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
return ioPlugin.execute(ioInstaller, iMissingDependencies)
|
182
|
+
end
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|