RDI 0.1.0.20091020

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,76 @@
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 'rdi/Model/ContextModifier'
7
+
8
+ module RDI
9
+
10
+ module ContextModifiers
11
+
12
+ class RubyLoadPath < RDI::Model::ContextModifier
13
+
14
+ # Get the name of classes that provide selection facility for locations
15
+ #
16
+ # Return:
17
+ # * _String_: The name of the LocationSelector class
18
+ def getLocationSelectorName
19
+ return 'Directory'
20
+ end
21
+
22
+ # Transform a given content based on an installation environment.
23
+ # This is called to pass some specific installation parameters to a more generic content (useful for installation directories for example)
24
+ #
25
+ # Parameters:
26
+ # * *iLocation* (_Object_): Location to transform
27
+ # * *iInstallEnv* (<em>map<Symbol,Object></em>): The installation environment that called this context modification
28
+ # Return:
29
+ # * _Object_: The location transformed with the installation environment
30
+ def transformContentWithInstallEnv(iLocation, iInstallEnv)
31
+ rNewLocation = iLocation
32
+
33
+ lInstallDir = iInstallEnv[:InstallDir]
34
+ if (lInstallDir != nil)
35
+ rNewLocation = iLocation.gsub(/%INSTALLDIR%/, lInstallDir)
36
+ end
37
+
38
+ return rNewLocation
39
+ end
40
+
41
+ # Is a given location present in the context ?
42
+ #
43
+ # Parameters:
44
+ # * *iLocation* (_Object_): Location to add
45
+ # Return:
46
+ # * _Boolean_: Is the location already present ?
47
+ def isLocationInContext?(iLocation)
48
+ # * *iLocation* (_String_): Directory
49
+ return $LOAD_PATH.include?(iLocation)
50
+ end
51
+
52
+ # Add a given location to the context
53
+ #
54
+ # Parameters:
55
+ # * *iLocation* (_Object_): Location to add
56
+ def addLocationToContext(iLocation)
57
+ # * *iLocation* (_String_): Directory
58
+ $LOAD_PATH << iLocation
59
+ end
60
+
61
+ # Remove a given location from the context
62
+ #
63
+ # Parameters:
64
+ # * *iLocation* (_Object_): Location to remove
65
+ def removeLocationFromContext(iLocation)
66
+ # * *iLocation* (_String_): Directory
67
+ $LOAD_PATH.delete_if do |iLoadDir|
68
+ (iLoadDir == iLocation)
69
+ end
70
+ end
71
+
72
+ end
73
+
74
+ end
75
+
76
+ end
@@ -0,0 +1,74 @@
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 'rdi/Model/ContextModifier'
7
+
8
+ module RDI
9
+
10
+ module ContextModifiers
11
+
12
+ class SystemPath < RDI::Model::ContextModifier
13
+
14
+ # Get the name of classes that provide selection facility for locations
15
+ #
16
+ # Return:
17
+ # * _String_: The name of the LocationSelector class
18
+ def getLocationSelectorName
19
+ return 'Directory'
20
+ end
21
+
22
+ # Transform a given content based on an installation environment.
23
+ # This is called to pass some specific installation parameters to a more generic content (useful for installation directories for example)
24
+ #
25
+ # Parameters:
26
+ # * *iLocation* (_Object_): Location to transform
27
+ # * *iInstallEnv* (<em>map<Symbol,Object></em>): The installation environment that called this context modification
28
+ # Return:
29
+ # * _Object_: The location transformed with the installation environment
30
+ def transformContentWithInstallEnv(iLocation, iInstallEnv)
31
+ rNewLocation = iLocation
32
+
33
+ lInstallDir = iInstallEnv[:InstallDir]
34
+ if (lInstallDir != nil)
35
+ rNewLocation = iLocation.gsub(/%INSTALLDIR%/, lInstallDir)
36
+ end
37
+
38
+ return rNewLocation
39
+ end
40
+
41
+ # Is a given location present in the context ?
42
+ #
43
+ # Parameters:
44
+ # * *iLocation* (_Object_): Location to add
45
+ # Return:
46
+ # * _Boolean_: Is the location already present ?
47
+ def isLocationInContext?(iLocation)
48
+ # * *iLocation* (_String_): Directory
49
+ return $rUtilAnts_Platform_Info.getSystemExePath.include?(iLocation)
50
+ end
51
+
52
+ # Add a given location to the context
53
+ #
54
+ # Parameters:
55
+ # * *iLocation* (_Object_): Location to add
56
+ def addLocationToContext(iLocation)
57
+ # * *iLocation* (_String_): Directory
58
+ $rUtilAnts_Platform_Info.setSystemExePath($rUtilAnts_Platform_Info.getSystemExePath + [ iLocation ])
59
+ end
60
+
61
+ # Remove a given location from the context
62
+ #
63
+ # Parameters:
64
+ # * *iLocation* (_Object_): Location to remove
65
+ def removeLocationFromContext(iLocation)
66
+ # * *iLocation* (_String_): Directory
67
+ $rUtilAnts_Platform_Info.setSystemExePath($rUtilAnts_Platform_Info.getSystemExePath - [ iLocation ])
68
+ end
69
+
70
+ end
71
+
72
+ end
73
+
74
+ end
@@ -0,0 +1,127 @@
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 Gem
7
+
8
+ class GemPathList < Array
9
+
10
+ # Add a path to the list
11
+ #
12
+ # Parameters:
13
+ # * *iDirName* (_String_): Directory to add to the list
14
+ def <<(iDirName)
15
+ # Add the path for real in the internals
16
+ super
17
+ # Add the lib directory if it is already initialized
18
+ if ((defined?(@LibDirs) != nil) and
19
+ (@LibDirs != nil))
20
+ Dir.glob("#{iDirName}/gems/*").each do |iGemDirName|
21
+ if (File.exists?("#{iGemDirName}/lib"))
22
+ @LibDirs << iGemDirName
23
+ end
24
+ end
25
+ end
26
+ # Add the path in RubyGems
27
+ Gem.path_ORG << iDirName
28
+ end
29
+
30
+ # Get the list of lib directories accessible through the paths
31
+ #
32
+ # Return:
33
+ # * <em>list<String></em>: List of paths
34
+ def getLibDirs
35
+ if ((defined?(@LibDirs) == nil) or
36
+ (@LibDirs == nil))
37
+ # Create it
38
+ @LibDirs = []
39
+ each do |iGemsDirName|
40
+ Dir.glob("#{iGemsDirName}/gems/*").each do |iGemDirName|
41
+ if (File.exists?("#{iGemDirName}/lib"))
42
+ @LibDirs << iGemDirName
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ return @LibDirs
49
+ end
50
+
51
+ # Clear the paths
52
+ def clear_paths
53
+ Gem.clear_paths_ORG
54
+ # Reset our cache with the new paths
55
+ replace(Gem.path_ORG)
56
+ @LibDirs = nil
57
+ end
58
+
59
+ # Clear the cache
60
+ def clearCache
61
+ @LibDirs = nil
62
+ end
63
+
64
+ end
65
+
66
+ $RDI_GemPath_Cache = GemPathList.new(Gem.path)
67
+
68
+ # Alias the old class methods
69
+ class << self
70
+ alias :find_files_ORG :find_files
71
+ remove_method :find_files
72
+ alias :path_ORG :path
73
+ remove_method :path
74
+ alias :clear_paths_ORG :clear_paths
75
+ remove_method :clear_paths
76
+ end
77
+
78
+ # Return the list of files matching a Ruby require
79
+ #
80
+ # Parameters:
81
+ # * *iRequireName* (_String_): Name to require
82
+ # Return:
83
+ # * <em>list<String></em>: File names list
84
+ def self.find_files(iRequireName)
85
+ rFilesList = []
86
+
87
+ lRequireGlob = iRequireName
88
+ if (File.extname(iRequireName).empty?)
89
+ # Look using globs of any extension
90
+ lRequireGlob = "#{iRequireName}.{rb,so,o,sl,dll}"
91
+ end
92
+ # 1. Look through Ruby LOAD PATH and the cache
93
+ ($LOAD_PATH + $RDI_GemPath_Cache.getLibDirs).each do |iLibDir|
94
+ lList = Dir.glob("#{iLibDir}/#{lRequireGlob}")
95
+ if (!lList.empty?)
96
+ rFilesList = lList
97
+ break
98
+ end
99
+ end
100
+ # 3. Ask RubyGems for real
101
+ if (rFilesList.empty?)
102
+ rFilesList = Gem.find_files_ORG(iRequireName)
103
+ end
104
+
105
+ return rFilesList
106
+ end
107
+
108
+ # Return the list of Gem paths
109
+ #
110
+ # Return:
111
+ # * <em>list<String></em>: List of Gem paths
112
+ def self.path
113
+ return $RDI_GemPath_Cache
114
+ end
115
+
116
+ # Clear the paths
117
+ def self.clear_paths
118
+ $RDI_GemPath_Cache.clear_paths
119
+ end
120
+
121
+ # Clear the library cache
122
+ # This is useful to ensure usecase tests isolation
123
+ def self.clearCache_RDI
124
+ $RDI_GemPath_Cache.clearCache
125
+ end
126
+
127
+ end
@@ -0,0 +1,72 @@
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 'rdi/Model/Installer'
7
+
8
+ module RDI
9
+
10
+ module Installers
11
+
12
+ class Download < RDI::Model::Installer
13
+
14
+ # Get the list of possible destinations
15
+ #
16
+ # Return:
17
+ # * <em>list<[Integer,Object]></em>: The list of possible destinations and their corresponding installation location (or location selector name for DEST_OTHER)
18
+ def getPossibleDestinations
19
+ return [
20
+ [ DEST_LOCAL, "#{@Installer.ExtDir}/Downloads" ],
21
+ [ DEST_SYSTEM, @Installer.SystemDir ],
22
+ [ DEST_USER, @Installer.UserDir ],
23
+ [ DEST_TEMP, @Installer.TempDir ],
24
+ [ DEST_OTHER, 'Directory' ]
25
+ ]
26
+ end
27
+
28
+ # Install a dependency
29
+ #
30
+ # Parameters:
31
+ # * *iContent* (_Object_): The dependency's content
32
+ # * *iLocation* (_Object_): The installation location
33
+ # * *ioInstallEnv* (<em>map<Symbol,Object></em>): The installed environment, that can be modified here. Stored variables will the be accessible to ContextModifiers. [optional = {}]
34
+ # Return:
35
+ # * _Exception_: The error, or nil in case of success
36
+ def installDependency(iContent, iLocation, ioInstallEnv = {})
37
+ # * *iContent* (_String_): The URL
38
+ # * *iLocation* (_String_): The directory to install to
39
+ rError = nil
40
+
41
+ # Download the URL
42
+ # The URL can be a zip file, a targz, a direct file ...
43
+ # Don't use URL caching.
44
+ accessFile(iContent, { :LocalFileAccess => true }) do |iLocalFileName, iBaseName|
45
+ case File.extname(iLocalFileName).upcase
46
+ when '.ZIP'
47
+ # Unzip before
48
+ rError = extractZipFile(iLocalFileName, iLocation)
49
+ if (rError != nil)
50
+ rError = RuntimeError.new("Error while unzipping from #{iLocalFileName} to #{iLocation}:\n#{rError}")
51
+ end
52
+ # TODO: Handle targz, bz...
53
+ else
54
+ # Just copy
55
+ begin
56
+ FileUtils::mkdir_p(iLocation)
57
+ FileUtils::cp(iLocalFileName, "#{iLocation}/#{File.basename(iLocalFileName)}")
58
+ rescue Exception
59
+ rError = $!
60
+ end
61
+ end
62
+ ioInstallEnv[:InstallDir] = iLocation
63
+ end
64
+
65
+ return rError
66
+ end
67
+
68
+ end
69
+
70
+ end
71
+
72
+ end
@@ -0,0 +1,11 @@
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
+ {
7
+ :PluginsDependencies => [
8
+ # We depend on the Download dependency
9
+ [ 'Installers', 'Download' ]
10
+ ]
11
+ }
@@ -0,0 +1,54 @@
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 'rdi/Model/Installer'
7
+
8
+ module RDI
9
+
10
+ module Installers
11
+
12
+ class DownloadAndInstall < RDI::Installers::Download
13
+
14
+ # Install a dependency
15
+ #
16
+ # Parameters:
17
+ # * *iContent* (_Object_): The dependency's content
18
+ # * *iLocation* (_Object_): The installation location
19
+ # * *ioInstallEnv* (<em>map<Symbol,Object></em>): The installed environment, that can be modified here. Stored variables will the be accessible to ContextModifiers. [optional = {}]
20
+ # Return:
21
+ # * _Exception_: The error, or nil in case of success
22
+ def installDependency(iContent, iLocation, ioInstallEnv = {})
23
+ # * *iContent* (<em>[String,Proc]</em>): The URL and the code to install
24
+ # * *iLocation* (_String_): The directory to install to
25
+ rError = nil
26
+
27
+ iURL, iCmdProc = iContent
28
+ # First we download in a temp directory
29
+ lTmpDir = "#{@Installer.TempDir}/DlAndInst"
30
+ require 'fileutils'
31
+ FileUtils::mkdir_p(lTmpDir)
32
+ rError = super(iURL, lTmpDir)
33
+ if (rError == nil)
34
+ # And then we execute the command to install it
35
+ lOldDir = Dir.getwd
36
+ Dir.chdir(lTmpDir)
37
+ if (iCmdProc.call(iLocation))
38
+ # Remove temporary directory
39
+ FileUtils::rm_rf(lTmpDir)
40
+ ioInstallEnv[:InstallDir] = iLocation
41
+ else
42
+ rError = RuntimeError.new('Installation code failed')
43
+ end
44
+ Dir.chdir(lOldDir)
45
+ end
46
+
47
+ return rError
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+
54
+ end
@@ -0,0 +1,13 @@
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 'rdi/Plugins/RubyGemsDepDesc'
7
+
8
+ {
9
+ :Dependencies => [
10
+ # RubyGems
11
+ ::RDI::getRubyGemsDepDesc
12
+ ]
13
+ }
@@ -0,0 +1,67 @@
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 'rdi/Model/Installer'
7
+
8
+ module RDI
9
+
10
+ module Installers
11
+
12
+ class Gem < RDI::Model::Installer
13
+
14
+ # Get the list of possible destinations
15
+ #
16
+ # Return:
17
+ # * <em>list<[Integer,Object]></em>: The list of possible destinations and their corresponding installation location (or location selector name for DEST_OTHER)
18
+ def getPossibleDestinations
19
+ return [
20
+ [ DEST_LOCAL, "#{@Installer.ExtDir}/LocalGems" ],
21
+ [ DEST_SYSTEM, ::Gem.dir ],
22
+ [ DEST_USER, ::Gem.user_dir ],
23
+ [ DEST_TEMP, @Installer.TempDir ],
24
+ [ DEST_OTHER, 'Directory' ]
25
+ ]
26
+ end
27
+
28
+ # Install a dependency
29
+ #
30
+ # Parameters:
31
+ # * *iContent* (_Object_): The dependency's content
32
+ # * *iLocation* (_Object_): The installation location
33
+ # * *ioInstallEnv* (<em>map<Symbol,Object></em>): The installed environment, that can be modified here. Stored variables will the be accessible to ContextModifiers. [optional = {}]
34
+ # Return:
35
+ # * _Exception_: The error, or nil in case of success
36
+ def installDependency(iContent, iLocation, ioInstallEnv = {})
37
+ # * *iContent* (_String_): The gem install command
38
+ # * *iLocation* (_String_): The directory to install to
39
+ rError = nil
40
+
41
+ # Load RubyGems
42
+ require 'rubygems/command_manager'
43
+ # Install
44
+ begin
45
+ lSplitContent = iContent.split(' ') + [ '-i', iLocation, '--no-rdoc', '--no-ri', '--no-test' ]
46
+ ::Gem::CommandManager.instance.find_command('install').invoke(*lSplitContent)
47
+ rescue ::Gem::SystemExitException
48
+ # For RubyGems, this is normal behaviour: success results in an exception thrown with exit_code 0.
49
+ if ($!.exit_code != 0)
50
+ rError = $!
51
+ else
52
+ # Refresh as otherwise, Gems installed in paths already part of Gem.path will still not be seen by Gem.find_files.
53
+ ::Gem.refresh
54
+ ioInstallEnv[:InstallDir] = iLocation
55
+ end
56
+ rescue Exception
57
+ rError = $!
58
+ end
59
+
60
+ return rError
61
+ end
62
+
63
+ end
64
+
65
+ end
66
+
67
+ end
@@ -0,0 +1,52 @@
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 'rdi/Model/Installer'
7
+
8
+ module RDI
9
+
10
+ module Installers
11
+
12
+ class Yum < RDI::Model::Installer
13
+
14
+ # Get the list of possible destinations
15
+ #
16
+ # Return:
17
+ # * <em>list<[Integer,Object]></em>: The list of possible destinations and their corresponding installation location (or location selector name for DEST_OTHER)
18
+ def getPossibleDestinations
19
+ return [
20
+ [ DEST_SYSTEM, '/' ]
21
+ ]
22
+ end
23
+
24
+ # Install a dependency
25
+ #
26
+ # Parameters:
27
+ # * *iContent* (_Object_): The dependency's content
28
+ # * *iLocation* (_Object_): The installation location
29
+ # * *ioInstallEnv* (<em>map<Symbol,Object></em>): The installed environment, that can be modified here. Stored variables will the be accessible to ContextModifiers. [optional = {}]
30
+ # Return:
31
+ # * _Exception_: The error, or nil in case of success
32
+ def installDependency(iContent, iLocation, ioInstallEnv = {})
33
+ # * *iContent* (_String_): The yum install command
34
+ # * *iLocation* (_String_): The directory to install to
35
+ rError = nil
36
+
37
+ begin
38
+ if (!system("yum -y -q install #{iContent}"))
39
+ rError = RuntimeError.new("Execution of 'yum -y -q install #{iContent}' ended in error with code #{$?.exitstatus}.")
40
+ end
41
+ rescue Exception
42
+ rError = $!
43
+ end
44
+
45
+ return rError
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+
52
+ end
@@ -0,0 +1,13 @@
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 'rdi/Plugins/WxRubyDepDesc'
7
+
8
+ {
9
+ :Dependencies => [
10
+ # WxRuby
11
+ ::RDI::getWxRubyDepDesc
12
+ ]
13
+ }
@@ -0,0 +1,58 @@
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 'rdi/Model/ProgressView'
7
+
8
+ module RDI
9
+
10
+ module ProgressViews
11
+
12
+ class SimpleWxGUI < RDI::Model::ProgressView
13
+
14
+ # Proxy class that will route calls made by RDI to the corresponding RUtilAnts::GUI::TextProgressDialog
15
+ class SimpleWxGUIProgressDialog < RUtilAnts::GUI::TextProgressDialog
16
+
17
+ # Set the title of the operation
18
+ #
19
+ # Parameters:
20
+ # * *iTitle* (_String_): Title of the operation
21
+ def setTitle(iTitle)
22
+ setText(iTitle)
23
+ end
24
+
25
+ # Set the range
26
+ #
27
+ # Parameters:
28
+ # * *iRange* (_Integer_): Range to set
29
+ def setRange(iRange)
30
+ super
31
+ end
32
+
33
+ # Increment the value
34
+ #
35
+ # Parameters:
36
+ # * *iIncrement* (_Integer_): The increment [optional = 1]
37
+ def incValue(iIncrement = 1)
38
+ super
39
+ end
40
+
41
+ end
42
+
43
+ # Setup the progress and call the client code to execute inside
44
+ #
45
+ # Parameters:
46
+ # * _CodeBlock_: The code to execute during this progression:
47
+ # ** *ioProgressView* (_Object_): The progress view that will receive notifications of progression (can be nil if no progression view available)
48
+ def setupProgress(&iCodeToExecute)
49
+ showModal(SimpleWxGUIProgressDialog, Wx.get_app.get_top_window, iCodeToExecute, '') do |iModalResult, iDialog|
50
+ # Nothing to do
51
+ end
52
+ end
53
+
54
+ end
55
+
56
+ end
57
+
58
+ end
@@ -0,0 +1,68 @@
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 'rdi/Model/ProgressView'
7
+
8
+ module RDI
9
+
10
+ module ProgressViews
11
+
12
+ class Text < RDI::Model::ProgressView
13
+
14
+ # Proxy class that will route calls made by RDI to stdout
15
+ class TextProgressDialog
16
+
17
+ # Constructor
18
+ def initialize
19
+ @Range = 0
20
+ @Value = 0
21
+ end
22
+
23
+ # Set the title of the operation
24
+ #
25
+ # Parameters:
26
+ # * *iTitle* (_String_): Title of the operation
27
+ def setTitle(iTitle)
28
+ puts "==== #{iTitle} ... ===="
29
+ end
30
+
31
+ # Set the range
32
+ #
33
+ # Parameters:
34
+ # * *iRange* (_Integer_): Range to set
35
+ def setRange(iRange)
36
+ @Range = iRange
37
+ end
38
+
39
+ # Increment the value
40
+ #
41
+ # Parameters:
42
+ # * *iIncrement* (_Integer_): The increment [optional = 1]
43
+ def incValue(iIncrement = 1)
44
+ @Value += iIncrement
45
+ # Display the value
46
+ if (@Range == 0)
47
+ puts '...'
48
+ else
49
+ puts "#{(@Value*100)/@Range} %"
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+ # Setup the progress and call the client code to execute inside
56
+ #
57
+ # Parameters:
58
+ # * _CodeBlock_: The code to execute during this progression:
59
+ # ** *ioProgressView* (_Object_): The progress view that will receive notifications of progression (can be nil if no progression view available)
60
+ def setupProgress
61
+ yield(TextProgressDialog.new)
62
+ end
63
+
64
+ end
65
+
66
+ end
67
+
68
+ end