RDI 0.1.0.20091020

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/AUTHORS +3 -0
  2. data/ChangeLog +46 -0
  3. data/Credits +21 -0
  4. data/LICENSE +31 -0
  5. data/README +18 -0
  6. data/TODO +17 -0
  7. data/lib/rdi/Installer.rb +678 -0
  8. data/lib/rdi/Model/ContextModifier.rb +20 -0
  9. data/lib/rdi/Model/DependencyDescription.rb +154 -0
  10. data/lib/rdi/Model/DependencyUserChoice.rb +202 -0
  11. data/lib/rdi/Model/Installer.rb +24 -0
  12. data/lib/rdi/Model/LocationSelector.rb +16 -0
  13. data/lib/rdi/Model/ProgressView.rb +16 -0
  14. data/lib/rdi/Model/Tester.rb +20 -0
  15. data/lib/rdi/Model/View.rb +16 -0
  16. data/lib/rdi/Plugins/ContextModifiers/GemPath.desc.rb +13 -0
  17. data/lib/rdi/Plugins/ContextModifiers/GemPath.rb +106 -0
  18. data/lib/rdi/Plugins/ContextModifiers/LibraryPath.rb +74 -0
  19. data/lib/rdi/Plugins/ContextModifiers/RubyLoadPath.rb +76 -0
  20. data/lib/rdi/Plugins/ContextModifiers/SystemPath.rb +74 -0
  21. data/lib/rdi/Plugins/GemCommon.rb +127 -0
  22. data/lib/rdi/Plugins/Installers/Download.rb +72 -0
  23. data/lib/rdi/Plugins/Installers/DownloadAndInstall.desc.rb +11 -0
  24. data/lib/rdi/Plugins/Installers/DownloadAndInstall.rb +54 -0
  25. data/lib/rdi/Plugins/Installers/Gem.desc.rb +13 -0
  26. data/lib/rdi/Plugins/Installers/Gem.rb +67 -0
  27. data/lib/rdi/Plugins/Installers/Icons/Download.png +0 -0
  28. data/lib/rdi/Plugins/Installers/Icons/DownloadAndInstall.png +0 -0
  29. data/lib/rdi/Plugins/Installers/Icons/Gem.png +0 -0
  30. data/lib/rdi/Plugins/Installers/Yum.rb +52 -0
  31. data/lib/rdi/Plugins/ProgressViews/SimpleWxGUI.desc.rb +13 -0
  32. data/lib/rdi/Plugins/ProgressViews/SimpleWxGUI.rb +58 -0
  33. data/lib/rdi/Plugins/ProgressViews/Text.rb +68 -0
  34. data/lib/rdi/Plugins/RubyGemsDepDesc.rb +41 -0
  35. data/lib/rdi/Plugins/Testers/Binaries.rb +56 -0
  36. data/lib/rdi/Plugins/Testers/DynamicLibraries.rb +56 -0
  37. data/lib/rdi/Plugins/Testers/RubyRequires.rb +76 -0
  38. data/lib/rdi/Plugins/Views/SimpleWxGUI/DependenciesLoaderDialog.rb +147 -0
  39. data/lib/rdi/Plugins/Views/SimpleWxGUI/DependencyPanel.rb +301 -0
  40. data/lib/rdi/Plugins/Views/SimpleWxGUI/Icons/Dependency.png +0 -0
  41. data/lib/rdi/Plugins/Views/SimpleWxGUI/Icons/Ignore.png +0 -0
  42. data/lib/rdi/Plugins/Views/SimpleWxGUI/Icons/ValidKO.png +0 -0
  43. data/lib/rdi/Plugins/Views/SimpleWxGUI/Icons/ValidOK.png +0 -0
  44. data/lib/rdi/Plugins/Views/SimpleWxGUI/LocationSelectors/Directory.desc.rb +13 -0
  45. data/lib/rdi/Plugins/Views/SimpleWxGUI/LocationSelectors/Directory.rb +45 -0
  46. data/lib/rdi/Plugins/Views/SimpleWxGUI.desc.rb +13 -0
  47. data/lib/rdi/Plugins/Views/SimpleWxGUI.rb +60 -0
  48. data/lib/rdi/Plugins/Views/Text/LocationSelectors/Directory.rb +44 -0
  49. data/lib/rdi/Plugins/Views/Text.rb +257 -0
  50. data/lib/rdi/Plugins/WxCommon.rb +69 -0
  51. data/lib/rdi/Plugins/WxRubyDepDesc.rb +36 -0
  52. data/lib/rdi/rdi.rb +8 -0
  53. data/test/Common.rb +796 -0
  54. data/test/Flows/BasicFlows.rb +114 -0
  55. data/test/Flows/UIFlows.rb +460 -0
  56. data/test/Plugins/ContextModifiers/GemPath.rb +44 -0
  57. data/test/Plugins/ContextModifiers/LibraryPath.rb +36 -0
  58. data/test/Plugins/ContextModifiers/RubyLoadPath.rb +36 -0
  59. data/test/Plugins/ContextModifiers/SystemPath.rb +36 -0
  60. data/test/Plugins/Installers/Download.rb +65 -0
  61. data/test/Plugins/Installers/DownloadAndInstall.rb +73 -0
  62. data/test/Plugins/Installers/Gem.rb +79 -0
  63. data/test/Plugins/LocationSelectors/Directory.rb +34 -0
  64. data/test/Plugins/Testers/Binaries.rb +46 -0
  65. data/test/Plugins/Testers/DynamicLibraries.rb +46 -0
  66. data/test/Plugins/Testers/RubyRequires.rb +48 -0
  67. data/test/Plugins/Views/SimpleWxGUI.rb +190 -0
  68. data/test/Plugins/Views/Text.rb +112 -0
  69. data/test/Plugins/WxEnv.rb +58 -0
  70. data/test/Plugins/WxEnvApp.rb +53 -0
  71. data/test/Repository/Binaries/DummyBinary +1 -0
  72. data/test/Repository/Libraries/DummyLibrary.so +1 -0
  73. data/test/Repository/RubyGems/DummyGem-0.0.1.20090828.gem +0 -0
  74. data/test/Repository/RubyGems/GemsSources/DummyGem/DummyGem.gemspec.rb +23 -0
  75. data/test/Repository/RubyGems/GemsSources/DummyGem/lib/DummyGemMain.rb +5 -0
  76. data/test/Repository/RubyLibraries/DummyRubyLib.rb +1 -0
  77. data/test/run.rb +23 -0
  78. metadata +145 -0
@@ -0,0 +1,114 @@
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 'fileutils'
7
+ require 'tmpdir'
8
+
9
+ module RDI
10
+
11
+ module Test
12
+
13
+ module Flows
14
+
15
+ class BasicFlows < RDITestCase
16
+
17
+ # Test that we can test for a missing dependency
18
+ def testMissingDep
19
+ setupAppDir do
20
+ # Ask the installer to check for this description
21
+ assert_equal(false, @Installer.testDependency(getSimpleDesc))
22
+ end
23
+ end
24
+
25
+ # Test that we install dependencies correctly
26
+ def testInstallDep
27
+ setupAppDir do
28
+ # Ask the installer to install this dependency in the local directory
29
+ assert_equal(nil, @Installer.installDependency(getSimpleDesc, 0, @Installer.TempDir))
30
+ assert(File.exists?("#{@Installer.TempDir}/DummyBinary"))
31
+ File.unlink("#{@Installer.TempDir}/DummyBinary")
32
+ end
33
+ end
34
+
35
+ # Test that we detect installed dependencies correctly
36
+ def testExistingDep
37
+ setupAppDir do
38
+ # Ask the installer to install this dependency in the local directory
39
+ lDesc = getSimpleDesc
40
+ @Installer.installDependency(lDesc, 0, @Installer.TempDir)
41
+ assert_equal(true, @Installer.testDependency(lDesc))
42
+ File.unlink("#{@Installer.TempDir}/DummyBinary")
43
+ end
44
+ end
45
+
46
+ # Test that ensuring dependencies effectively install them if needed
47
+ def testEnsureDep
48
+ setupAppDir do
49
+ lDesc = getSimpleDesc
50
+ lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensureDependencies( [ lDesc ], {
51
+ :AutoInstall => DEST_LOCAL
52
+ } )
53
+ assert_equal(nil, lError)
54
+ assert_equal([], lIgnoredDeps)
55
+ assert_equal([], lUnresolvedDeps)
56
+ # Get the corresponding local folder
57
+ lInstallLocation = @Installer.getDefaultInstallLocation(lDesc.Installers[0][0], DEST_LOCAL)
58
+ assert(lInstallLocation != nil)
59
+ assert_equal(true, File.exists?("#{lInstallLocation}/DummyBinary"))
60
+ assert_equal(
61
+ {
62
+ 'DummyBinary' => [
63
+ [ 'SystemPath', lInstallLocation ]
64
+ ]
65
+ },
66
+ lCMApplied
67
+ )
68
+ end
69
+ end
70
+
71
+ # Test that ensureDeps also tries already tried context modifiers
72
+ def testEnsureDepWithExistingContextModifier
73
+ setupAppDir do
74
+ lDesc = getSimpleDesc
75
+ lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensureDependencies( [ lDesc ], {
76
+ :AutoInstall => DEST_LOCAL,
77
+ :PossibleContextModifiers => {
78
+ 'DummyBinary' => [
79
+ [
80
+ [ 'SystemPath', "#{@RepositoryDir}/Binaries" ]
81
+ ]
82
+ ]
83
+ }
84
+ } )
85
+ assert_equal(nil, lError)
86
+ assert_equal([], lIgnoredDeps)
87
+ assert_equal([], lUnresolvedDeps)
88
+ # If RDI has correctly found it, there are 2 things that can prove it:
89
+ # 1. The system path should have "#{@RepositoryDir}/Binaries"
90
+ @Installer.accessPlugin('Testers', 'Binaries') do |iPlugin|
91
+ assert_equal(true, iPlugin.isContentResolved?('DummyBinary'))
92
+ end
93
+ # 2. The dependency should not have been installed
94
+ lInstallLocation = @Installer.getDefaultInstallLocation(lDesc.Installers[0][0], DEST_LOCAL)
95
+ assert(lInstallLocation != nil)
96
+ assert_equal(false, File.exists?("#{lInstallLocation}/DummyBinary"))
97
+ assert_equal(
98
+ {
99
+ 'DummyBinary' => [
100
+ [ 'SystemPath', "#{@RepositoryDir}/Binaries" ]
101
+ ]
102
+ },
103
+ lCMApplied
104
+ )
105
+ end
106
+ end
107
+
108
+ end
109
+
110
+ end
111
+
112
+ end
113
+
114
+ end
@@ -0,0 +1,460 @@
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 'fileutils'
7
+ require 'tmpdir'
8
+
9
+ module RDI
10
+
11
+ module Test
12
+
13
+ module Flows
14
+
15
+ class UIFlows < RDITestCase
16
+
17
+ # RegressionUI plugin
18
+ class RegressionUI < RDI::Model::View
19
+
20
+ # Directory selector
21
+ class Directory < RDI::Model::LocationSelector
22
+
23
+ # Were we called ?
24
+ # Bolean
25
+ attr_reader :Called
26
+
27
+ # Directory to return
28
+ # String
29
+ attr_accessor :Directory
30
+
31
+ # Constructor
32
+ def initialize
33
+ super
34
+ @Directory = nil
35
+ @Called = false
36
+ end
37
+
38
+ # Give user the choice of a new location
39
+ #
40
+ # Return:
41
+ # * _Object_: A location, or nil if none selected
42
+ def getNewLocation
43
+ @Called = true
44
+ return @Directory
45
+ end
46
+
47
+ end
48
+
49
+ # Called ?
50
+ # Boolean
51
+ attr_reader :Called
52
+
53
+ # Missing dependencies
54
+ # list<DependencyDescription>
55
+ attr_reader :MissingDependencies
56
+
57
+ # Install location
58
+ # Object
59
+ attr_reader :InstallLocation
60
+
61
+ # Do we ignore the dependencies ?
62
+ # Boolean
63
+ attr_accessor :Ignore
64
+
65
+ # Do we locate this dependency ?
66
+ # Boolean
67
+ attr_accessor :Locate
68
+
69
+ # Do we install to a new location ?
70
+ # Boolean
71
+ attr_accessor :InstallOtherLocation
72
+
73
+ # Constructor
74
+ def initialize
75
+ super
76
+ @Called = false
77
+ @MissingDependencies = nil
78
+ @Ignore = false
79
+ @Locate = false
80
+ @InstallLocation = nil
81
+ @InstallOtherLocation = false
82
+ end
83
+
84
+ # Ask the user about missing dependencies.
85
+ # This method will use a user interface to know what to do with missing dependencies.
86
+ # For each dependency, choices are:
87
+ # * Install it
88
+ # * Ignore it
89
+ # * Change the context to find it (select directory...)
90
+ #
91
+ # Parameters:
92
+ # * *ioInstaller* (_Installer_): The RDI installer
93
+ # * *iMissingDependencies* (<em>list<DependencyDescription></em>): The missing dependencies list
94
+ # Return:
95
+ # * <em>list<DependencyUserChoice></em>: The corresponding user choices
96
+ def execute(ioInstaller, iMissingDependencies)
97
+ # List of corresponding dependencies user choices
98
+ # list< DependencyUserChoice >
99
+ rDependenciesUserChoices = []
100
+
101
+ @Called = true
102
+ @MissingDependencies = iMissingDependencies
103
+ iMissingDependencies.each do |iDepDesc|
104
+ rDependenciesUserChoices << RDI::Model::DependencyUserChoice.new(ioInstaller, 'RegressionUI', iDepDesc)
105
+ end
106
+ if (@Ignore)
107
+ rDependenciesUserChoices.each do |ioDepUserChoice|
108
+ ioDepUserChoice.setIgnore
109
+ end
110
+ elsif (@Locate)
111
+ rDependenciesUserChoices.each do |ioDepUserChoice|
112
+ ioDepUserChoice.setLocate
113
+ ioDepUserChoice.affectContextModifier('SystemPath')
114
+ end
115
+ elsif (@InstallOtherLocation)
116
+ # We want to install to another location
117
+ rDependenciesUserChoices.each do |ioDepUserChoice|
118
+ iInstallName, iInstallContent, iContextModifiers = ioDepUserChoice.DepDesc.Installers[0]
119
+ # Read the installer plugin
120
+ ioInstaller.accessPlugin('Installers', iInstallName) do |iPlugin|
121
+ lIdx = 0
122
+ iPlugin.PossibleDestinations.each do |iDestInfo|
123
+ iFlavour, iLocation = iDestInfo
124
+ if (iFlavour == DEST_OTHER)
125
+ # Found it
126
+ ioDepUserChoice.setInstaller(0, lIdx)
127
+ ioDepUserChoice.selectOtherInstallLocation(iLocation)
128
+ break
129
+ end
130
+ lIdx += 1
131
+ end
132
+ end
133
+ end
134
+ else
135
+ # We want to install.
136
+ # Make sure we do so in the local destination
137
+ rDependenciesUserChoices.each do |ioDepUserChoice|
138
+ iInstallName, iInstallContent, iContextModifiers = ioDepUserChoice.DepDesc.Installers[0]
139
+ # Read the installer plugin
140
+ ioInstaller.accessPlugin('Installers', iInstallName) do |iPlugin|
141
+ lIdx = 0
142
+ iPlugin.PossibleDestinations.each do |iDestInfo|
143
+ iFlavour, iLocation = iDestInfo
144
+ if (iFlavour == DEST_LOCAL)
145
+ # Found it
146
+ ioDepUserChoice.setInstaller(0, lIdx)
147
+ @InstallLocation = iLocation
148
+ break
149
+ end
150
+ lIdx += 1
151
+ end
152
+ end
153
+ end
154
+ end
155
+
156
+ return rDependenciesUserChoices
157
+ end
158
+
159
+ end
160
+
161
+ # Test that we ask correctly for the UI
162
+ def testCallUI
163
+ lCalled = false
164
+ setupAppDir do
165
+ setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI') do
166
+ # Call the installer expecting the GUI to appear
167
+ lDesc = getSimpleDesc
168
+ lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensureDependencies( [ lDesc ], {
169
+ :PreferredViews => [ 'RegressionUI' ]
170
+ } )
171
+ # Get the plugin back
172
+ @Installer.accessPlugin('Views', 'RegressionUI') do |iPlugin|
173
+ # Check that it was called correctly
174
+ lCalled = iPlugin.Called
175
+ end
176
+ end
177
+ end
178
+ assert_equal(true, lCalled)
179
+ end
180
+
181
+ # Test that we don't ask for the UI when dependencies are resolved naturally
182
+ def testNoCallUIWithExistingDeps
183
+ lCalled = false
184
+ setupAppDir do
185
+ setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI') do
186
+ # Call the installer expecting the GUI to appear
187
+ lDesc = getSimpleDesc
188
+ # First install the dependency
189
+ lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensureDependencies( [ lDesc ], {
190
+ :AutoInstall => DEST_LOCAL
191
+ } )
192
+ # Then try again with UI
193
+ lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensureDependencies( [ lDesc ], {
194
+ :PreferredViews => [ 'RegressionUI' ]
195
+ } )
196
+ assert_equal(nil, lError)
197
+ assert_equal( {}, lCMApplied )
198
+ assert_equal( [], lIgnoredDeps )
199
+ assert_equal( [], lUnresolvedDeps )
200
+ # Get the plugin back
201
+ @Installer.accessPlugin('Views', 'RegressionUI') do |iPlugin|
202
+ # Check that it was called correctly
203
+ lCalled = iPlugin.Called
204
+ end
205
+ end
206
+ end
207
+ assert_equal(false, lCalled)
208
+ end
209
+
210
+ # Test that we don't ask for the UI when dependencies are resolved thanks to additional context modifiers
211
+ def testNoCallUIWithResolvedDeps
212
+ lCalled = false
213
+ setupAppDir do
214
+ setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI') do
215
+ # Call the installer expecting the GUI to appear
216
+ lDesc = getSimpleDesc
217
+ lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensureDependencies( [ lDesc ], {
218
+ :PossibleContextModifiers => {
219
+ 'DummyBinary' => [
220
+ [
221
+ [ 'SystemPath', "#{@RepositoryDir}/Binaries" ]
222
+ ]
223
+ ]
224
+ },
225
+ :PreferredViews => [ 'RegressionUI' ]
226
+ } )
227
+ assert_equal(nil, lError)
228
+ assert_equal( { 'DummyBinary' => [ [ 'SystemPath', "#{@RepositoryDir}/Binaries" ] ] }, lCMApplied )
229
+ assert_equal( [], lIgnoredDeps )
230
+ assert_equal( [], lUnresolvedDeps )
231
+ # Get the plugin back
232
+ @Installer.accessPlugin('Views', 'RegressionUI') do |iPlugin|
233
+ # Check that it was called correctly
234
+ lCalled = iPlugin.Called
235
+ end
236
+ end
237
+ end
238
+ assert_equal(false, lCalled)
239
+ end
240
+
241
+ # Test that we give correctly missing dependencies to the UI
242
+ def testInputMissingDeps
243
+ lCalled = false
244
+ setupAppDir do
245
+ setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI') do
246
+ # Call the installer expecting the GUI to appear
247
+ lDesc = getSimpleDesc
248
+ lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensureDependencies( [ lDesc ], {
249
+ :PreferredViews => [ 'RegressionUI' ]
250
+ } )
251
+ assert_equal(nil, lError)
252
+ assert_equal( [], lIgnoredDeps )
253
+ assert_equal( [], lUnresolvedDeps )
254
+ # Get the plugin back
255
+ @Installer.accessPlugin('Views', 'RegressionUI') do |iPlugin|
256
+ # Check that it was called correctly
257
+ lCalled = iPlugin.Called
258
+ assert_equal( { 'DummyBinary' => [ [ 'SystemPath', iPlugin.InstallLocation ] ] }, lCMApplied )
259
+ # Check input parameters were given correctly
260
+ assert_equal([ lDesc ], iPlugin.MissingDependencies)
261
+ end
262
+ end
263
+ end
264
+ assert_equal(true, lCalled)
265
+ end
266
+
267
+ # Test installing a dependency
268
+ def testInstallDep
269
+ lCalled = false
270
+ setupAppDir do
271
+ setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI') do
272
+ # Call the installer expecting the GUI to appear
273
+ lDesc = getSimpleDesc
274
+ lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensureDependencies( [ lDesc ], {
275
+ :PreferredViews => [ 'RegressionUI' ]
276
+ } )
277
+ # Check results
278
+ assert_equal(nil, lError)
279
+ assert_equal( [], lIgnoredDeps )
280
+ assert_equal( [], lUnresolvedDeps )
281
+ # Get the plugin back
282
+ @Installer.accessPlugin('Views', 'RegressionUI') do |iPlugin|
283
+ # Check that it was called correctly
284
+ lCalled = iPlugin.Called
285
+ # Get the first install destination (this is where it will be installed
286
+ assert_equal( { 'DummyBinary' => [ [ 'SystemPath', iPlugin.InstallLocation ] ] }, lCMApplied )
287
+ end
288
+ # Check that the dependency is resolved
289
+ @Installer.accessPlugin('Testers', 'Binaries') do |iPlugin|
290
+ assert_equal(true, iPlugin.isContentResolved?('DummyBinary'))
291
+ end
292
+ end
293
+ end
294
+ assert_equal(true, lCalled)
295
+ end
296
+
297
+ # Test ignoring a dependency
298
+ def testIgnoreDep
299
+ lCalled = false
300
+ setupAppDir do
301
+ setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI') do
302
+ # Tune the UI's behaviour
303
+ @Installer.accessPlugin('Views', 'RegressionUI') do |ioPlugin|
304
+ ioPlugin.Ignore = true
305
+ end
306
+ # Call the installer expecting the GUI to appear
307
+ lDesc = getSimpleDesc
308
+ lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensureDependencies( [ lDesc ], {
309
+ :PreferredViews => [ 'RegressionUI' ]
310
+ } )
311
+ # Check results
312
+ assert_equal(nil, lError)
313
+ assert_equal( {}, lCMApplied )
314
+ assert_equal( [ lDesc ], lIgnoredDeps )
315
+ assert_equal( [], lUnresolvedDeps )
316
+ # Get the plugin back
317
+ @Installer.accessPlugin('Views', 'RegressionUI') do |iPlugin|
318
+ # Check that it was called correctly
319
+ lCalled = iPlugin.Called
320
+ end
321
+ # Check that the dependency is not resolved
322
+ @Installer.accessPlugin('Testers', 'Binaries') do |iPlugin|
323
+ assert_equal(false, iPlugin.isContentResolved?('DummyBinary'))
324
+ end
325
+ end
326
+ end
327
+ assert_equal(true, lCalled)
328
+ end
329
+
330
+ # Test locating a dependency
331
+ def testLocateDep
332
+ lLocatorCalled = false
333
+ lCalled = false
334
+ setupAppDir do
335
+ setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI', 'RDI::Test::Flows::UIFlows::RegressionUI::Directory') do
336
+ # Tune the UI's behaviour
337
+ @Installer.accessPlugin('Views', 'RegressionUI') do |ioPlugin|
338
+ ioPlugin.Locate = true
339
+ end
340
+ @Installer.accessPlugin('LocationSelectors_RegressionUI', 'Directory') do |ioPlugin|
341
+ ioPlugin.Directory = "#{@RepositoryDir}/Binaries"
342
+ end
343
+ # Call the installer expecting the GUI to appear
344
+ lDesc = getSimpleDesc
345
+ lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensureDependencies( [ lDesc ], {
346
+ :PreferredViews => [ 'RegressionUI' ]
347
+ } )
348
+ # Check results
349
+ assert_equal(nil, lError)
350
+ assert_equal( { 'DummyBinary' => [ [ 'SystemPath', "#{@RepositoryDir}/Binaries" ] ] }, lCMApplied )
351
+ assert_equal( [], lIgnoredDeps )
352
+ assert_equal( [], lUnresolvedDeps )
353
+ # Get the plugins back
354
+ @Installer.accessPlugin('Views', 'RegressionUI') do |iPlugin|
355
+ # Check that it was called correctly
356
+ lCalled = iPlugin.Called
357
+ end
358
+ @Installer.accessPlugin('LocationSelectors_RegressionUI', 'Directory') do |iPlugin|
359
+ # Check that it was called correctly
360
+ lLocatorCalled = iPlugin.Called
361
+ end
362
+ # Check that the dependency is resolved
363
+ @Installer.accessPlugin('Testers', 'Binaries') do |iPlugin|
364
+ assert_equal(true, iPlugin.isContentResolved?('DummyBinary'))
365
+ end
366
+ end
367
+ end
368
+ assert_equal(true, lCalled)
369
+ assert_equal(true, lLocatorCalled)
370
+ end
371
+
372
+ # Test locating a dependency we can't resolve
373
+ def testLocateDepError
374
+ lLocatorCalled = false
375
+ lCalled = false
376
+ setupAppDir do
377
+ setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI', 'RDI::Test::Flows::UIFlows::RegressionUI::Directory') do
378
+ # Tune the UI's behaviour
379
+ @Installer.accessPlugin('Views', 'RegressionUI') do |ioPlugin|
380
+ ioPlugin.Locate = true
381
+ end
382
+ @Installer.accessPlugin('LocationSelectors_RegressionUI', 'Directory') do |ioPlugin|
383
+ # We give a wrong directory here
384
+ ioPlugin.Directory = "#{@RepositoryDir}/Libraries"
385
+ end
386
+ # Call the installer expecting the GUI to appear
387
+ lDesc = getSimpleDesc
388
+ lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensureDependencies( [ lDesc ], {
389
+ :PreferredViews => [ 'RegressionUI' ]
390
+ } )
391
+ # Check results
392
+ assert_equal(nil, lError)
393
+ assert_equal( {}, lCMApplied )
394
+ assert_equal( [], lIgnoredDeps )
395
+ assert_equal( [ lDesc ], lUnresolvedDeps )
396
+ # Get the plugins back
397
+ @Installer.accessPlugin('Views', 'RegressionUI') do |iPlugin|
398
+ # Check that it was called correctly
399
+ lCalled = iPlugin.Called
400
+ end
401
+ @Installer.accessPlugin('LocationSelectors_RegressionUI', 'Directory') do |iPlugin|
402
+ # Check that it was called correctly
403
+ lLocatorCalled = iPlugin.Called
404
+ end
405
+ # Check that the dependency is resolved
406
+ @Installer.accessPlugin('Testers', 'Binaries') do |iPlugin|
407
+ assert_equal(false, iPlugin.isContentResolved?('DummyBinary'))
408
+ end
409
+ end
410
+ end
411
+ assert_equal(true, lCalled)
412
+ assert_equal(true, lLocatorCalled)
413
+ end
414
+
415
+ # Test installing in another destination
416
+ def testInstallDepOtherLocation
417
+ lCalled = false
418
+ setupAppDir do
419
+ setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI', 'RDI::Test::Flows::UIFlows::RegressionUI::Directory') do
420
+ # Tune the UI
421
+ @Installer.accessPlugin('Views', 'RegressionUI') do |ioPlugin|
422
+ ioPlugin.InstallOtherLocation = true
423
+ end
424
+ lInstallDir = "#{@Installer.TempDir}/Regression"
425
+ @Installer.accessPlugin('LocationSelectors_RegressionUI', 'Directory') do |ioPlugin|
426
+ # Set the directory where we want to install
427
+ ioPlugin.Directory = lInstallDir
428
+ end
429
+ # Call the installer expecting the GUI to appear
430
+ lDesc = getSimpleDesc
431
+ lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensureDependencies( [ lDesc ], {
432
+ :PreferredViews => [ 'RegressionUI' ]
433
+ } )
434
+ # Check results
435
+ assert_equal(nil, lError)
436
+ assert_equal( [], lIgnoredDeps )
437
+ assert_equal( [], lUnresolvedDeps )
438
+ # Get the plugin back
439
+ @Installer.accessPlugin('Views', 'RegressionUI') do |iPlugin|
440
+ # Check that it was called correctly
441
+ lCalled = iPlugin.Called
442
+ # Get the first install destination (this is where it will be installed
443
+ assert_equal( { 'DummyBinary' => [ [ 'SystemPath', lInstallDir ] ] }, lCMApplied )
444
+ end
445
+ # Check that the dependency is resolved
446
+ @Installer.accessPlugin('Testers', 'Binaries') do |iPlugin|
447
+ assert_equal(true, iPlugin.isContentResolved?('DummyBinary'))
448
+ end
449
+ end
450
+ end
451
+ assert_equal(true, lCalled)
452
+ end
453
+
454
+ end
455
+
456
+ end
457
+
458
+ end
459
+
460
+ end
@@ -0,0 +1,44 @@
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 GemPath < RDITestCase
13
+
14
+ include RDITestCase_ContextModifiers
15
+
16
+ # Constructor
17
+ def setup
18
+ super
19
+ @ContextModifierPluginName = 'GemPath'
20
+ # Install Gems if needed
21
+ require 'rdi/Plugins/RubyGemsDepDesc'
22
+ setupAppDir do
23
+ @Installer.ensureDependencies( [
24
+ # RubyGems
25
+ RDI::getRubyGemsDepDesc
26
+ ] )
27
+ end
28
+ end
29
+
30
+ # Get a test location
31
+ #
32
+ # Return:
33
+ # * _Object_: Location of the given ContextModifier to be tested
34
+ def getTestLocation
35
+ return 'DummyLocation'
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -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 LibraryPath < RDITestCase
13
+
14
+ include RDITestCase_ContextModifiers
15
+
16
+ # Constructor
17
+ def setup
18
+ super
19
+ @ContextModifierPluginName = 'LibraryPath'
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,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 RubyLoadPath < RDITestCase
13
+
14
+ include RDITestCase_ContextModifiers
15
+
16
+ # Constructor
17
+ def setup
18
+ super
19
+ @ContextModifierPluginName = 'RubyLoadPath'
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